30
30
"""Generic type variable for speculator models"""
31
31
32
32
33
- class SpeculatorConverter (ABC , Generic [ConfigT , ModelT ], RegistryMixin ):
33
+ class SpeculatorConverter (ABC , RegistryMixin , Generic [ConfigT , ModelT ]):
34
34
"""
35
35
Abstract base converter for transforming external checkpoints to Speculators format.
36
36
@@ -55,8 +55,8 @@ class SpeculatorConverter(ABC, Generic[ConfigT, ModelT], RegistryMixin):
55
55
def resolve_converter (
56
56
cls ,
57
57
algorithm : str ,
58
- model : Path | PreTrainedModel | nn .Module ,
59
- config : Path | PretrainedConfig | dict ,
58
+ model : str | Path | PreTrainedModel | nn .Module ,
59
+ config : str | Path | PretrainedConfig | dict ,
60
60
verifier : str | os .PathLike | PreTrainedModel | None = None ,
61
61
** kwargs ,
62
62
) -> type [SpeculatorConverter ]:
@@ -104,8 +104,8 @@ def resolve_converter(
104
104
@abstractmethod
105
105
def is_supported (
106
106
cls ,
107
- model : Path | PreTrainedModel | nn .Module ,
108
- config : Path | PretrainedConfig | dict ,
107
+ model : str | Path | PreTrainedModel | nn .Module ,
108
+ config : str | Path | PretrainedConfig | dict ,
109
109
verifier : str | os .PathLike | PreTrainedModel | None = None ,
110
110
** kwargs ,
111
111
) -> bool :
@@ -122,8 +122,8 @@ def is_supported(
122
122
123
123
def __init__ (
124
124
self ,
125
- model : Path | PreTrainedModel | nn .Module ,
126
- config : Path | PretrainedConfig | dict ,
125
+ model : str | Path | PreTrainedModel | nn .Module ,
126
+ config : str | Path | PretrainedConfig | dict ,
127
127
verifier : str | os .PathLike | PreTrainedModel | None ,
128
128
):
129
129
"""
@@ -135,7 +135,7 @@ def __init__(
135
135
:raises ValueError: If model or config is None or empty
136
136
"""
137
137
138
- if model is None or config is None :
138
+ if model is None or config is None or model == "" or config == "" :
139
139
raise ValueError (
140
140
f"Model and config paths must be provided, got { model } , { config } "
141
141
)
0 commit comments