Update README.md
Browse files
README.md
CHANGED
|
@@ -15,15 +15,12 @@ tokenizer = AutoTokenizer.from_pretrained("TinyPixel/stablelm-ft2", trust_remote
|
|
| 15 |
model = AutoModelForCausalLM.from_pretrained("TinyPixel/stablelm-ft2", torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
|
| 16 |
|
| 17 |
text = '''### System:
|
| 18 |
-
|
| 19 |
You are a helpful AI assistant.
|
| 20 |
|
| 21 |
### User:
|
| 22 |
-
|
| 23 |
Why is sky blue?
|
| 24 |
|
| 25 |
### Assistant:
|
| 26 |
-
|
| 27 |
'''
|
| 28 |
|
| 29 |
device = "cuda:0"
|
|
@@ -31,15 +28,10 @@ device = "cuda:0"
|
|
| 31 |
inputs = tokenizer(text, return_tensors="pt").to(device)
|
| 32 |
|
| 33 |
outputs = model.generate(**inputs,
|
| 34 |
-
|
| 35 |
max_new_tokens=512,
|
| 36 |
-
|
| 37 |
do_sample=True,
|
| 38 |
-
|
| 39 |
top_p=0.95,
|
| 40 |
-
|
| 41 |
temperature=0.7,
|
| 42 |
-
|
| 43 |
top_k=50)
|
| 44 |
|
| 45 |
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
|
|
|
|
| 15 |
model = AutoModelForCausalLM.from_pretrained("TinyPixel/stablelm-ft2", torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
|
| 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"
|
|
|
|
| 28 |
inputs = tokenizer(text, return_tensors="pt").to(device)
|
| 29 |
|
| 30 |
outputs = model.generate(**inputs,
|
|
|
|
| 31 |
max_new_tokens=512,
|
|
|
|
| 32 |
do_sample=True,
|
|
|
|
| 33 |
top_p=0.95,
|
|
|
|
| 34 |
temperature=0.7,
|
|
|
|
| 35 |
top_k=50)
|
| 36 |
|
| 37 |
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
|