Skip to content

Commit

Permalink
Add missing device transfer in gpt_generate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Nov 14, 2024
1 parent 27a6a7e commit 95dd376
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch05/01_main-chapter-code/gpt_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def main(gpt_config, input_prompt, model_size):

token_ids = generate(
model=gpt,
idx=text_to_token_ids(input_prompt, tokenizer),
idx=text_to_token_ids(input_prompt, tokenizer).to(device),
max_new_tokens=25,
context_size=gpt_config["context_length"],
top_k=50,
Expand Down

0 comments on commit 95dd376

Please sign in to comment.