Skip to content

Commit 0284595

Browse files
authored
fix: pytorch init failures (#175)
1 parent fe4ed1d commit 0284595

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

hindsight-api/hindsight_api/engine/cross_encoder.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ async def initialize(self) -> None:
136136
# 3. Data transfer overhead to GPU outweighs compute benefit
137137
# 4. CPU inference is actually faster for this workload
138138
logger.info(f"Reranker: initializing local provider with model {self.model_name}")
139-
self._model = CrossEncoder(self.model_name)
139+
# Disable lazy loading (meta tensors) which causes issues with newer transformers/accelerate.
140+
# Setting low_cpu_mem_usage=False and device_map=None ensures tensors are fully materialized.
141+
self._model = CrossEncoder(
142+
self.model_name,
143+
model_kwargs={"low_cpu_mem_usage": False, "device_map": None},
144+
)
140145

141146
# Initialize shared executor (limited workers naturally limits concurrency)
142147
if LocalSTCrossEncoder._executor is None:

0 commit comments

Comments
 (0)