title: How to set the label names when using the Huggingface TextClassificationPipeline?
body: <p>I am using a fine-tuned Huggingface model (on my company data) with the <a href="https://huggingface.co/transformers/main_classes/pipelines.html#transformers.TextClassificationPipeline" rel="noreferrer">TextClassificationPipeline</a> to make class predictions. Now the labels that this <code>Pipeline</code> predicts defaults to <code>LABEL_0</code>, <code>LABEL_1</code> and so on. Is there a way to supply the label mappings to the <code>TextClassificationPipeline</code> object so that the output may reflect the same?</p>
  <blockquote>
  <p>Env:</p>
  <ul>
  <li>tensorflow==2.3.1</li>
  <li>transformers==4.3.2</li>
  </ul>
  </blockquote>
  <p>Sample Code:</p>
  <pre><code>import os
  os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'  # or any {'0', '1', '2'}
  
  from transformers import TextClassificationPipeline, TFAutoModelForSequenceClassification, AutoTokenizer
  
  MODEL_DIR = &quot;path\to\my\fine-tuned\model&quot;
  
  # Feature extraction pipeline
  model = TFAutoModelForSequenceClassification.from_pretrained(MODEL_DIR)
  tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR)
  
  pipeline = TextClassificationPipeline(model=model,
                                        tokenizer=tokenizer,
                                        framework='tf',
                                        device=0)
  
  result = pipeline(&quot;It was a good watch. But a little boring.&quot;)[0]
  </code></pre>
  <p>Output:</p>
  <pre><code>In [2]: result
  Out[2]: {'label': 'LABEL_1', 'score': 0.8864616751670837}
  </code></pre>