convert-hf : fix flake8 warnings in CI
This commit is contained in:
parent
4ffcdce2ff
commit
e24ca9cb02
1 changed files with 5 additions and 1 deletions
|
@ -28,6 +28,9 @@ from convert import HfVocab
|
||||||
|
|
||||||
###### MODEL DEFINITIONS ######
|
###### MODEL DEFINITIONS ######
|
||||||
|
|
||||||
|
AnyModel = TypeVar("AnyModel", bound="type[Model]")
|
||||||
|
|
||||||
|
|
||||||
class SentencePieceTokenTypes(IntEnum):
|
class SentencePieceTokenTypes(IntEnum):
|
||||||
NORMAL = 1
|
NORMAL = 1
|
||||||
UNKNOWN = 2
|
UNKNOWN = 2
|
||||||
|
@ -36,7 +39,6 @@ class SentencePieceTokenTypes(IntEnum):
|
||||||
UNUSED = 5
|
UNUSED = 5
|
||||||
BYTE = 6
|
BYTE = 6
|
||||||
|
|
||||||
AnyModel = TypeVar("AnyModel", bound="type[Model]")
|
|
||||||
|
|
||||||
class Model(ABC):
|
class Model(ABC):
|
||||||
_model_classes: dict[str, type[Model]] = {}
|
_model_classes: dict[str, type[Model]] = {}
|
||||||
|
@ -187,10 +189,12 @@ class Model(ABC):
|
||||||
@classmethod
|
@classmethod
|
||||||
def register(cls, *names: str) -> Callable[[AnyModel], AnyModel]:
|
def register(cls, *names: str) -> Callable[[AnyModel], AnyModel]:
|
||||||
assert names
|
assert names
|
||||||
|
|
||||||
def func(modelcls: type[Model]):
|
def func(modelcls: type[Model]):
|
||||||
for name in names:
|
for name in names:
|
||||||
cls._model_classes[name] = modelcls
|
cls._model_classes[name] = modelcls
|
||||||
return modelcls
|
return modelcls
|
||||||
|
|
||||||
return func
|
return func
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue