Fix ApiBuilder in from_pretrained to use env variables#1778
Fix ApiBuilder in from_pretrained to use env variables#1778vdebergue wants to merge 1 commit intohuggingface:mainfrom
Conversation
ArthurZucker
left a comment
There was a problem hiding this comment.
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 |
| } | ||
|
|
||
| let mut builder = ApiBuilder::new(); | ||
| let mut builder = ApiBuilder::from_env(); |
There was a problem hiding this comment.
| 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.
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.
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_pretraineddoes not download the tokenizer into theHF_HOMEfolder.Instead it will download it in the user home cache directory.
Fix
Use env variable to load the ApiBuilder so it will read
HF_HOMEvariable.Currently they are ignored and the default cache location is used
$HOME/.cache/huggingface