Fix faisss import error

This commit is contained in:
yangdx 2025-07-04 19:12:23 +08:00
parent 531502677e
commit 810676d54c

View File

@ -17,14 +17,13 @@ from .shared_storage import (
set_all_update_flags,
)
import faiss # type: ignore
USE_GPU = os.getenv("FAISS_USE_GPU", "0") == "1"
FAISS_PACKAGE = "faiss-gpu" if USE_GPU else "faiss-cpu"
if not pm.is_installed(FAISS_PACKAGE):
pm.install(FAISS_PACKAGE)
import faiss # type: ignore
@final
@dataclass