Skip to content

Commit

Permalink
Falcon Model Support (huggingface#1612)
Browse files Browse the repository at this point in the history
Co-authored-by: leopck <sckphoong@habana.ai>
Co-authored-by: regisss <15324346+regisss@users.noreply.github.com>
  • Loading branch information
3 people authored and Liangyx2 committed Jan 20, 2025
1 parent 95b811d commit 8224c09
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/text-generation/run_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,18 @@ def generate(size=None, reduce_recompile=False):
encode_t0 = time.perf_counter()
# Tokenization
if args.max_input_tokens > 0:
if hasattr(model.config, "type_vocab_size") and model.config.type_vocab_size > 0:
return_token_type_ids = True
else:
return_token_type_ids = False

input_tokens = tokenizer.batch_encode_plus(
input_sentences,
return_tensors="pt",
padding="max_length",
max_length=args.max_input_tokens,
truncation=True,
return_token_type_ids=return_token_type_ids,
)

def compute_valid_sequence_lengths_tensor(input_tokens):
Expand Down

0 comments on commit 8224c09

Please sign in to comment.