Skip to content

locked_load

LockedLoadModelManagerDecorator

Bases: ModelManagerDecorator

Must acquire lock to load model

Source code in inference/core/managers/decorators/locked_load.py
 7
 8
 9
10
11
12
class LockedLoadModelManagerDecorator(ModelManagerDecorator):
    """Must acquire lock to load model"""

    def add_model(self, model_id: str, api_key: str, model_id_alias=None):
        with cache.lock(lock_str(model_id), expire=180.0):
            return super().add_model(model_id, api_key, model_id_alias=model_id_alias)