Text Generation
Transformers
PyTorch
code
gpt2
custom_code
Eval Results
text-generation-inference
Inference Endpoints
cakiki lewtun HF staff commited on
Commit
3d4d383
1 Parent(s): d3c3868

Fix model device in code example (#4)

Browse files

- Fix model device in code example (02bda2ccbdc90faf06bebe95175e2a9f5f75be5c)


Co-authored-by: Lewis Tunstall <[email protected]>

Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -225,7 +225,7 @@ checkpoint = "bigcode/santacoder"
225
  device = "cuda" # for GPU usage or "cpu" for CPU usage
226
 
227
  tokenizer = AutoTokenizer.from_pretrained(checkpoint)
228
- model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True).to()
229
 
230
  inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
231
  outputs = model.generate(inputs)
 
225
  device = "cuda" # for GPU usage or "cpu" for CPU usage
226
 
227
  tokenizer = AutoTokenizer.from_pretrained(checkpoint)
228
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True).to(device)
229
 
230
  inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
231
  outputs = model.generate(inputs)