Update README.md
Browse files
README.md
CHANGED
@@ -1,14 +1,57 @@
|
|
1 |
-
---
|
2 |
-
language:
|
3 |
-
- zh
|
4 |
-
- bo
|
5 |
-
- en
|
6 |
-
base_model:
|
7 |
-
- meta-llama/Meta-Llama-3-8B-Instruct
|
8 |
-
pipeline_tag: text-generation
|
9 |
-
---
|
10 |
# TibetaMind: Advanced Tibetan Language Model
|
11 |
**TibetaMind** is an advanced language model based on the Llama 3-8B-Instruct architecture, further fine-tuned using extensive Tibetan language corpora. Through this specialized fine-tuning, **TibetaMind** has significantly enhanced its ability to comprehend, process, and generate Tibetan language content, while also providing seamless cross-language understanding between Tibetan and Chinese. This allows for accurate translation and communication across these languages. **TibetaMind** can be applied to a variety of tasks, including Tibetan text generation, summarization, and translation between Tibetan and Chinese, playing a pivotal role in preserving and advancing Tibetan linguistics in the digital age.
|
12 |
|
|
|
13 |
|
14 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- zh
|
4 |
+
- bo
|
5 |
+
- en
|
6 |
+
base_model:
|
7 |
+
- meta-llama/Meta-Llama-3-8B-Instruct
|
8 |
+
pipeline_tag: text-generation
|
9 |
+
---
|
10 |
# TibetaMind: Advanced Tibetan Language Model
|
11 |
**TibetaMind** is an advanced language model based on the Llama 3-8B-Instruct architecture, further fine-tuned using extensive Tibetan language corpora. Through this specialized fine-tuning, **TibetaMind** has significantly enhanced its ability to comprehend, process, and generate Tibetan language content, while also providing seamless cross-language understanding between Tibetan and Chinese. This allows for accurate translation and communication across these languages. **TibetaMind** can be applied to a variety of tasks, including Tibetan text generation, summarization, and translation between Tibetan and Chinese, playing a pivotal role in preserving and advancing Tibetan linguistics in the digital age.
|
12 |
|
13 |
+
# How to use
|
14 |
|
15 |
+
## Use with transformers
|
16 |
+
|
17 |
+
### Transformers AutoModelForCausalLM
|
18 |
+
|
19 |
+
```python
|
20 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
21 |
+
import torch
|
22 |
+
|
23 |
+
model_id = "DaydreamerF/TibetaMind"
|
24 |
+
|
25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
26 |
+
model = AutoModelForCausalLM.from_pretrained(
|
27 |
+
model_id,
|
28 |
+
torch_dtype=torch.float16,
|
29 |
+
device_map="auto",
|
30 |
+
)
|
31 |
+
|
32 |
+
messages = [
|
33 |
+
{"role": "user", "content": "如何用藏语表达下面汉语的意思:汉语句子:大狗在楼里不好养。"},
|
34 |
+
]
|
35 |
+
|
36 |
+
input_ids = tokenizer.apply_chat_template(
|
37 |
+
messages,
|
38 |
+
add_generation_prompt=True,
|
39 |
+
return_tensors="pt"
|
40 |
+
).to(model.device)
|
41 |
+
|
42 |
+
terminators = [
|
43 |
+
tokenizer.eos_token_id,
|
44 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
45 |
+
]
|
46 |
+
|
47 |
+
outputs = model.generate(
|
48 |
+
input_ids,
|
49 |
+
max_new_tokens=256,
|
50 |
+
eos_token_id=terminators,
|
51 |
+
do_sample=True,
|
52 |
+
temperature=0.6,
|
53 |
+
top_p=0.9,
|
54 |
+
)
|
55 |
+
response = outputs[0][input_ids.shape[-1]:]
|
56 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
57 |
+
```
|