Skip to content

Commit 89a1639

Browse files
committed
Pass torch_dtype="auto" to preserve the model's saved dtype
1 parent 0717b93 commit 89a1639

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

infer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
assert num_warmup_iterations >= 0
8282

8383
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
84-
model = AutoModelForCausalLM.from_pretrained(model_name_or_path).to(device)
84+
model = AutoModelForCausalLM.from_pretrained(
85+
model_name_or_path, torch_dtype="auto"
86+
).to(device)
8587

8688
tokenizer.pad_token = tokenizer.eos_token
8789
model.generation_config.pad_token_id = tokenizer.pad_token_id

0 commit comments

Comments
 (0)