File size: 713 Bytes
6e17fd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import abc
from model.data import Model, ModelId
from constants import CompetitionParameters
from typing import Optional

class RemoteModelStore(abc.ABC):
    """An abstract base class for storing and retrieving a pre trained model."""

    @abc.abstractmethod
    async def upload_model(self, model: Model, parameters: CompetitionParameters) -> ModelId:
        """Uploads a trained model in the appropriate location based on implementation."""
        pass

    @abc.abstractmethod
    async def download_model(self, model_id: ModelId, local_path: str, parameters: CompetitionParameters) -> Model:
        """Retrieves a trained model from the appropriate location and stores at the given path."""
        pass