Exception has occurred: UnboundLocalError

#23
by deru77 - opened

I got an error when I run CodeLlama-7b-hf.

Can any experts give me an hand?

Here is the source what I run

from transformers import pipeline
import torch
print("cuda" if torch.cuda.is_available() else "cpu")
generator = pipeline("text-generation",model="codellama/CodeLlama-7b-hf",torch_dtype=torch.float16, device_map="auto")
generator('def remove_non_ascii(s: str):\r\n return s', max_new_tokens = 128, return_type = 1)

Exception has occurred: UnboundLocalError
local variable 'record' referenced before assignment
File "/home/ryan.baek/codellama/main.py", line 5, in
generator('def remove_non_ascii(s: str):\r\n return s', max_new_tokens = 128, return_type = 1)
UnboundLocalError: local variable 'record' referenced before assignment

Sign up or log in to comment