Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- totally-not-an-llm/EverythingLM-data-V3
|
4 |
+
---
|
5 |
+
|
6 |
+
## Usage:
|
7 |
+
|
8 |
+
'''
|
9 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
10 |
+
import torch
|
11 |
+
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained("TinyPixel/stablelm-ft2", trust_remote_code=True)
|
13 |
+
model = AutoModelForCausalLM.from_pretrained("TinyPixel/stablelm-ft2", torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
|
14 |
+
'''
|
15 |
+
|
16 |
+
'''
|
17 |
+
text = """### System:
|
18 |
+
You are a helpful AI assistant.
|
19 |
+
|
20 |
+
### User:
|
21 |
+
Why is sky blue?
|
22 |
+
|
23 |
+
### Assistant:
|
24 |
+
"""
|
25 |
+
|
26 |
+
device = "cuda:0"
|
27 |
+
|
28 |
+
inputs = tokenizer(text, return_tensors="pt").to(device)
|
29 |
+
outputs = model.generate(**inputs,
|
30 |
+
max_new_tokens=512,
|
31 |
+
do_sample=True,
|
32 |
+
top_p=0.95,
|
33 |
+
temperature=0.7,
|
34 |
+
top_k=50)
|
35 |
+
|
36 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
|
37 |
+
'''
|
38 |
+
|