Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
请使用以下代码运行我们的模型:
|
2 |
+
```python
|
3 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
+
|
5 |
+
model_path = 'QiYuan-tech/QiHealth-6B-Beta'
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(
|
9 |
+
model_path,
|
10 |
+
device_map="auto",
|
11 |
+
torch_dtype='auto'
|
12 |
+
).eval()
|
13 |
+
|
14 |
+
messages = [
|
15 |
+
{"role": "user", "content": "hi"}
|
16 |
+
]
|
17 |
+
|
18 |
+
input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
|
19 |
+
output_ids = model.generate(input_ids.to('cuda'))
|
20 |
+
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
|
21 |
+
|
22 |
+
print(response)
|
23 |
+
```
|