yuewang-sf commited on
Commit
dc9015f
1 Parent(s): 70e0c1e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -2
README.md CHANGED
@@ -31,8 +31,9 @@ model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint,
31
  torch_dtype=torch.float16,
32
  trust_remote_code=True).to(device)
33
 
34
- inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
35
- outputs = model.generate(inputs, max_length=8)
 
36
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
37
  ```
38
 
 
31
  torch_dtype=torch.float16,
32
  trust_remote_code=True).to(device)
33
 
34
+ encoding = tokenizer("def print_hello_world():", return_tensors="pt").to(device)
35
+ encoding['decoder_input_ids'] = encoding['input_ids'].clone()
36
+ outputs = model.generate(**encoding, max_length=15)
37
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
38
  ```
39