Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2023 commented the duplicate model load #2033

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading