from transformers import AutoModel | |
if __name__ == "__main__": | |
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") | |
model = AutoModel.from_pretrained("sabersol/bert-base-uncased-emotion") | |
pred = transformers.pipeline("text-classification", model=model, tokenizer=tokenizer, device=0, return_all_scores=True) | |
example = "The music I am listening to is so energetic and makes me motivated." | |
results = pred(example) | |
print(results) | |