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
When running run_model_on_task(model, ...), it uses registered extensions to decide which one to use. If we are to migrate to having extensions as their own packages, it might be cleaner to just have users pass it in explicitly (after all, they did download it). One possible reasons is two Extensions that work with the same model class. We could still use the register feature, however these global list things can be brittle when it comes to multiprocessing and other shenanigans that aren't beyond the simplest use case.
Another more implicit option to have class "register" is to not even register, and just inherit from it, such that Extension.__subclasses__ can be used. In the odd case a subclass does not want to be registered, they could advertise a registered: ClassVar[bool] = False which is by default false.
classExtension:
registered: ClassVar[bool] =True@classmethoddefregistered_extensions(cls) ->list[Extension]:
return [subclsforsubclsincls.__subclasses__ifsubcls.registered]
# AccessibleclassExtensionA(Extension):
pass# Is intended not to be an extension used but rather inhereited fromclassExtensionOtherBase(Extension):
registered: ClassVar=False# AccessibleclassExtensionB(ExtensionOtherBase):
pass
The text was updated successfully, but these errors were encountered:
Description
When running
run_model_on_task(model, ...)
, it uses registered extensions to decide which one to use. If we are to migrate to having extensions as their own packages, it might be cleaner to just have users pass it in explicitly (after all, they did download it). One possible reasons is twoExtension
s that work with the same model class. We could still use the register feature, however these global list things can be brittle when it comes to multiprocessing and other shenanigans that aren't beyond the simplest use case.Another more implicit option to have class "register" is to not even register, and just inherit from it, such that
Extension.__subclasses__
can be used. In the odd case a subclass does not want to be registered, they could advertise aregistered: ClassVar[bool] = False
which is by default false.The text was updated successfully, but these errors were encountered: