初始化项目,由ModelHub XC社区提供模型
Model: Sheikhaei/llama-3.2-1b-english-persian-translator Source: Original Platform
This commit is contained in:
37
.gitattributes
vendored
Normal file
37
.gitattributes
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
*.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
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
|
||||
|
||||
90
README.md
Normal file
90
README.md
Normal file
@@ -0,0 +1,90 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
language:
|
||||
- en
|
||||
- fa
|
||||
tags:
|
||||
- translation
|
||||
- english-to-persian
|
||||
- persian-to-english
|
||||
- bilingual
|
||||
- farsi
|
||||
- persian
|
||||
model_type: llama
|
||||
base_model: meta-llama/Llama-3.2-1B
|
||||
pipeline_tag: text-generation
|
||||
library: transformers
|
||||
widget:
|
||||
- text: |
|
||||
### English:
|
||||
The children were playing in the park.
|
||||
### Persian:
|
||||
- text: |
|
||||
### Persian:
|
||||
من به مدرسه میروم.
|
||||
### English:
|
||||
---
|
||||
|
||||
[](https://huggingface.co/spaces/Sheikhaei/llama-3.2-1b-english-persian-translator)
|
||||
|
||||
|
||||
# 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", torch_dtype="auto", device_map="auto")
|
||||
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").to(model.device)
|
||||
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
|
||||
|
||||
36
config.json
Normal file
36
config.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 128000,
|
||||
"eos_token_id": 128001,
|
||||
"head_dim": 64,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2048,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 8192,
|
||||
"max_position_embeddings": 131072,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 16,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": 128256,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": {
|
||||
"factor": 32.0,
|
||||
"high_freq_factor": 4.0,
|
||||
"low_freq_factor": 1.0,
|
||||
"original_max_position_embeddings": 8192,
|
||||
"rope_type": "llama3"
|
||||
},
|
||||
"rope_theta": 500000.0,
|
||||
"tie_word_embeddings": true,
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.53.2",
|
||||
"use_cache": true,
|
||||
"vocab_size": 128257
|
||||
}
|
||||
9
generation_config.json
Normal file
9
generation_config.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 128000,
|
||||
"do_sample": true,
|
||||
"eos_token_id": 128001,
|
||||
"temperature": 0.6,
|
||||
"top_p": 0.9,
|
||||
"transformers_version": "4.53.2"
|
||||
}
|
||||
3
gguf/llama-3.2-1b-english-persian-translator-Q8_0.gguf
Normal file
3
gguf/llama-3.2-1b-english-persian-translator-Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:63d0f38183149cf07a83120e83c3b73a90f979646fdafe6b1388a5f0da2fb894
|
||||
size 1321081440
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:53548b09e7804ca2b37f24cf0d975064ada5f0f14d81ba96794e05be2ae9e052
|
||||
size 2471649704
|
||||
23
special_tokens_map.json
Normal file
23
special_tokens_map.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<|begin_of_text|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "<|end_of_text|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "[PAD]",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e8485b8900f2ef3a891091dbe5ef0edc56f6922c0a23c7dfbb4baf64854f7de4
|
||||
size 17210102
|
||||
2071
tokenizer_config.json
Normal file
2071
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user