# How can i get TRANSFORMERS\_CACHE in transformers v5?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-get-transformers-cache-in-transformers-v5%2F171777%3E%5C
**Category:** 🤗Transformers\
**Created:** [December 19, 2025, 7:46pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-get-transformers-cache-in-transformers-v5%2F171777 "2025-12-19T19:46:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnucm](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@johnucm](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjohnucm)%5C
**Post date:** [December 19, 2025, 7:46pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-get-transformers-cache-in-transformers-v5%2F171777%2F1 "2025-12-19T19:46:49Z")

</div>

TRANSFORMERS\_CACHE is removed from transformers.utils, and the doc says using HF\_HOME instead. But in some environment the HF\_HOME is not set. How can i get TRANSFORMERS\_CACHE (default cache dir) from code? I don’t quite understand the motivation for this change.

---

<div class="post-metadata">

**Author:** ![RFTSystems](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rftsystems/32/59206_2.png) [@RFTSystems](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FRFTSystems)%5C
**Post date:** [December 19, 2025, 9:45pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-get-transformers-cache-in-transformers-v5%2F171777%2F2 "2025-12-19T21:45:54Z")

</div>

Hey 👋

TRANSFORMERS\_CACHE was removed because the cache is now treated as a Hugging Face Hub concern (shared across transformers, diffusers, datasets, etc.), so the “source of truth” moved to huggingface\_hub and the HF\_HOME / HF\_HUB\_CACHE env vars.

Even if HF\_HOME isn’t set, there’s still a default cache dir. You can get it directly from code like this:

from huggingface\_hub.constants import HF\_HUB\_CACHE  
print(HF\_HUB\_CACHE)

That will resolve to the default (typically ~/.cache/huggingface/hub) unless the user overrides it via HF\_HUB\_CACHE or HF\_HOME.

Motivation-wise:  
it avoids having multiple libraries each inventing their own cache variables/paths and makes tooling/cleanup/offline behavior consistent across the whole HF ecosystem. Hope this helps 👌

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [December 23, 2025, 8:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-get-transformers-cache-in-transformers-v5%2F171777%2F3 "2025-12-23T20:19:43Z")

</div>

Closed on December 23, 2025, 8:19pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
