File size: 2,327 Bytes
edb8dc4 1b42810 edb8dc4 1b42810 edb8dc4 1b42810 edb8dc4 1b42810 |
1 2 3 4 5 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 |
---
base_model: Qwen/Qwen2.5-32B-Instruct
library_name: peft
license: mit
language:
- en
- ko
- zh
- pt
- ja
- uz
- tl
- th
- vi
- id
---
# FINGU-AI/Qwen2.5-32B-Lora-HQ-e-4
## Overview
`FINGU-AI/Qwen2.5-32B-Lora-HQ-e-4` 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.
## Model Details
- **Model ID**: `FINGU-AI/Qwen2.5-32B-Lora-HQ-e-4`
- **Architecture**: Causal Language Model (LM)
- **Parameters**: 32 billion
- **Precision**: Torch BF16 for efficient GPU memory usage
- **Attention**: SDPA (Scaled Dot-Product Attention)
- **Primary Use Case**: Translation (e.g., Korean to Uzbek), text generation, and dialogue systems.
## Example Usage
### Installation
Make sure to install the required packages:
```bash
pip install torch transformers
```
### Loading the Model
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Model and Tokenizer
model_id = 'FINGU-AI/Qwen2.5-32B-Lora-HQ-e-4'
model = AutoModelForCausalLM.from_pretrained(model_id, attn_implementation="sdpa", torch_dtype=torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model.to('cuda')
# Input Messages for Translation
messages = [
{"role": "system", "content": "translate korean to Uzbek"},
{"role": "user", "content": """์๋ก์ด ์ํ ๊ณ์ข๋ฅผ ๊ฐ์คํ๋ ์ ์ฐจ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
1. ๊ณ์ข ๊ฐ์ค ๋ชฉ์ ๊ณผ ์ ๋ถ ํ์ธ์ ์ํ ์๋ฅ ์ ์ถ
2. ์๋ฅ ๊ฒํ ๊ณผ์ ์ ๊ฑฐ์น๋ ๊ฒ
3. ๊ณ ๊ฐ๋์ ์ ์ ํ์ธ ์ ์ฐจ๋ฅผ ์งํํ๋ ๊ฒ
4. ๋ชจ๋ ์ ์ฐจ๊ฐ ์๋ฃ๋๋ฉด ๊ณ์ข ๊ฐ์ค์ด ๊ฐ๋ฅํฉ๋๋ค.
๊ณ์ข ๊ฐ์ค์ ์ํ์๋ ๊ฒฝ์ฐ, ์ ๋ถ์ฆ๊ณผ ํจ๊ป ๋ฐฉ๋ฌธํด ์ฃผ์๋ฉด ๋ฉ๋๋ค.
"""},
]
# Tokenize and Generate Response
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to('cuda')
outputs = model.generate(
input_ids,
max_new_tokens=500,
do_sample=True,
)
# Decode and Print the Translation
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
``` |