Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将训练好的模型进行放入到web.demo中报错 #200

Open
ghh1125 opened this issue Dec 14, 2023 · 0 comments
Open

将训练好的模型进行放入到web.demo中报错 #200

ghh1125 opened this issue Dec 14, 2023 · 0 comments

Comments

@ghh1125
Copy link

ghh1125 commented Dec 14, 2023

错误:RuntimeError: probability tensor contains either inf, nan or element < 0

代码:
def init_model():
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True,
)

model = PeftModel.from_pretrained(model, lora_path)
model = model.merge_and_unload()

model.generation_config = GenerationConfig.from_pretrained(
    model_path
)

tokenizer = AutoTokenizer.from_pretrained(
    model_path,
    use_fast=False,
    trust_remote_code=True
)

# tokenizer.pad_token = tokenizer.bos_token
# tokenizer.padding_side = "left"
return model, tokenizer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant