Update README.md
Browse files
README.md
CHANGED
|
@@ -1 +1,68 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
# FINGU-AI/Qwen2.5-7B-M
|
| 5 |
+
|
| 6 |
+
## Overview
|
| 7 |
+
`FINGU-AI/Qwen2.5-7B-M` 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.
|
| 8 |
+
|
| 9 |
+
## Model Details
|
| 10 |
+
- **Model ID**: `FINGU-AI/Qwen2.5-7B-M`
|
| 11 |
+
- **Architecture**: Causal Language Model (LM)
|
| 12 |
+
- **Parameters**: 7 billion
|
| 13 |
+
- **Precision**: Torch BF16 for efficient GPU memory usage
|
| 14 |
+
- **Attention**: SDPA (Scaled Dot-Product Attention)
|
| 15 |
+
- **Primary Use Case**: Translation (e.g., Korean to Uzbek), text generation, and dialogue systems.
|
| 16 |
+
|
| 17 |
+
## Example Usage
|
| 18 |
+
|
| 19 |
+
### Installation
|
| 20 |
+
Make sure to install the required packages:
|
| 21 |
+
|
| 22 |
+
```bash
|
| 23 |
+
pip install torch transformers
|
| 24 |
+
```
|
| 25 |
+
### Loading the Model
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 29 |
+
import torch
|
| 30 |
+
|
| 31 |
+
# Model and Tokenizer
|
| 32 |
+
model_id = 'FINGU-AI/Qwen2.5-7B-M'
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, attn_implementation="sdpa", torch_dtype=torch.bfloat16)
|
| 34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 35 |
+
model.to('cuda')
|
| 36 |
+
|
| 37 |
+
# Input Messages for Translation
|
| 38 |
+
messages = [
|
| 39 |
+
{"role": "system", "content": "translate korean to Uzbek"},
|
| 40 |
+
{"role": "user", "content": """์๋ก์ด ์ํ ๊ณ์ข๋ฅผ ๊ฐ์คํ๋ ์ ์ฐจ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
|
| 41 |
+
|
| 42 |
+
1. ๊ณ์ข ๊ฐ์ค ๋ชฉ์ ๊ณผ ์ ๋ถ ํ์ธ์ ์ํ ์๋ฅ ์ ์ถ
|
| 43 |
+
2. ์๋ฅ ๊ฒํ ๊ณผ์ ์ ๊ฑฐ์น๋ ๊ฒ
|
| 44 |
+
3. ๊ณ ๊ฐ๋์ ์ ์ ํ์ธ ์ ์ฐจ๋ฅผ ์งํํ๋ ๊ฒ
|
| 45 |
+
4. ๋ชจ๋ ์ ์ฐจ๊ฐ ์๋ฃ๋๋ฉด ๊ณ์ข ๊ฐ์ค์ด ๊ฐ๋ฅํฉ๋๋ค.
|
| 46 |
+
|
| 47 |
+
๊ณ์ข ๊ฐ์ค์ ์ํ์๋ ๊ฒฝ์ฐ, ์ ๋ถ์ฆ๊ณผ ํจ๊ป ๋ฐฉ๋ฌธํด ์ฃผ์๋ฉด ๋ฉ๋๋ค.
|
| 48 |
+
"""},
|
| 49 |
+
]
|
| 50 |
+
|
| 51 |
+
# Tokenize and Generate Response
|
| 52 |
+
input_ids = tokenizer.apply_chat_template(
|
| 53 |
+
messages,
|
| 54 |
+
add_generation_prompt=True,
|
| 55 |
+
return_tensors="pt"
|
| 56 |
+
).to('cuda')
|
| 57 |
+
|
| 58 |
+
outputs = model.generate(
|
| 59 |
+
input_ids,
|
| 60 |
+
max_new_tokens=500,
|
| 61 |
+
do_sample=True,
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
# Decode and Print the Translation
|
| 65 |
+
response = outputs[0][input_ids.shape[-1]:]
|
| 66 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
| 67 |
+
```
|
| 68 |
+
|