Update README.md
Browse files
README.md
CHANGED
|
@@ -47,7 +47,7 @@ This model was trained with back-translated data and a slightly different config
|
|
| 47 |
|
| 48 |
## Try it on our Huggingface Space
|
| 49 |
|
| 50 |
-
Give it a try before downloading here: https://huggingface.co/spaces/quickmt/QuickMT-
|
| 51 |
|
| 52 |
|
| 53 |
## Model Information
|
|
@@ -65,27 +65,30 @@ See the `eole` model configuration in this repository for further details and th
|
|
| 65 |
|
| 66 |
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
|
| 67 |
|
| 68 |
-
Next, install the `quickmt` python library
|
| 69 |
|
| 70 |
```bash
|
| 71 |
git clone https://github.com/quickmt/quickmt.git
|
| 72 |
-
pip install
|
| 73 |
-
|
| 74 |
-
quickmt-model-download quickmt/quickmt-zh-en ./quickmt-ja-en
|
| 75 |
```
|
| 76 |
|
| 77 |
-
Finally use the model in python:
|
| 78 |
|
| 79 |
```python
|
| 80 |
from quickmt import Translator
|
|
|
|
| 81 |
|
| 82 |
-
#
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
# Translate - set beam size to 1 for faster speed (but lower quality)
|
| 86 |
sample_text = 'ノバスコシア州ハリファックスにあるダルハウジー大学医学部教授でカナダ糖尿病協会の臨床・科学部門の責任者を務めるエフード・ウル博士は、この研究はまだ初期段階にあるとして注意を促しました。'
|
| 87 |
|
| 88 |
-
|
| 89 |
```
|
| 90 |
|
| 91 |
> 'Dr Ehud Ulu, professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the clinical and scientific division of the Canadian Diabetes Association, urged caution as the study is still in its infancy.'
|
|
@@ -93,7 +96,7 @@ t(sample_text, beam_size=5)
|
|
| 93 |
```python
|
| 94 |
# Get alternative translations by sampling
|
| 95 |
# You can pass any cTranslate2 `translate_batch` arguments
|
| 96 |
-
|
| 97 |
```
|
| 98 |
|
| 99 |
> 'Dr Ehud Ulu, Professor of Medicine at Dalhousie University in Halifax, Nova Scotia and head of clinical and scientific departments for the Canadian Diabetes Society, urged caution, saying the research was still in its early stages.'
|
|
|
|
| 47 |
|
| 48 |
## Try it on our Huggingface Space
|
| 49 |
|
| 50 |
+
Give it a try before downloading here: https://huggingface.co/spaces/quickmt/QuickMT-gui
|
| 51 |
|
| 52 |
|
| 53 |
## Model Information
|
|
|
|
| 65 |
|
| 66 |
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
|
| 67 |
|
| 68 |
+
Next, install the `quickmt` [python library](github.com/quickmt/quickmt).
|
| 69 |
|
| 70 |
```bash
|
| 71 |
git clone https://github.com/quickmt/quickmt.git
|
| 72 |
+
pip install ./quickmt/
|
|
|
|
|
|
|
| 73 |
```
|
| 74 |
|
| 75 |
+
Finally, use the model in python:
|
| 76 |
|
| 77 |
```python
|
| 78 |
from quickmt import Translator
|
| 79 |
+
from huggingface_hub import snapshot_download
|
| 80 |
|
| 81 |
+
# Download Model (if not downloaded already) and return path to local model
|
| 82 |
+
# Device is either 'auto', 'cpu' or 'cuda'
|
| 83 |
+
mt = Translator(
|
| 84 |
+
snapshot_download("quickmt/quickmt-ja-en", ignore_patterns="eole-model/*"),
|
| 85 |
+
device="cpu"
|
| 86 |
+
)
|
| 87 |
|
| 88 |
# Translate - set beam size to 1 for faster speed (but lower quality)
|
| 89 |
sample_text = 'ノバスコシア州ハリファックスにあるダルハウジー大学医学部教授でカナダ糖尿病協会の臨床・科学部門の責任者を務めるエフード・ウル博士は、この研究はまだ初期段階にあるとして注意を促しました。'
|
| 90 |
|
| 91 |
+
mt(sample_text, beam_size=5)
|
| 92 |
```
|
| 93 |
|
| 94 |
> 'Dr Ehud Ulu, professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the clinical and scientific division of the Canadian Diabetes Association, urged caution as the study is still in its infancy.'
|
|
|
|
| 96 |
```python
|
| 97 |
# Get alternative translations by sampling
|
| 98 |
# You can pass any cTranslate2 `translate_batch` arguments
|
| 99 |
+
mt([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
|
| 100 |
```
|
| 101 |
|
| 102 |
> 'Dr Ehud Ulu, Professor of Medicine at Dalhousie University in Halifax, Nova Scotia and head of clinical and scientific departments for the Canadian Diabetes Society, urged caution, saying the research was still in its early stages.'
|