Skip to content
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

Expose HF_HOME in constants #1825

Merged
merged 2 commits into from
Nov 15, 2023
Merged

Expose HF_HOME in constants #1825

merged 2 commits into from
Nov 15, 2023

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Nov 14, 2023

TL;DR: HF_HOME env variable is parsed but not exposed as a huggingface_hub constant. Let's expose it to harmonize things in other libraries.


I am currently making a cleanup of the environment variables in the HF ecosystem, and especially transformers (following up after #1786).

I realized transformers and datasets need to know the HF_HOME directory to store python modules. At the moment the parsing is done individually in those libraries. Let's harmonize that by defining a HF_HOME constant in huggingface_hub directly -instead of lowercased hf_cache_home.

I am tempted to make a new 0.19.2 release once this is merged so that it can directly be integrated in transformers/datasets.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 14, 2023

The documentation is not available anymore as the PR was closed or merged.

os.getenv(
"HF_HOME",
os.path.join(os.getenv("XDG_CACHE_HOME", default_home), "huggingface"),
)
)
hf_cache_home = HF_HOME # for backward compatibility. TODO: remove this in 1.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Wauplin
Copy link
Contributor Author

Wauplin commented Nov 15, 2023

Thanks for the review!

@Wauplin Wauplin merged commit a1b90fa into main Nov 15, 2023
12 of 16 checks passed
@Wauplin Wauplin deleted the expose-hf-home-as-constant branch November 15, 2023 09:00
Wauplin added a commit that referenced this pull request Nov 15, 2023
* Expose HF_HOME in constants

* style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants