Improve language tag
#1
by
lbourdois
- opened
README.md
CHANGED
@@ -1,80 +1,83 @@
|
|
1 |
-
---
|
2 |
-
base_model: Qwen/Qwen2.5-32B-Instruct
|
3 |
-
library_name: peft
|
4 |
-
license: mit
|
5 |
-
language:
|
6 |
-
-
|
7 |
-
-
|
8 |
-
-
|
9 |
-
-
|
10 |
-
-
|
11 |
-
-
|
12 |
-
-
|
13 |
-
-
|
14 |
-
-
|
15 |
-
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
##
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
- **
|
27 |
-
- **
|
28 |
-
- **
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
```
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
80 |
```
|
|
|
1 |
+
---
|
2 |
+
base_model: Qwen/Qwen2.5-32B-Instruct
|
3 |
+
library_name: peft
|
4 |
+
license: mit
|
5 |
+
language:
|
6 |
+
- zho
|
7 |
+
- eng
|
8 |
+
- fra
|
9 |
+
- spa
|
10 |
+
- por
|
11 |
+
- deu
|
12 |
+
- ita
|
13 |
+
- rus
|
14 |
+
- jpn
|
15 |
+
- kor
|
16 |
+
- vie
|
17 |
+
- tha
|
18 |
+
- ara
|
19 |
+
---
|
20 |
+
# FINGU-AI/Qwen2.5-32B-Lora-HQ-e-5
|
21 |
+
|
22 |
+
## Overview
|
23 |
+
`FINGU-AI/Qwen2.5-32B-Lora-HQ-e-5` is a powerful causal language model designed for a variety of natural language processing (NLP) tasks, including machine translation, text generation, and chat-based applications. This model is particularly useful for translating between Korean and Uzbek, as well as supporting other custom NLP tasks through flexible input.
|
24 |
+
|
25 |
+
## Model Details
|
26 |
+
- **Model ID**: `FINGU-AI/Qwen2.5-32B-Lora-HQ-e-5`
|
27 |
+
- **Architecture**: Causal Language Model (LM)
|
28 |
+
- **Parameters**: 32 billion
|
29 |
+
- **Precision**: Torch BF16 for efficient GPU memory usage
|
30 |
+
- **Attention**: SDPA (Scaled Dot-Product Attention)
|
31 |
+
- **Primary Use Case**: Translation (e.g., Korean to Uzbek), text generation, and dialogue systems.
|
32 |
+
|
33 |
+
## Example Usage
|
34 |
+
|
35 |
+
### Installation
|
36 |
+
Make sure to install the required packages:
|
37 |
+
|
38 |
+
```bash
|
39 |
+
pip install torch transformers
|
40 |
+
```
|
41 |
+
### Loading the Model
|
42 |
+
|
43 |
+
```python
|
44 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
45 |
+
import torch
|
46 |
+
|
47 |
+
# Model and Tokenizer
|
48 |
+
model_id = 'FINGU-AI/Qwen2.5-32B-Lora-HQ-e-5'
|
49 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, attn_implementation="sdpa", torch_dtype=torch.bfloat16)
|
50 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
51 |
+
model.to('cuda')
|
52 |
+
|
53 |
+
# Input Messages for Translation
|
54 |
+
messages = [
|
55 |
+
{"role": "system", "content": "translate korean to Uzbek"},
|
56 |
+
{"role": "user", "content": """์๋ก์ด ์ํ ๊ณ์ข๋ฅผ ๊ฐ์คํ๋ ์ ์ฐจ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
|
57 |
+
|
58 |
+
1. ๊ณ์ข ๊ฐ์ค ๋ชฉ์ ๊ณผ ์ ๋ถ ํ์ธ์ ์ํ ์๋ฅ ์ ์ถ
|
59 |
+
2. ์๋ฅ ๊ฒํ ๊ณผ์ ์ ๊ฑฐ์น๋ ๊ฒ
|
60 |
+
3. ๊ณ ๊ฐ๋์ ์ ์ ํ์ธ ์ ์ฐจ๋ฅผ ์งํํ๋ ๊ฒ
|
61 |
+
4. ๋ชจ๋ ์ ์ฐจ๊ฐ ์๋ฃ๋๋ฉด ๊ณ์ข ๊ฐ์ค์ด ๊ฐ๋ฅํฉ๋๋ค.
|
62 |
+
|
63 |
+
๊ณ์ข ๊ฐ์ค์ ์ํ์๋ ๊ฒฝ์ฐ, ์ ๋ถ์ฆ๊ณผ ํจ๊ป ๋ฐฉ๋ฌธํด ์ฃผ์๋ฉด ๋ฉ๋๋ค.
|
64 |
+
"""},
|
65 |
+
]
|
66 |
+
|
67 |
+
# Tokenize and Generate Response
|
68 |
+
input_ids = tokenizer.apply_chat_template(
|
69 |
+
messages,
|
70 |
+
add_generation_prompt=True,
|
71 |
+
return_tensors="pt"
|
72 |
+
).to('cuda')
|
73 |
+
|
74 |
+
outputs = model.generate(
|
75 |
+
input_ids,
|
76 |
+
max_new_tokens=500,
|
77 |
+
do_sample=True,
|
78 |
+
)
|
79 |
+
|
80 |
+
# Decode and Print the Translation
|
81 |
+
response = outputs[0][input_ids.shape[-1]:]
|
82 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
83 |
```
|