Skip to content

Commit

Permalink
Ruff fix hsml/util
Browse files Browse the repository at this point in the history
  • Loading branch information
aversey committed Jul 16, 2024
1 parent e65378e commit d2c9a1c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions python/hsml/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,31 +232,31 @@ def validate_metrics(metrics):

def get_predictor_for_model(model, **kwargs):
from hsml.model import Model as BaseModel
from hsml.predictor import Predictor as BasePredictor
from hsml.python.model import Model as PyModel
from hsml.python.predictor import Predictor as PyPredictor
from hsml.sklearn.model import Model as SkLearnModel
from hsml.sklearn.predictor import Predictor as SkLearnPredictor
from hsml.tensorflow.model import Model as TFModel
from hsml.tensorflow.predictor import Predictor as TFPredictor
from hsml.torch.model import Model as TorchModel
from hsml.torch.predictor import Predictor as TorchPredictor
from hsml.predictor import Predictor as BasePredictor
from hsml.tensorflow.predictor import Predictor as TFPredictor
from hsml.sklearn.predictor import Predictor as SkLearnPredictor
from hsml.python.predictor import Predictor as PyPredictor
if not isinstance(model, BaseModel):
raise ValueError(
"model is of type {}, but an instance of {} class is expected".format(
type(model), BaseModel
)
)

if type(model) == TFModel:
if type(model) is TFModel:
return TFPredictor(**kwargs)
if type(model) == TorchModel:
if type(model) is TorchModel:
return TorchPredictor(**kwargs)
if type(model) == SkLearnModel:
if type(model) is SkLearnModel:
return SkLearnPredictor(**kwargs)
if type(model) == PyModel:
if type(model) is PyModel:
return PyPredictor(**kwargs)
if type(model) == BaseModel:
if type(model) is BaseModel:
return BasePredictor( # python as default framework and model server
model_framework=MODEL.FRAMEWORK_PYTHON,
model_server=PREDICTOR.MODEL_SERVER_PYTHON,
Expand Down

0 comments on commit d2c9a1c

Please sign in to comment.