💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Add flag to disable macOS Metal for llama.cpp when running builds
davidmezzetti7f241b0f04b0
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex ae2ac5d8..bb3f574c 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -41,6 +41,7 @@ jobs:run: |echo "OMP_NUM_THREADS=1" >> $GITHUB_ENVecho "PYTORCH_MPS_DISABLE=1" >> $GITHUB_ENV+ echo "LLAMA_NO_METAL=1" >> $GITHUB_ENVecho "ACCELERATE_USE_CPU=1" >> $GITHUB_ENVecho "TIKA_STARTUP_SLEEP=30" >> $GITHUB_ENVecho "TIKA_STARTUP_MAX_RETRY=10" >> $GITHUB_ENVdiff --git a/src/python/txtai/pipeline/llm/llama.py b/src/python/txtai/pipeline/llm/llama.pyindex e590e4ad..52566242 100644--- a/src/python/txtai/pipeline/llm/llama.py+++ b/src/python/txtai/pipeline/llm/llama.py@@ -46,7 +46,7 @@ class LlamaCpp(Generation):path = path if os.path.exists(path) else self.download(path)# Default GPU layers if not already set- kwargs["n_gpu_layers"] = kwargs.get("n_gpu_layers", -1 if kwargs.get("gpu", True) else 0)+ kwargs["n_gpu_layers"] = kwargs.get("n_gpu_layers", -1 if kwargs.get("gpu", os.environ.get("LLAMA_NO_METAL") != "1") else 0)# Create llama.cpp instanceself.llm = Llama(path, verbose=kwargs.pop("verbose", False), **kwargs)diff --git a/src/python/txtai/vectors/llama.py b/src/python/txtai/vectors/llama.pyindex 404ce795..11eaf4ee 100644--- a/src/python/txtai/vectors/llama.py+++ b/src/python/txtai/vectors/llama.py@@ -53,7 +53,7 @@ class LlamaCpp(Vectors):modelargs = self.config.get("vectors", {})# Default GPU layers if not already set- modelargs["n_gpu_layers"] = modelargs.get("n_gpu_layers", -1 if self.config.get("gpu", True) else 0)+ modelargs["n_gpu_layers"] = modelargs.get("n_gpu_layers", -1 if modelargs.get("gpu", os.environ.get("LLAMA_NO_METAL") != "1") else 0)# Create llama.cpp instancereturn Llama(path, verbose=modelargs.pop("verbose", False), embedding=True, **modelargs)