Suppress HuggingFace logging warning: "Setting `pad_token_id` to `eos_token_id`:{eos_token_id} for open-end generation."
Full error message
In HuggingFace, every time I call a pipeline() object, I get a warning:
`"Setting `pad_token_id` to `eos_token_id`:{eos_token_id} for open-end generation."
How do I suppress this warning without suppressing all logging warnings? I want other warnings, but I don't want this one.Solutionsource: stackoverflow \u2197
The warning comes for any text generation task done by HuggingFace. This is explained here, and you can see the code here. Avoid that warning by manually setting the pad_token_id (e.g., to match the tokenizer or the eos_token_id). Set the pad_token_id in the generation_config with: model.generation_config.pad_token_id = tokenizer.pad_token_id Alternatively, if you only need to make a single call to generate: When you call model.generate(**encoded_input) just change it to model.generate(**encoded_input, pad_token_id=tokenizer.eos_token_id)
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/cc39221e91c14571cf6e3621519c86971ad13a95db3b4e7b4fcd842aa9fad514hash \u00b7 cc39221e91c14571cf6e3621519c86971ad13a95db3b4e7b4fcd842aa9fad514