Update README.md
Browse files
README.md
CHANGED
@@ -2,4 +2,34 @@
|
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
|
5 |
-
Training details: https://github.com/CVI-SZU/Linly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
|
5 |
+
Training details: https://github.com/CVI-SZU/Linly
|
6 |
+
|
7 |
+
|
8 |
+
```python
|
9 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
10 |
+
import transformers
|
11 |
+
import torch
|
12 |
+
|
13 |
+
model = "Linly-AI/Chinese-Falcon-7B"
|
14 |
+
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
16 |
+
pipeline = transformers.pipeline(
|
17 |
+
"text-generation",
|
18 |
+
model=model,
|
19 |
+
tokenizer=tokenizer,
|
20 |
+
torch_dtype=torch.bfloat16,
|
21 |
+
trust_remote_code=True,
|
22 |
+
device_map="auto",
|
23 |
+
)
|
24 |
+
sequences = pipeline(
|
25 |
+
"User: 你如何看待996?\nBot: 我认为996制度是一种不可取的工作时间安排,因为这会导致员工过多的劳累和身心健康问题。此外,如果公司想要提高生产效率,应该采用更有效的管理方式,而不是通过强行加大工作量来达到目的。\nUser: 那么你有什么建议?\nBot:",
|
26 |
+
max_length=200,
|
27 |
+
do_sample=True,
|
28 |
+
top_k=10,
|
29 |
+
num_return_sequences=1,
|
30 |
+
eos_token_id=tokenizer.eos_token_id,
|
31 |
+
)
|
32 |
+
for seq in sequences:
|
33 |
+
print(f"Result: {seq['generated_text']}")
|
34 |
+
|
35 |
+
```
|