Update README.md
Browse files
README.md
CHANGED
@@ -30,7 +30,7 @@ Yuan2.0 is a new generation Fundamental Large Language Model developed by IEIT S
|
|
30 |
|
31 |
|
32 |
# <span id="Usage">代码调用/Code Usage</span>
|
33 |
-
可以通过如下代码调用 `IEITYuan/Yuan2
|
34 |
|
35 |
You can generate text by invoking the Yuan2-2B model with the following code:
|
36 |
|
@@ -46,7 +46,7 @@ tokenizer = LlamaTokenizer.from_pretrained('IEITYuan/Yuan2-102B-hf')
|
|
46 |
tokenizer.add_tokens(['<sep>', '<pad>', '<mask>', '<predict>', '<FIM_SUFFIX>', '<FIM_PREFIX>', '<FIM_MIDDLE>','<commit_before>','<commit_msg>','<commit_after>','<jupyter_start>','<jupyter_text>','<jupyter_code>','<jupyter_output>','<empty_output>'], special_tokens=True)
|
47 |
|
48 |
print("Creat model...")
|
49 |
-
model = AutoModelForCausalLM.from_pretrained('IEITYuan/Yuan2
|
50 |
|
51 |
inputs = tokenizer("请问目前最先进的机器学习算法有哪些?", return_tensors="pt")["input_ids"].to("cuda:0")
|
52 |
outputs = model.generate(inputs,do_sample=False,max_length=100)
|
|
|
30 |
|
31 |
|
32 |
# <span id="Usage">代码调用/Code Usage</span>
|
33 |
+
可以通过如下代码调用 `IEITYuan/Yuan2-102B-hf` 模型来生成文本:
|
34 |
|
35 |
You can generate text by invoking the Yuan2-2B model with the following code:
|
36 |
|
|
|
46 |
tokenizer.add_tokens(['<sep>', '<pad>', '<mask>', '<predict>', '<FIM_SUFFIX>', '<FIM_PREFIX>', '<FIM_MIDDLE>','<commit_before>','<commit_msg>','<commit_after>','<jupyter_start>','<jupyter_text>','<jupyter_code>','<jupyter_output>','<empty_output>'], special_tokens=True)
|
47 |
|
48 |
print("Creat model...")
|
49 |
+
model = AutoModelForCausalLM.from_pretrained('IEITYuan/Yuan2-102B-hf',device_map='auto',torch_dtype=torch.bfloat16,trust_remote_code=True)
|
50 |
|
51 |
inputs = tokenizer("请问目前最先进的机器学习算法有哪些?", return_tensors="pt")["input_ids"].to("cuda:0")
|
52 |
outputs = model.generate(inputs,do_sample=False,max_length=100)
|