OpenNLPLab commited on
Commit
ec22eda
1 Parent(s): d58788d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -3
README.md CHANGED
@@ -132,12 +132,14 @@ export use_triton=False
132
 
133
  ### Demonstration of Base Model Inference
134
 
 
 
135
  ```python
136
  >>> from transformers import AutoModelForCausalLM, AutoTokenizer
137
- >>> tokenizer = AutoTokenizer.from_pretrained("OpenNLPLab/TransNormerLLM-1B", trust_remote_code=True)
138
- >>> model = AutoModelForCausalLM.from_pretrained("OpenNLPLab/TransNormerLLM-1B", device_map="auto", trust_remote_code=True)
139
  >>> inputs = tokenizer('今天是美好的一天', return_tensors='pt')
140
- >>> pred = model.generate(**inputs, max_new_tokens=2048, repetition_penalty=1.0)
141
  >>> print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
142
  ```
143
 
 
132
 
133
  ### Demonstration of Base Model Inference
134
 
135
+ **📝Note** Kindly utilize the model employing `bfloat16` instead of `float16`.
136
+
137
  ```python
138
  >>> from transformers import AutoModelForCausalLM, AutoTokenizer
139
+ >>> tokenizer = AutoTokenizer.from_pretrained("OpenNLPLab/TransNormerLLM-7B", trust_remote_code=True)
140
+ >>> model = AutoModelForCausalLM.from_pretrained("OpenNLPLab/TransNormerLLM-7B", torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
141
  >>> inputs = tokenizer('今天是美好的一天', return_tensors='pt')
142
+ >>> pred = model.generate(**inputs, max_new_tokens=4096, repetition_penalty=1.0)
143
  >>> print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
144
  ```
145