-
Notifications
You must be signed in to change notification settings - Fork 911
Fix ApiBuilder in from_pretrained to use env variables #1778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super familiar with API builder, if no evn var is defined I am guessing this is equivalent right? It won't just error out instead?
yes, without env it will fallback to the default and will be equivalent to |
@@ -59,7 +59,7 @@ pub fn from_pretrained<S: AsRef<str>>( | |||
.into()); | |||
} | |||
|
|||
let mut builder = ApiBuilder::new(); | |||
let mut builder = ApiBuilder::from_env(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut builder = ApiBuilder::from_env(); | |
let mut builder = ApiBuilder::from_env("HF_HOME"); |
should we not set that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from_env
does not take any parameter: https://github.com/huggingface/hf-hub/blob/main/src/api/sync.rs#L242 and the name of the env variables are already set in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh shit okay, I was looking at https://docs.rs/env_logger/latest/env_logger/struct.Builder.html#method.from_env, thanks for the heads up
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Can you run cargo clippy! |
Sorry found #1737 which was opened sooner! |
closing then, thanks ! |
Bug
Using
Tokenizer::from_pretrained
does not download the tokenizer into theHF_HOME
folder.Instead it will download it in the user home cache directory.
Fix
Use env variable to load the ApiBuilder so it will read
HF_HOME
variable.Currently they are ignored and the default cache location is used
$HOME/.cache/huggingface