Update README.md
#1
by
cat-state
- opened
README.md
CHANGED
|
@@ -30,16 +30,32 @@ tokenizer = AutoTokenizer.from_pretrained("StabilityAI/stablelm-tuned-alpha-7b")
|
|
| 30 |
model = AutoModelForCausalLM.from_pretrained("StabilityAI/stablelm-tuned-alpha-7b")
|
| 31 |
model.half().cuda()
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
tokens = model.generate(
|
| 35 |
**inputs,
|
| 36 |
max_new_tokens=64,
|
| 37 |
-
temperature=0.7,
|
| 38 |
-
do_sample=True,
|
| 39 |
-
)
|
| 40 |
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
| 41 |
```
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
## Model Details
|
| 44 |
|
| 45 |
* **Developed by**: [Stability AI](https://stability.ai/)
|
|
|
|
| 30 |
model = AutoModelForCausalLM.from_pretrained("StabilityAI/stablelm-tuned-alpha-7b")
|
| 31 |
model.half().cuda()
|
| 32 |
|
| 33 |
+
system_prompt = """<|SYSTEM|># StableLM Tuned (Alpha version)
|
| 34 |
+
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
|
| 35 |
+
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
|
| 36 |
+
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
|
| 37 |
+
- StableLM will refuse to participate in anything that could harm a human.
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
prompt = f"{system_prompt}<|USER|>What's your mood today?"
|
| 41 |
+
|
| 42 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 43 |
tokens = model.generate(
|
| 44 |
**inputs,
|
| 45 |
max_new_tokens=64,
|
|
|
|
|
|
|
|
|
|
| 46 |
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
| 47 |
```
|
| 48 |
|
| 49 |
+
StableLM Tuned should be used with prompts formatted to `<|SYSTEM|>...<|USER|>...<|ASSISTANT|>...`
|
| 50 |
+
The system prompt is
|
| 51 |
+
```
|
| 52 |
+
<|SYSTEM|># StableLM Tuned (Alpha version)
|
| 53 |
+
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
|
| 54 |
+
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
|
| 55 |
+
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
|
| 56 |
+
- StableLM will refuse to participate in anything that could harm a human.
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
## Model Details
|
| 60 |
|
| 61 |
* **Developed by**: [Stability AI](https://stability.ai/)
|