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 deprecated transformers torch_dtype parameter, closes #997

davidmezzetti5d6d3f7a6b65
diff --git a/setup.py b/setup.py
index 7f46b547..e4bcadcd 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as f:
DESCRIPTION = "".join([line for line in f if "gh-dark-mode-only" not in line])
# Required dependencies
-install = ["faiss-cpu>=1.7.1.post2", "msgpack>=1.0.7", "torch>=2.4", "transformers>=4.46.3"]
+install = ["faiss-cpu>=1.7.1.post2", "msgpack>=1.0.7", "torch>=2.4", "transformers>=4.56.2"]
# Required dependencies that are also base transformers dependencies
install += ["huggingface-hub>=0.34.0", "numpy>=1.18.4", "pyyaml>=5.3", "regex>=2022.8.17", "safetensors>=0.4.5"]
diff --git a/src/python/txtai/pipeline/hfpipeline.py b/src/python/txtai/pipeline/hfpipeline.py
index dde01d76..2e12d59a 100644
--- a/src/python/txtai/pipeline/hfpipeline.py
+++ b/src/python/txtai/pipeline/hfpipeline.py
@@ -78,9 +78,9 @@ class HFPipeline(Tensors):
args = inspect.getfullargspec(pipeline).args
# Resolve torch dtype, if necessary
- dtype = kwargs.get("torch_dtype")
+ dtype = kwargs.get("dtype")
if dtype and isinstance(dtype, str) and dtype != "auto":
- kwargs["torch_dtype"] = Resolver()(dtype)
+ kwargs["dtype"] = Resolver()(dtype)
# Split into modelargs and kwargs
return ({arg: value for arg, value in kwargs.items() if arg not in args}, {arg: value for arg, value in kwargs.items() if arg in args})