Skip to content

Commit

Permalink
Fix default cache path for adapters loaded from AH repo (#676)
Browse files Browse the repository at this point in the history
Fixes #570.

This applies for adapters loaded from the (now-legacy) AH repo, and if
`TORCH_HOME` is not set.
  • Loading branch information
calpt authored Apr 14, 2024
1 parent 95cf6bd commit 502eb91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/adapters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
)
from requests.exceptions import HTTPError
from transformers.utils import http_user_agent, is_remote_url
from transformers.utils.hub import torch_cache_home

from . import __version__
from .context import ForwardContext
Expand All @@ -59,6 +58,9 @@
ADAPTER_HUB_ADAPTER_ENTRY_JSON = ADAPTER_HUB_URL + "adapters/{}/{}.json"

# the download cache
torch_cache_home = os.getenv(
"TORCH_HOME", os.path.join(os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache")), "torch")
)
ADAPTER_CACHE = join(torch_cache_home, "adapters")

# these keys are ignored when calculating the config hash
Expand Down

0 comments on commit 502eb91

Please sign in to comment.