Handle ValueError in model_utils (generation config)#25389
Handle ValueError in model_utils (generation config)#25389dbuos wants to merge 2 commits intohuggingface:mainfrom
Conversation
sgugger
left a comment
There was a problem hiding this comment.
Thanks for your quick PR! It seems weird to intercept this error here. The problem seems to stem from an invalid generation config (or the exception is badly chosen) so maybe do another except with a different log: probably at warning level, telling the user the generation config is invalid so we go back to a default config.
What do you think!
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
|
yes, sounds good to do it at the warning level - important to fix soon as this is breaking all transformers usage of llama 2 (and perhaps other models). |
@sgugger Absolutely, that makes sense. I've made the necessary changes. I've added another except block with a warning level. |
ab51215 to
cc012e2
Compare
cc012e2 to
e859561
Compare
|
Uhmmm there are way more models out there with generation config issues than I thought 💔 It seems validation needs more thought, namely:
@dbuos This change is something I'd like to avoid -- if we are not throwing exceptions, we should keep doing things the way we were using before, and not reset the generation config. I'm working on validation this week, so I'd like to take this one :) As such, I'm closing this PR. (cc @sgugger) |
|
ok @gante , will you roll back the latest update then to reverse the breaking changes for models like Llama 2? I was just running the model and same issue. I'm moving to use transformers 4.31 but it's not ideal having to hard code that. |
|
@RonanKMcGovern Yeah, you will be able to run from transformers import AutoModelForCausalLM
chk = 'meta-llama/Llama-2-7b-hf'
if __name__ == '__main__':
model = AutoModelForCausalLM.from_pretrained(chk, load_in_4bit=True, device_map='auto')
print("Loaded Ok")and use the model without modifications or changes in behavior. You may see a bunch of new warnings guiding you towards correct |
|
@RonanKMcGovern apologies if my reaction was perceived as abrupt when closing this PR! Your prompt reaction to fix this issue was appreciated 🤗 |
What does this PR do?
Add error handling clause.
Fixes #25388
Who can review?
@gante