Skip to content

Commit 8e9645c

Browse files
krammnicMark Obozov
and
Mark Obozov
authored
Pass pad_id, to the generate (#2476)
Co-authored-by: Mark Obozov <[email protected]>
1 parent dab36d2 commit 8e9645c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

recipes/configs/qwen2_5/evaluation.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Config for EleutherEvalRecipe in eleuther_eval.py
22
#
33
# To launch, run the following command from root torchtune directory:
4-
# tune run eleuther_eval --config eleuther_evaluation tasks=["truthfulqa_mc2","hellaswag"]
4+
# tune run eleuther_eval --config qwen2_5/evaluation
55

66
output_dir: ./ # Not needed
77

@@ -11,7 +11,7 @@ model:
1111

1212
checkpointer:
1313
_component_: torchtune.training.FullModelHFCheckpointer
14-
checkpoint_dir: /tmp/Qwen2.5-0_5B-Instruct
14+
checkpoint_dir: /tmp/Qwen2.5-0.5B-Instruct
1515
checkpoint_files: [
1616
model.safetensors,
1717
]
@@ -21,8 +21,8 @@ checkpointer:
2121
# Tokenizer
2222
tokenizer:
2323
_component_: torchtune.models.qwen2_5.qwen2_5_tokenizer
24-
path: /tmp/Qwen2.5-0_5B-Instruct/vocab.json
25-
merges_file: /tmp/Qwen2.5-0_5B-Instruct/merges.txt
24+
path: /tmp/Qwen2.5-0.5B-Instruct/vocab.json
25+
merges_file: /tmp/Qwen2.5-0.5B-Instruct/merges.txt
2626
max_seq_len: null
2727

2828
# Environment

recipes/eleuther_eval.py

+2
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,14 @@ def _model_generate(
408408
dtype=self._dtype,
409409
decoder_max_seq_len=self.max_length,
410410
):
411+
411412
toks, _ = generate(
412413
self.model,
413414
maybe_padded_context,
414415
max_generated_tokens=self.max_gen_toks,
415416
temperature=temperature,
416417
top_k=None,
418+
pad_id=self._tokenizer.pad_id,
417419
stop_tokens=self._tokenizer.stop_tokens,
418420
)
419421
return toks[:bsz]

0 commit comments

Comments
 (0)