Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Update code and build script to consolidate disabling MPS device around PYTORCH_MPS_DISABLE env variable

davidmezzettie32f61f8b915
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 756660f0..cf9def6c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,7 +42,6 @@ jobs:
echo "OMP_NUM_THREADS=1" >> $GITHUB_ENV
echo "PYTORCH_MPS_DISABLE=1" >> $GITHUB_ENV
echo "LLAMA_NO_METAL=1" >> $GITHUB_ENV
- echo "ACCELERATE_USE_CPU=1" >> $GITHUB_ENV
echo "TIKA_STARTUP_SLEEP=30" >> $GITHUB_ENV
echo "TIKA_STARTUP_MAX_RETRY=10" >> $GITHUB_ENV
if: matrix.os == 'macos-latest'
diff --git a/docs/faq.md b/docs/faq.md
index 32a85b7f..85ef73af 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -107,10 +107,6 @@ Set the following environment parameters.
- Disable PyTorch MPS device via `export PYTORCH_MPS_DISABLE=1`
- Disable llama.cpp metal via `export LLAMA_NO_METAL=1`
-If the issue is with a training pipeline.
-
-- Disable GPU training via `export ACCELERATE_USE_CPU=1`
-
----------
__Issue__
diff --git a/src/python/txtai/pipeline/train/hftrainer.py b/src/python/txtai/pipeline/train/hftrainer.py
index d568150f..ef04431d 100644
--- a/src/python/txtai/pipeline/train/hftrainer.py
+++ b/src/python/txtai/pipeline/train/hftrainer.py
@@ -155,7 +155,7 @@ class HFTrainer(Tensors):
"""
# Default training arguments
- args = {"output_dir": "", "save_strategy": "no", "report_to": "none", "log_level": "warning"}
+ args = {"output_dir": "", "save_strategy": "no", "report_to": "none", "log_level": "warning", "use_cpu": not Models.hasaccelerator()}
# Apply custom arguments
args.update(updates)