I am using the text classification pipeline of huggingface to generate the emotions.
from transformers import pipeline
classifier = pipeline("text-classification",model='distilbert-base-uncased-emotion', return_all_scores=True)
prediction = classifier("I love using transformers. The best part is wide range of support and its easy to use", )
print(prediction)
but this gives result as [[{'label': 'LABEL_0', 'score': 0.005389929749071598}, {'label': 'LABEL_1', 'score': 0.0026532604824751616}, {'label': 'LABEL_2', 'score': 0.03011970967054367}, {'label': 'LABEL_3', 'score': 0.25675541162490845}, {'label': 'LABEL_4', 'score': 0.06454580277204514}, {'label': 'LABEL_5', 'score': 0.017099281772971153}]]
I want to change the label according to the data I trained the model with, I know I can change that in models config file but I want to change that programatically, we have the parameter for idtolabel to change the label with our own data while loading the model from pretrained. can anybody help with me how can I change that, also how to restrict the result, is there any parameter like top_n or top_k to return only that number of results?
@bhadresh-savani you also used this, can you help with the arguments for the pipeline?