File size: 763 Bytes
b6a7e2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""Load models and datasets from Github."""

import logging
from abc import ABC, abstractmethod

from giskard.models.base import BaseModel
from giskard.core.model_validation import validate_model
from giskard import Dataset

logger = logging.getLogger(__name__)


class LoaderError(RuntimeError):
    """Could not load the model and/or dataset."""


class DatasetError(LoaderError):
    """Problems related to the dataset."""


class ModelError(LoaderError):
    """Problems related to the model."""


class BaseLoader(ABC):

    @abstractmethod
    def load_giskard_model_dataset(self) -> (BaseModel, Dataset):
        ...

    def validate(self):
        gsk_model, gsk_dataset = self.load_giskard_model_dataset()
        validate_model(gsk_model, gsk_dataset)