Instructions to use ModelSpace/GemmaX2-28-2B-Pretrain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ModelSpace/GemmaX2-28-2B-Pretrain with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="ModelSpace/GemmaX2-28-2B-Pretrain")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ModelSpace/GemmaX2-28-2B-Pretrain") model = AutoModelForCausalLM.from_pretrained("ModelSpace/GemmaX2-28-2B-Pretrain", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: other
|
| 3 |
-
license_name: license
|
| 4 |
-
license_link: LICENSE
|
| 5 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: license
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Model Card for GemmaX2-28
|
| 8 |
+
|
| 9 |
+
## Model Details
|
| 10 |
+
|
| 11 |
+
### Model Description
|
| 12 |
+
|
| 13 |
+
GemmaX2-28-2B-Pretrain is a language model that results from continual pretraining of Gemma2-2B on a mix of 56 billion tokens of monolingual and parallel data in 28 different languages — Arabic, Bengali, Czech, German, English, Spanish, Persian, French, Hebrew, Hindi, Indonesian, Italian, Japanese, Khmer, Korean, Lao, Malay, Burmese, Dutch, polish, Portuguese, Russian, Thai, Tagalog, Turkish, Urdu, Vietnamese, Chinese.
|
| 14 |
+
|
| 15 |
+
GemmaX2-28-2B-v0.1 is the first model in the series. Compared to the current open-source state-of-the-art (SOTA) models, it achieves optimal translation performance across 28 languages, even reaching performance comparable to GPT-4 and Google Translate, indicating it has achieved translation capabilities on par with industry standards.
|
| 16 |
+
|
| 17 |
+
- **Developed by:** Xiaomi
|
| 18 |
+
- **Model type:** A 2B parameter model base on Gemma2, we obtained GemmaX2-28-9B-Pretrain by continuing pre-training on a large amount of monolingual and parallel data. Afterward, GemmaX2-28-9B-v0.1 was derived through supervised fine-tuning on a small set of high-quality instruction data.
|
| 19 |
+
- **Language(s) (NLP):** Arabic, Bengali, Czech, German, English, Spanish, Persian, French, Hebrew, Hindi, Indonesian, Italian, Japanese, Khmer, Korean, Lao, Malay, Burmese, Dutch, polish, Portuguese, Russian, Thai, Tagalog, Turkish, Urdu, Vietnamese, Chinese.
|
| 20 |
+
- **License:** gemma
|
| 21 |
+
|
| 22 |
+
### Model Source
|
| 23 |
+
|
| 24 |
+
- paper: coming soon.
|
| 25 |
+
|
| 26 |
+
### Model Performance
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
|
| 30 |
+
## Limitations
|
| 31 |
+
|
| 32 |
+
GemmaX2-28-2B-v0.1 supports only the 28 most commonly used languages and does not guarantee powerful translation performance for other languages. Additionally, we will continue to improve GemmaX2-28-9B's translation performance, and future models will be release in due course.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
## Run the model
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 40 |
+
|
| 41 |
+
model_id = "ModelMagician/GemmaX2-28-9B-v0.1"
|
| 42 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 43 |
+
|
| 44 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 45 |
+
|
| 46 |
+
text = "Translate this from Chinese to English:\nChinese: 我爱机器翻译\nEnglish:"
|
| 47 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 48 |
+
|
| 49 |
+
outputs = model.generate(**inputs, max_new_tokens=50)
|
| 50 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
### Training Data
|
| 54 |
+
|
| 55 |
+
We collected monolingual data from [CulturaX](https://huggingface.co/datasets/uonlp/CulturaX) and [MADLAD-400](https://huggingface.co/datasets/allenai/MADLAD-400). For parallel data, we collected all Chinese-centric and English-centric parallel dataset from the [OPUS](https://opus.nlpl.eu/) collection up to Auguest 2024 and underwent a series of filtering processes, such as language detection, semantic duplication filtering, quality filtering, and more.
|
| 56 |
+
|
| 57 |
+
## Citation
|
| 58 |
+
|
| 59 |
+
```bibtex
|
| 60 |
+
@misc{gemmax2,
|
| 61 |
+
title = {Multilingual Machine Translation with Open Large Language Models at Practical Scale: An Empirical Study},
|
| 62 |
+
url = {},
|
| 63 |
+
author = {XiaoMi Team},
|
| 64 |
+
month = {October},
|
| 65 |
+
year = {2024}
|
| 66 |
+
}
|
| 67 |
+
```
|