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

Fix model device in code example

Browse files
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)