Skip to content

Commit

Permalink
#2023 commented the duplicate model load
Browse files Browse the repository at this point in the history
  • Loading branch information
shivakrishnaah committed Jan 20, 2025
1 parent 44ebb1e commit ffbcd1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtimes/huggingface/mlserver_huggingface/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def __init__(self, settings: ModelSettings):
async def load(self) -> bool:
# Loading & caching pipeline in asyncio loop to avoid blocking
logger.info(f"Loading model for task '{self.hf_settings.task_name}'...")
await asyncio.get_running_loop().run_in_executor(
self._model = await asyncio.get_running_loop().run_in_executor(
None,
load_pipeline_from_settings,
self.hf_settings,
self.settings,
)

# Now we load the cached model which should not block asyncio
self._model = load_pipeline_from_settings(self.hf_settings, self.settings)
# self._model = load_pipeline_from_settings(self.hf_settings, self.settings)
self._merge_metadata()
return True

Expand Down

0 comments on commit ffbcd1f

Please sign in to comment.