question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`from_pretrained` doesn't validate its kwargs

See original GitHub issue

splitting off from https://github.com/huggingface/transformers/issues/13895

AutoModel.from_pretrained(mname, reviison=ckpt) # dyslexic typist

Throws no exception and it definitely should, since this could be unnoticed for a long time and meanwhile the user gets incorrect behavior.

Expected behavior:

There should be an assert if a user passes an argument that is not expected by the function.

@LysandreJik, @sgugger

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
julien-ccommented, Oct 7, 2021

on the server side, 403 rather than 404 leaks info because you can “discover” repo names for instance. That’s why 404 is commonly used (on GitHub, etc)

1reaction
stas00commented, Oct 7, 2021

So here we have a bit of a chicken and egg problem, the args that are needed to get to the hub aren’t validated until after the files are successfully fetched. I understand.

So it’d be the same issue with misspelled revision - it’d ignore it, and give the user the main branch instead. And then fail if there is actually a model under main. It was failing for us in a different way since we didn’t have anything under main (different repo: bigscience/tr3d-1B3-oscar-checkpoints). All checkpoints were in branches. That explains why it was failing then and not reporting a misspelled kwargs.

That’s quite the conundrum for the 2 kwargs then: revision and use_auth_token (not sure if there are other critical ones).

Read more comments on GitHub >

github_iconTop Results From Across the Web

model.generate doesn't validate kwargs · Issue #18130 - GitHub
Feature request I made a mistake in a script: model.generate(**tokens, in_length=num_tokens) missing m in min_length and I was puzzling over ...
Read more >
Models - Hugging Face
If a configuration is not provided, kwargs will be first passed to the configuration class initialization function (from_pretrained()). Each key of kwargs that ......
Read more >
TFBertMainLayer gets less accuracy compared to TFBertModel
It seems like the version calling TFBertMainLayer isn't loading the pre-trained weights for the model, which could explain the decrease in ...
Read more >
TypeError: forward() got an unexpected keyword argument ...
I'm not sure how the error message fits the posted code, but based on the failure it seems that net doesn't recognize the...
Read more >
bert model save_pretrained | The AI Search Engine You Control
I think it doesn't make sense that the code looks for config.json in function from_pretrained while there is no config.json generated when function ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found