Update README.md
Browse files
README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
---
|
|
|
|
|
|
|
2 |
base_model:
|
3 |
- abacusai/Smaug-34B-v0.1
|
4 |
library_name: transformers
|
@@ -14,20 +17,33 @@ license: other
|
|
14 |
The following models were included in the merge:
|
15 |
* [abacusai/Smaug-34B-v0.1](https://huggingface.co/abacusai/Smaug-34B-v0.1)
|
16 |
|
17 |
-
###
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
merge_method: passthrough
|
25 |
-
slices:
|
26 |
-
- sources:
|
27 |
-
- layer_range: [0, 45]
|
28 |
-
model: abacusai/Smaug-34B-v0.1
|
29 |
-
- sources:
|
30 |
-
- layer_range: [15, 60]
|
31 |
-
model: abacusai/Smaug-34B-v0.1
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
pipeline_tag: text-generation
|
5 |
base_model:
|
6 |
- abacusai/Smaug-34B-v0.1
|
7 |
library_name: transformers
|
|
|
17 |
The following models were included in the merge:
|
18 |
* [abacusai/Smaug-34B-v0.1](https://huggingface.co/abacusai/Smaug-34B-v0.1)
|
19 |
|
20 |
+
### Usage
|
21 |
|
22 |
+
```python
|
23 |
|
24 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
25 |
+
import transformers
|
26 |
+
import torch
|
27 |
|
28 |
+
model_id = "Eurdem/SM_Smaug_52B"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
31 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", load_in_4bit= True)
|
32 |
+
|
33 |
+
messages = [
|
34 |
+
{"role": "system", "content": "You are a helpful chatbot who always responds friendly."},
|
35 |
+
{"role": "user", "content": "where is the capital of turkey"},
|
36 |
+
]
|
37 |
+
|
38 |
+
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to("cuda")
|
39 |
+
outputs = model.generate(input_ids,
|
40 |
+
max_new_tokens=1024,
|
41 |
+
do_sample=True,
|
42 |
+
temperature=0.7,
|
43 |
+
top_p=0.7,
|
44 |
+
top_k=500
|
45 |
+
)
|
46 |
+
response = outputs[0][input_ids.shape[-1]:]
|
47 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
48 |
+
|
49 |
+
```
|