deepseek-ai / DeepSeek-Coder

DeepSeek Coder: Let the Code Write Itself
https://coder.deepseek.com/
MIT License
6.01k stars 433 forks source link

Please pass your input's `attention_mask` to obtain reliable results. #112

Closed metero20000 closed 2 months ago

metero20000 commented 5 months ago

The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask to obtain reliable results. Setting pad_token_id to eos_token_id:32021 for open-end generation.

DotaArtist commented 3 months ago

model_inputs = tokenizer([text], return_tensors="pt").to("cuda:0")

generated_ids = model.generate( model_inputs.input_ids, max_new_tokens=512, pad_token_id=tokenizer.eos_token_id,eos_token_id=tokenizer.eos_token_id # add this line <===== )