Fix: Use a persistent, writeable location for hugging face models (#12771)

This commit is contained in:
Trenton H
2026-05-09 18:23:11 -07:00
committed by GitHub
parent 79d0a04df0
commit da0f25b546
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -39,6 +39,7 @@ def get_embedding_model() -> "BaseEmbedding":
return HuggingFaceEmbedding(
model_name=config.llm_embedding_model
or "sentence-transformers/all-MiniLM-L6-v2",
cache_folder=str(settings.DATA_DIR / "hf_cache"),
)
case LLMEmbeddingBackend.OLLAMA:
from llama_index.embeddings.ollama import OllamaEmbedding
+2
View File
@@ -3,6 +3,7 @@ from unittest.mock import MagicMock
from unittest.mock import patch
import pytest
from django.conf import settings
from documents.models import Document
from paperless.models import LLMEmbeddingBackend
@@ -116,6 +117,7 @@ def test_get_embedding_model_huggingface(mock_ai_config):
model = get_embedding_model()
MockHuggingFaceEmbedding.assert_called_once_with(
model_name="sentence-transformers/all-MiniLM-L6-v2",
cache_folder=str(settings.DATA_DIR / "hf_cache"),
)
assert model == MockHuggingFaceEmbedding.return_value