title: T5Tokenizer requires the SentencePiece library but it was not found in your environment
body: <p>I am trying to explore <a href="https://huggingface.co/transformers/model_doc/t5.html#" rel="nofollow noreferrer">T5</a></p>
  <p>this is the code</p>
  <pre><code>!pip install transformers
  from transformers import T5Tokenizer, T5ForConditionalGeneration
  qa_input = &quot;&quot;&quot;question: What is the capital of Syria? context: The name &quot;Syria&quot; historically referred to a wider region,
   broadly synonymous with the Levant, and known in Arabic as al-Sham. The modern state encompasses the sites of several ancient 
   kingdoms and empires, including the Eblan civilization of the 3rd millennium BC. Aleppo and the capital city Damascus are 
   among the oldest continuously inhabited cities in the world.&quot;&quot;&quot;
  tokenizer = T5Tokenizer.from_pretrained('t5-small')
  model = T5ForConditionalGeneration.from_pretrained('t5-small')
  input_ids = tokenizer.encode(qa_input, return_tensors=&quot;pt&quot;)  # Batch size 1
  outputs = model.generate(input_ids)
  output_str = tokenizer.decode(outputs.reshape(-1))
  
  </code></pre>
  <p>I got this error:</p>
  <pre><code>---------------------------------------------------------------------------
  
  ImportError                               Traceback (most recent call last)
  
  &lt;ipython-input-2-8d24c6a196e4&gt; in &lt;module&gt;()
        5  kingdoms and empires, including the Eblan civilization of the 3rd millennium BC. Aleppo and the capital city Damascus are
        6  among the oldest continuously inhabited cities in the world.&quot;&quot;&quot;
  ----&gt; 7 tokenizer = T5Tokenizer.from_pretrained('t5-small')
        8 model = T5ForConditionalGeneration.from_pretrained('t5-small')
        9 input_ids = tokenizer.encode(qa_input, return_tensors=&quot;pt&quot;)  # Batch size 1
  
  1 frames
  
  /usr/local/lib/python3.6/dist-packages/transformers/file_utils.py in requires_sentencepiece(obj)
      521     name = obj.__name__ if hasattr(obj, &quot;__name__&quot;) else obj.__class__.__name__
      522     if not is_sentencepiece_available():
  --&gt; 523         raise ImportError(SENTENCEPIECE_IMPORT_ERROR.format(name))
      524 
      525 
  
  ImportError: 
  T5Tokenizer requires the SentencePiece library but it was not found in your environment. Checkout the instructions on the
  installation page of its repo: https://github.com/google/sentencepiece#installation and follow the ones
  that match your environment.
  
  
  --------------------------------------------------------------------------
  </code></pre>
  <p>after that I install sentencepiece library as was suggested like this:</p>
  <pre><code>!pip install transformers
  !pip install sentencepiece
  
  from transformers import T5Tokenizer, T5ForConditionalGeneration
  qa_input = &quot;&quot;&quot;question: What is the capital of Syria? context: The name &quot;Syria&quot; historically referred to a wider region,
   broadly synonymous with the Levant, and known in Arabic as al-Sham. The modern state encompasses the sites of several ancient 
   kingdoms and empires, including the Eblan civilization of the 3rd millennium BC. Aleppo and the capital city Damascus are 
   among the oldest continuously inhabited cities in the world.&quot;&quot;&quot;
  tokenizer = T5Tokenizer.from_pretrained('t5-small')
  model = T5ForConditionalGeneration.from_pretrained('t5-small')
  input_ids = tokenizer.encode(qa_input, return_tensors=&quot;pt&quot;)  # Batch size 1
  outputs = model.generate(input_ids)
  output_str = tokenizer.decode(outputs.reshape(-1))
  
  </code></pre>
  <p>but I got another issue:</p>
  <blockquote>
  <p>Some weights of the model checkpoint at t5-small were not used when
  initializing T5ForConditionalGeneration:
  ['decoder.block.0.layer.1.EncDecAttention.relative_attention_bias.weight']</p>
  <ul>
  <li>This IS expected if you are initializing T5ForConditionalGeneration from the checkpoint of a model trained on another task or with another
  architecture (e.g. initializing a BertForSequenceClassification model
  from a BertForPreTraining model).</li>
  <li>This IS NOT expected if you are initializing T5ForConditionalGeneration from the checkpoint of a model that you
  expect to be exactly identical (initializing a
  BertForSequenceClassification model from a
  BertForSequenceClassification model).</li>
  </ul>
  </blockquote>
  <p>so I did not understand what is going on, any explanation?</p>