初始化项目,由ModelHub XC社区提供模型
Model: Sheikhaei/llama-3.2-1b-english-persian-translator Source: Original Platform
This commit is contained in:
84
.ipynb_checkpoints/README-checkpoint.md
Normal file
84
.ipynb_checkpoints/README-checkpoint.md
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
language:
|
||||
- en
|
||||
- fa
|
||||
tags:
|
||||
- translation
|
||||
- english-to-persian
|
||||
- persian-to-english
|
||||
- bilingual
|
||||
model_type: llama
|
||||
base_model: meta-llama/Llama-3.2-1B
|
||||
widget:
|
||||
- text: |
|
||||
### English:
|
||||
The children were playing in the park.
|
||||
### Persian:
|
||||
- text: |
|
||||
### Persian:
|
||||
من به مدرسه میروم.
|
||||
### English:
|
||||
---
|
||||
|
||||
|
||||
# LLaMA 3.2 1B – English ↔ Persian Translator
|
||||
|
||||
This model is a fine-tuned version of [`meta-llama/Llama-3.2-1B`](https://huggingface.co/meta-llama/Llama-3.2-1B), trained for **bidirectional translation** between **English and Persian**. It supports both:
|
||||
|
||||
- 🇬🇧 English → 🇮🇷 Persian
|
||||
- 🇮🇷 Persian → 🇬🇧 English
|
||||
|
||||
---
|
||||
|
||||
## Format
|
||||
|
||||
The model expects prompts in the following format:
|
||||
|
||||
```
|
||||
### English:
|
||||
The children were playing in the park.
|
||||
### Persian:
|
||||
```
|
||||
or
|
||||
|
||||
```
|
||||
### Persian:
|
||||
کودکان در پارک بازی میکردند.
|
||||
### English:
|
||||
```
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained("Sheikhaei/llama-3.2-1b-en-fa-translator")
|
||||
tokenizer = AutoTokenizer.from_pretrained("Sheikhaei/llama-3.2-1b-en-fa-translator")
|
||||
|
||||
prompt = """### English:
|
||||
The children were playing in the park.
|
||||
### Persian:
|
||||
"""
|
||||
|
||||
inputs = tokenizer(prompt, return_tensors="pt")
|
||||
outputs = model.generate(**inputs, max_new_tokens=100, do_sample=False)
|
||||
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
||||
```
|
||||
|
||||
## Training Data
|
||||
|
||||
This model was fine-tuned on a custom English–Persian parallel dataset containing ~640,000 sentence pairs. The source data was collected from Tatoeba and then translated and expanded using the Gemma-3-12B model.
|
||||
|
||||
## Evaluation
|
||||
|
||||
| Direction | BLEU | COMET |
|
||||
|---------------|------|------|
|
||||
| English → Persian | 0.47 | 0.89 |
|
||||
| Persian → English | 0.58 | 0.91 |
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
Reference in New Issue
Block a user