# Cannot download translation models in Colab

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-download-translation-models-in-colab%2F6952%3E%5C
**Category:** Beginners\
**Created:** [June 18, 2021, 9:34am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-download-translation-models-in-colab%2F6952 "2021-06-18T09:34:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghosh-r](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ghosh-r/32/2183_2.png) [@ghosh-r](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fghosh-r)%5C
**Post date:** [June 18, 2021, 9:34am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-download-translation-models-in-colab%2F6952%2F1 "2021-06-18T09:34:24Z")

</div>

I am trying to translate English text to German. And so I run this-

```py
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-de")

```

But I get thrown an error-

> ValueError: This tokenizer cannot be instantiated. Please make sure you have `sentencepiece` installed in order to use this tokenizer.

> **Full error message**
>
> ```bash
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call last)
> <ipython-input-65-accbe9f8763e> in <module>()
> ----> 1 translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-de")
> 
> 1 frames
> /usr/local/lib/python3.7/dist-packages/transformers/pipelines/ __init__.py in pipeline(task, model, config, tokenizer, feature_extractor, framework, revision, use_fast, use_auth_token, model_kwargs, **kwargs)
> 441 
> 442 tokenizer = AutoTokenizer.from_pretrained(
> --> 443 tokenizer_identifier, revision=revision, use_fast=use_fast, _from_pipeline=task, **tokenizer_kwargs
> 444 )
> 445 
> 
> /usr/local/lib/python3.7/dist-packages/transformers/models/auto/tokenization_auto.py in from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
> 449 else:
> 450 raise ValueError(
> --> 451 "This tokenizer cannot be instantiated. Please make sure you have `sentencepiece` installed "
> 452 "in order to use this tokenizer."
> 453 )
> 
> ValueError: This tokenizer cannot be instantiated. Please make sure you have `sentencepiece` installed in order to use this tokenizer.
> 
> ```

As it is suggested that I should have `sentencepiece` installed, I installed it via `pip`, but that does not help. I have tried importing it so that its namespace is available, but it still does not work.

Note: Besides the [`Helsinki-NLP/opus-mt-en-de`](https://huggingface.co/Helsinki-NLP/opus-mt-en-de) model, I have also tried using the `Helsinki-NLP/opus-mt-fr-en` model as shown in [the course video](https://www.youtube.com/watch?v=tiZFewofSLM), but it does not work either.

What am I missing?

---

<div class="post-metadata">

**Author:** ![johnnyfivefingers](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/johnnyfivefingers/32/2664_2.png) [@johnnyfivefingers](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjohnnyfivefingers)%5C
**Post date:** [June 18, 2021, 12:18pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-download-translation-models-in-colab%2F6952%2F2 "2021-06-18T12:18:51Z")

</div>

okay, I tried to run this locally (not in Colab):

```auto
from transformers import pipeline

translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-de")

translation = translator("hello, my name is Bob")

print(translation)

```

and it printed out:

```auto
[{'translation_text': 'Hallo, mein Name ist Bob.'}]

```

I don’t know where you try run that code, but seems to work ok for me. Have you installed latest package of transformers?

`pip install transformers -U`

Where do you run that code?

Can you share the full code to see if something else is going on there?

---

<div class="post-metadata">

**Author:** ![BramVanroy](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bramvanroy/32/47360_2.png) [@BramVanroy](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FBramVanroy)%5C
**Post date:** [June 18, 2021, 12:49pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-download-translation-models-in-colab%2F6952%2F3 "2021-06-18T12:49:01Z")

</div>

Did you restart the kernel after installing sentencepiece?

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsgugger)%5C
**Post date:** [June 18, 2021, 1:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-download-translation-models-in-colab%2F6952%2F4 "2021-06-18T13:21:17Z")

</div>

Yes make sure to run the latest version of the notebooks (the first cell should be `! pip install datasets transformers[sentencepiece]`).

---

<div class="post-metadata">

**Author:** ![ghosh-r](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ghosh-r/32/2183_2.png) [@ghosh-r](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fghosh-r)%5C
**Post date:** [June 18, 2021, 2:38pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-download-translation-models-in-colab%2F6952%2F5 "2021-06-18T14:38:49Z")

</div>

This works. Thanks. 🙂

I had created a new empty Notebook and was working on that. It wasn’t clear to me that I should only use Notebooks that appear if I click the “Open in Colab” button on the course pages.

Thanks for clarifying.
