UserWarning: `pad_token_id` should be positive but got -1.
I get this warning when using Viking-33B :
UserWarning: pad_token_id
should be positive but got -1. This will cause errors when batch generating, if there is padding. Please set pad_token_id
explicitly by model.generation_config.pad_token_id=PAD_TOKEN_ID
to avoid errors in generation, and ensure your input_ids
input does not have negative values.
Should i do something about this?
transformers version is: 4.42.4
code:
model = AutoModelForCausalLM.from_pretrained(
MODEL_PATH,
device_map='auto'
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH, device_map='auto')
encoded = tokenizer("Kuka on Suomen presidentti? Vastaus: ", return_tensors='pt').to(model.device)
pred = model.generate(**encoded, max_new_tokens=512)
output= tokenizer.decode(pred[0])