Skip to content

Commit

Permalink
change where to fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Louly committed Oct 26, 2023
1 parent 6c80244 commit 4564f74
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/onnxruntime/training/language-modeling/run_clm.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ def tokenize_function(examples):

if hasattr(config, "max_position_embeddings"):
max_pos_embeddings = config.max_position_embeddings
if max_pos_embeddings < 0:
max_pos_embeddings = 1024
else:
# Define a default value if the attribute is missing in the config.
max_pos_embeddings = 1024
Expand All @@ -506,10 +508,7 @@ def tokenize_function(examples):
f"The tokenizer picked seems to have a very large `model_max_length` ({tokenizer.model_max_length}). "
f"Using block_size={min(1024, max_pos_embeddings)} instead. You can change that default value by passing --block_size xxx."
)
if max_pos_embeddings > 0:
block_size = min(1024, max_pos_embeddings)
else:
block_size = 1024
else:
if data_args.block_size > tokenizer.model_max_length:
logger.warning(
Expand Down

0 comments on commit 4564f74

Please sign in to comment.