Instructions to use ModelSpace/GemmaX2-28-9B-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ModelSpace/GemmaX2-28-9B-v0.1 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-9B-v0.1")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ModelSpace/GemmaX2-28-9B-v0.1") model = AutoModelForCausalLM.from_pretrained("ModelSpace/GemmaX2-28-9B-v0.1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
#1
by gpengzhi - opened
README.md
CHANGED
|
@@ -51,16 +51,11 @@ GemmaX2-28-9B-v0.1 is an LLM-based translation model. It has been fintuned on Ge
|
|
| 51 |
- **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.
|
| 52 |
|
| 53 |
|
| 54 |
-
##
|
| 55 |
-
|
| 56 |
-
- paper: [Multilingual Machine Translation with Open Large Language Models at Practical Scale: An Empirical Study](https://arxiv.org/pdf/2502.02481)
|
| 57 |
-
|
| 58 |
-
### Model Performance
|
| 59 |
|
| 60 |

|
| 61 |
|
| 62 |
|
| 63 |
-
|
| 64 |
## Run the model
|
| 65 |
|
| 66 |
```python
|
|
@@ -74,7 +69,7 @@ model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
| 74 |
text = "Translate this from Chinese to English:\nChinese: 我爱机器翻译\nEnglish:"
|
| 75 |
inputs = tokenizer(text, return_tensors="pt")
|
| 76 |
|
| 77 |
-
outputs = model.generate(**inputs, max_new_tokens=
|
| 78 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 79 |
```
|
| 80 |
|
|
@@ -96,4 +91,4 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 96 |
|
| 97 |
## Limitations
|
| 98 |
|
| 99 |
-
GemmaX2-28-9B-v0.1
|
|
|
|
| 51 |
- **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.
|
| 52 |
|
| 53 |
|
| 54 |
+
## Model Performance
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |

|
| 57 |
|
| 58 |
|
|
|
|
| 59 |
## Run the model
|
| 60 |
|
| 61 |
```python
|
|
|
|
| 69 |
text = "Translate this from Chinese to English:\nChinese: 我爱机器翻译\nEnglish:"
|
| 70 |
inputs = tokenizer(text, return_tensors="pt")
|
| 71 |
|
| 72 |
+
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 73 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 74 |
```
|
| 75 |
|
|
|
|
| 91 |
|
| 92 |
## Limitations
|
| 93 |
|
| 94 |
+
GemmaX2-28-9B-v0.1 only supports the 28 languages listed above and does not guarantee strong translation performance for other languages. We will continue to enhance the translation performance of GemmaX2-28-9B, and future models will be released in due course.
|