mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 02:46:53 +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 enum import Enum
|
||||||
|
from numbers import Number
|
||||||
from typing import Union, Type, Iterable, Mapping
|
from typing import Union, Type, Iterable, Mapping
|
||||||
|
|
||||||
import jsonmodels.errors
|
import jsonmodels.errors
|
||||||
@ -96,6 +97,15 @@ class ScalarField(fields.BaseField):
|
|||||||
types = (str, int, float, bool)
|
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):
|
class DictField(fields.BaseField):
|
||||||
types = (dict,)
|
types = (dict,)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from jsonmodels.fields import (
|
|||||||
from jsonmodels import validators
|
from jsonmodels import validators
|
||||||
from jsonmodels.validators import Min
|
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.apimodels import ActualEnumField
|
||||||
from apiserver.config_repo import config
|
from apiserver.config_repo import config
|
||||||
from .workers import MachineStats
|
from .workers import MachineStats
|
||||||
@ -36,7 +36,7 @@ class ServingModel(Base):
|
|||||||
model_version = StringField()
|
model_version = StringField()
|
||||||
preprocess_artifact = StringField()
|
preprocess_artifact = StringField()
|
||||||
input_type = StringField()
|
input_type = StringField()
|
||||||
input_size = IntField()
|
input_size = SafeStringField()
|
||||||
tags = ListField(str)
|
tags = ListField(str)
|
||||||
system_tags = ListField(str)
|
system_tags = ListField(str)
|
||||||
reference: Sequence[ReferenceItem] = ListField(ReferenceItem)
|
reference: Sequence[ReferenceItem] = ListField(ReferenceItem)
|
||||||
|
@ -58,8 +58,8 @@ _definitions {
|
|||||||
description: Input type
|
description: Input type
|
||||||
}
|
}
|
||||||
input_size {
|
input_size {
|
||||||
type: integer
|
type: string
|
||||||
description: Input size in bytes
|
description: Input size
|
||||||
}
|
}
|
||||||
reference: ${_definitions.reference}
|
reference: ${_definitions.reference}
|
||||||
}
|
}
|
||||||
@ -178,8 +178,8 @@ _definitions {
|
|||||||
description: Input type
|
description: Input type
|
||||||
}
|
}
|
||||||
input_size {
|
input_size {
|
||||||
type: integer
|
type: string
|
||||||
description: Input size in bytes
|
description: Input size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user