mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 19:38:46 -05:00
[GH-ISSUE #12430] issue: Incorrect cache_dir setting in get_model_path causes "Cannot find an appropriate cached snapshot folder" #16598
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alecswan on GitHub (Apr 4, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12430
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.0
Ollama Version (if applicable)
No response
Operating System
ghcr.io/open-webui/open-webui:0.6.0
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
openwebui-1 | DEBUG [open_webui.retrieval.utils] model: sentence-transformers/all-MiniLM-L6-v2
openwebui-1 | DEBUG [open_webui.retrieval.utils] snapshot_kwargs: {'cache_dir': '/app/backend/data/cache/embedding/models/hub', 'local_files_only': True}
openwebui-1 | DEBUG [open_webui.retrieval.utils] model_repo_path: /app/backend/data/cache/embedding/models/hub/models--sentence-transformers--all-MiniLM-L6-v2/snapshots/c9745ed1d9f207416be6d2e6f8de32d1f16199bf
Actual Behavior
openwebui-1 | DEBUG [open_webui.retrieval.utils] model: sentence-transformers/all-MiniLM-L6-v2
openwebui-1 | DEBUG [open_webui.retrieval.utils] snapshot_kwargs: {'cache_dir': '/app/backend/data/cache/embedding/models', 'local_files_only': True}
openwebui-1 | ERROR [open_webui.retrieval.utils] Cannot determine model snapshot path: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.
openwebui-1 | Traceback (most recent call last):
openwebui-1 | File "/app/backend/open_webui/retrieval/utils.py", line 596, in get_model_path
openwebui-1 | model_repo_path = snapshot_download(**snapshot_kwargs)
openwebui-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
openwebui-1 | File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
openwebui-1 | return fn(*args, **kwargs)
openwebui-1 | ^^^^^^^^^^^^^^^^^^^
openwebui-1 | File "/usr/local/lib/python3.11/site-packages/huggingface_hub/_snapshot_download.py", line 219, in snapshot_download
openwebui-1 | raise LocalEntryNotFoundError(
openwebui-1 | huggingface_hub.errors.LocalEntryNotFoundError: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.
Steps to Reproduce
Logs & Screenshots
See logs in Expected and Actual Behavior sections
Additional Information
openwebui docker container has the following env var set by default
HF_HOME=/app/backend/data/cache/embedding/models
SENTENCE_TRANSFORMERS_HOME=/app/backend/data/cache/embedding/models
NOTE that the same value for both env vars
The root cause here is that running snapshot_download(..) method manually will store models in hub/ subfolder of the directory where both env vars are pointing. However, get_model_path(..) will try to load the model from the directory itself, not hub/ subfolder, because it sets
cache_dir = os.getenv("SENTENCE_TRANSFORMERS_HOME")My workaround was "export SENTENCE_TRANSFORMERS_HOME=${HF_HOME}/hub" but this feels kludgy.
The bug is in
cache_dir = os.getenv("SENTENCE_TRANSFORMERS_HOME")line. One way to fix it is to not set cache_dir at all and let huggingface_hub.snapshot_download(..) method resolve the cache dir as it typically does. Alternatively, you could setcache_dir=os.getenv("HF_HUB_CACHE") ? os.getenv("SENTENCE_TRANSFORMERS_HOME")in an attempt to provide some level of backward-compatibility in case somebody is using my workaround.@tjbck commented on GitHub (Apr 4, 2025):
Intended behaviour.