You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to support this through CLI. I have a mapping str -> type[Model], such as the user can pass a string --model_cls=Transformer that I can then normalize to the model class.
Thank you for the answer, unfortunately in my case, neither subgroup nor choices can be used as models can be dynamically registered (user can pass arbitrary modules --cfg.model="module.to.import.MyModel"), so I do not know the exact mapping in advance. The example from my original post was simplified.
I ended up using a hack to trick simple parsing to interpret the field as a str:
@dataclasses.dataclassclassArgs:
iftyping.TYPE_CHECKING: # For static type checkingmodel_cls: type[Model] = ...
else: # For simple parsingmodel_cls: str=Transformer
So I'm fine at the moment. Keeping this bug open in case a cleaner solution is planned but I'll also understand if this bug was closed as there's a workaround.
I have a code like:
I would like to support this through CLI. I have a mapping
str -> type[Model]
, such as the user can pass a string--model_cls=Transformer
that I can then normalize to the model class.Something like:
However I do not know how to make
simple_parsing
parsemodel_cls
as astr
.The text was updated successfully, but these errors were encountered: