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)