Added better readme
Browse files
README.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
library_name: adapter-transformers
|
4 |
+
tags:
|
5 |
+
- Traslation
|
6 |
+
- CTranslate2
|
7 |
---
|
8 |
+
# Quantized M2M100 for Fast Translation with CTranslate2
|
9 |
+
|
10 |
+
This model is a quantized version of the [M2M100 418M model](https://huggingface.co/facebook/m2m100_418M) from Facebook AI, optimized for fast inference using CTranslate2. It supports translation between 100 languages with significantly improved speed compared to the original model.
|
11 |
+
|
12 |
+
## Key Features
|
13 |
+
|
14 |
+
- **Quantization:** The model is quantized to 8-bit integers, reducing model size and accelerating inference.
|
15 |
+
- **CTranslate2:** Leverages CTranslate2 for efficient C++-based inference, further boosting speed.
|
16 |
+
- **Multi-Language Support:** Translates between 100 languages, covering a wide range of linguistic needs.
|
17 |
+
|
18 |
+
## Useage
|
19 |
+
|
20 |
+
```py
|
21 |
+
import ctranslate2
|
22 |
+
import transformers
|
23 |
+
|
24 |
+
translator = ctranslate2.Translator("Rohith04/ct2fast_m2m100_418M")
|
25 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("facebook/m2m100_418M")
|
26 |
+
tokenizer.src_lang = "en"
|
27 |
+
|
28 |
+
source = tokenizer.convert_ids_to_tokens(tokenizer.encode("Hello world!"))
|
29 |
+
target_prefix = [tokenizer.lang_code_to_token["de"]]
|
30 |
+
results = translator.translate_batch([source], target_prefix=[target_prefix])
|
31 |
+
target = results[0].hypotheses[0][1:]
|
32 |
+
|
33 |
+
print(tokenizer.decode(tokenizer.convert_tokens_to_ids(target)))
|
34 |
+
```
|
35 |
+
|
36 |
+
## Resources
|
37 |
+
Original model: https://huggingface.co/facebook/m2m100_418M
|
38 |
+
|
39 |
+
CTranslate2: https://github.com/OpenNMT/CTranslate2
|