Update README.md
Browse files
README.md
CHANGED
@@ -27,46 +27,41 @@ base_model: tokyotech-llm/Swallow-MS-7b-v0.1
|
|
27 |
# Usage
|
28 |
|
29 |
```python
|
30 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
31 |
import torch
|
|
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(
|
34 |
-
|
35 |
)
|
36 |
model = AutoModelForCausalLM.from_pretrained(
|
37 |
-
|
38 |
)
|
39 |
|
40 |
if torch.cuda.is_available():
|
41 |
-
|
42 |
|
43 |
-
prompt=""
|
44 |
-
ๅ
ใฎไธๅ่ฒใฏ๏ผ
|
45 |
-
### Response:
|
46 |
-
"""
|
47 |
|
48 |
input_ids = tokenizer(prompt, return_tensors="pt").to(model.device)
|
49 |
outputs = model.generate(
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
)
|
57 |
print(tokenizer.decode(outputs[0]))
|
58 |
```
|
59 |
|
60 |
# Output
|
61 |
````
|
62 |
-
<s
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
print('้')
|
69 |
-
```</s>
|
70 |
````
|
71 |
|
72 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
|
|
27 |
# Usage
|
28 |
|
29 |
```python
|
|
|
30 |
import torch
|
31 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(
|
34 |
+
"taoki/Swallow-MS-7b-v0.1-qlora-oaast1-jmulti-dolly-amenokaku"
|
35 |
)
|
36 |
model = AutoModelForCausalLM.from_pretrained(
|
37 |
+
"taoki/Swallow-MS-7b-v0.1-qlora-oaast1-jmulti-dolly-amenokaku"
|
38 |
)
|
39 |
|
40 |
if torch.cuda.is_available():
|
41 |
+
model = model.to("cuda")
|
42 |
|
43 |
+
prompt="[INST] ไปๆฅใฏ4/1ใชใฎใงใใใๅจใใฎ็ใใใ็ชๆๅญใใชใใใจใ่จใฃใฆใใฆๅฐๆใใฆใใพใใไธไฝไฝใ่ตทใใฃใฆใใใฎใงใใใใ๏ผ [/INST]\n"
|
|
|
|
|
|
|
44 |
|
45 |
input_ids = tokenizer(prompt, return_tensors="pt").to(model.device)
|
46 |
outputs = model.generate(
|
47 |
+
**input_ids,
|
48 |
+
max_new_tokens=512,
|
49 |
+
do_sample=True,
|
50 |
+
top_p=0.95,
|
51 |
+
temperature=0.1,
|
52 |
+
repetition_penalty=1.1,
|
53 |
)
|
54 |
print(tokenizer.decode(outputs[0]))
|
55 |
```
|
56 |
|
57 |
# Output
|
58 |
````
|
59 |
+
<s> [INST] ไปๆฅใฏ4/1ใชใฎใงใใใๅจใใฎ็ใใใ็ชๆๅญใใชใใใจใ่จใฃใฆใใฆๅฐๆใใฆใใพใใไธไฝไฝใ่ตทใใฃใฆใใใฎใงใใใใ๏ผ [/INST]
|
60 |
+
4ๆ1ๆฅใฏใจใคใใชใซใใผใซใงใไบบใ
ใฏๅ่ซใใใใใใ่จใฃใฆๆฅฝใใๆฅใจใใใฆใใพใใใใฎ็ฟๆ
ฃใฏใ1564ๅนดใซใใฉใณในใฎใทใฃใซใซ9ไธใ4ๆ1ๆฅใซ็ตๅฉใใใใจใใๅงใพใฃใใจ่จใใใฆใใใ
|
61 |
+
|
62 |
+
ใใใใใใชใใๅฐๆใใฆใใใฎใชใใใใใฏใใใใใใใชใใๅ่ซใใใใใใ่จใฃใฆใใไบบใใกใใใใชใใใใฎใใใชใใฎใ ใจๆใฃใฆใใชใใใจใ่จใฃใฆใใใใใ ใจๆใใพใใใใใฏใๅฝผใใใใชใใ้ฉใใใใใ็ฌใใใใใใใใใซๅใใคใใฆใใๅฏ่ฝๆงใใใใใจใๆๅณใใพใใ
|
63 |
+
|
64 |
+
ใใ่ชฐใใใใชใใๅฐๆใใใใใไธๅฟซใซใใใใใใใใใชใใจใ่จใฃใๅ ดๅใฏใๆฐใซใใ็ก่ฆใใฆใใ ใใใใพใใ่ชๅ่ช่บซใไปไบบใๅทใคใใใใใชๅใใคใใใจใฏ้ฟใใพใใใใ</s>
|
|
|
|
|
65 |
````
|
66 |
|
67 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|