Update README.md
Browse files
README.md
CHANGED
|
@@ -10,13 +10,37 @@ tags:
|
|
| 10 |
|
| 11 |
---
|
| 12 |
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
create mixture of experts.
|
| 17 |
Config used as below:
|
| 18 |
|
| 19 |
-
|
| 20 |
```
|
| 21 |
"""base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 22 |
experts:
|
|
|
|
| 10 |
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Example usage:
|
| 14 |
|
| 15 |
|
| 16 |
+
```python
|
| 17 |
+
from transformers import AutoModelForCausalLM
|
| 18 |
+
from transformers import AutoTokenizer
|
| 19 |
+
|
| 20 |
+
tokenizer = AutoTokenizer.from_pretrained("s3nh/TinyLLama-1.1B-MoE")
|
| 21 |
+
tokenizer = AutoTokenizer.from_pretrained("s3nh/TinyLLama-1.1B-MoE")
|
| 22 |
+
|
| 23 |
+
input_text = """
|
| 24 |
+
###Input: You are a pirate. tell me a story about wrecked ship.
|
| 25 |
+
###Response:
|
| 26 |
+
""")
|
| 27 |
+
|
| 28 |
+
input_ids = tokenizer.encode(input_text, return_tensors='pt').to(device)
|
| 29 |
+
output = model.generate(inputs=input_ids,
|
| 30 |
+
max_length=max_length,
|
| 31 |
+
do_sample=True,
|
| 32 |
+
top_k=10,
|
| 33 |
+
temperature=0.7,
|
| 34 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 35 |
+
attention_mask=input_ids.new_ones(input_ids.shape))
|
| 36 |
+
tokenizer.decode(output[0], skip_special_tokens=True)
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
This model was possible to create by tremendous work of mergekit developers. I decided to merge tinyLlama models to
|
| 41 |
create mixture of experts.
|
| 42 |
Config used as below:
|
| 43 |
|
|
|
|
| 44 |
```
|
| 45 |
"""base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 46 |
experts:
|