File size: 476 Bytes
8d81e54 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from transformers import pipeline
from transformers import AutoTokenizer, CodeGenTokenizer, GPTJForCausalLM, CodeGenConfig, CodeGenModel
import torch
model_name = "rxl7906/codegen-350M-mono-gptj"
model = GPTJForCausalLM.from_pretrained(model_name)
tokenizer = CodeGenTokenizer.from_pretrained(model_name)
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
res = classifier("I've been waiting for a HuggingFace course my whole life!")
print(res) |