mirror of
https://github.com/clearml/clearml-server
synced 2025-01-30 18:36:52 +00:00
Change model input_size field to string
This commit is contained in:
parent
97b9bbc4a9
commit
8b8d8d6e6f
@ -1,4 +1,5 @@
|
||||
from enum import Enum
|
||||
from numbers import Number
|
||||
from typing import Union, Type, Iterable, Mapping
|
||||
|
||||
import jsonmodels.errors
|
||||
@ -96,6 +97,15 @@ class ScalarField(fields.BaseField):
|
||||
types = (str, int, float, bool)
|
||||
|
||||
|
||||
class SafeStringField(fields.StringField):
|
||||
"""String field that can also accept numbers as input"""
|
||||
def parse_value(self, value):
|
||||
if isinstance(value, Number):
|
||||
value = str(value)
|
||||
|
||||
return super().parse_value(value)
|
||||
|
||||
|
||||
class DictField(fields.BaseField):
|
||||
types = (dict,)
|
||||
|
||||
|
@ -13,7 +13,7 @@ from jsonmodels.fields import (
|
||||
from jsonmodels import validators
|
||||
from jsonmodels.validators import Min
|
||||
|
||||
from apiserver.apimodels import ListField, JsonSerializableMixin
|
||||
from apiserver.apimodels import ListField, JsonSerializableMixin, SafeStringField
|
||||
from apiserver.apimodels import ActualEnumField
|
||||
from apiserver.config_repo import config
|
||||
from .workers import MachineStats
|
||||
@ -36,7 +36,7 @@ class ServingModel(Base):
|
||||
model_version = StringField()
|
||||
preprocess_artifact = StringField()
|
||||
input_type = StringField()
|
||||
input_size = IntField()
|
||||
input_size = SafeStringField()
|
||||
tags = ListField(str)
|
||||
system_tags = ListField(str)
|
||||
reference: Sequence[ReferenceItem] = ListField(ReferenceItem)
|
||||
|
@ -58,8 +58,8 @@ _definitions {
|
||||
description: Input type
|
||||
}
|
||||
input_size {
|
||||
type: integer
|
||||
description: Input size in bytes
|
||||
type: string
|
||||
description: Input size
|
||||
}
|
||||
reference: ${_definitions.reference}
|
||||
}
|
||||
@ -178,8 +178,8 @@ _definitions {
|
||||
description: Input type
|
||||
}
|
||||
input_size {
|
||||
type: integer
|
||||
description: Input size in bytes
|
||||
type: string
|
||||
description: Input size
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user