Instructions to use staka/fugumt-en-ja with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use staka/fugumt-en-ja 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="staka/fugumt-en-ja")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("staka/fugumt-en-ja") model = AutoModelForSeq2SeqLM.from_pretrained("staka/fugumt-en-ja", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -32,6 +32,20 @@ fugu_translator = pipeline('translation', model='staka/fugumt-en-ja')
|
|
| 32 |
fugu_translator('This is a cat.')
|
| 33 |
```
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
### Eval results
|
| 36 |
|
| 37 |
The results of the evaluation using [tatoeba](https://tatoeba.org/ja)(randomly selected 500 sentences) are as follows:
|
|
|
|
| 32 |
fugu_translator('This is a cat.')
|
| 33 |
```
|
| 34 |
|
| 35 |
+
If you want to translate multiple sentences, we recommend using [pySBD](https://github.com/nipunsadvilkar/pySBD).
|
| 36 |
+
```python
|
| 37 |
+
!pip install transformers sentencepiece pysbd
|
| 38 |
+
|
| 39 |
+
import pysbd
|
| 40 |
+
seg_en = pysbd.Segmenter(language="en", clean=False)
|
| 41 |
+
|
| 42 |
+
from transformers import pipeline
|
| 43 |
+
fugu_translator = pipeline('translation', model='staka/fugumt-en-ja')
|
| 44 |
+
txt = 'This is a cat. It is very cute.'
|
| 45 |
+
print(fugu_translator(seg_en.segment(txt)))
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
|
| 49 |
### Eval results
|
| 50 |
|
| 51 |
The results of the evaluation using [tatoeba](https://tatoeba.org/ja)(randomly selected 500 sentences) are as follows:
|