translation license:apache-2.0 region:us
---
license: apache-2.0
pipeline_tag: translation
---
The original model is at:
https://www.modelscope.cn/models/damo/nlp_csanmt_translation_en2fr/summary

## Usage

Option 1: use modelscope library

```
pip install modelscope subword_nmt sacremoses jieba
```

```python
from huggingface_hub import snapshot_download
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

model_dir = snapshot_download('modelscope-unofficial/damo-csanmt-en-fr-base')

pipe = pipeline(task=Tasks.translation, model=model_dir)

input_sequence = 'When I was in my 20s, I saw my very first psychotherapy client.'
outputs = pipe(input=input_sequence)

print(outputs['translation'])  # 'Quand j'avais 20 ans, j'ai vu mon tout premier client de psychothérapie.'


batch_input_sequences = [
    "Elon Musk, co-founder and chief executive officer of Tesla Motors.",
    "What's the weather like today?"
]
input_sequence = '<SENT_SPLIT>'.join(batch_input_sequences)
outputs = pipe(input=input_sequence)
print(outputs['translation'].split('<SENT_SPLIT>'))
```

