helios.model.utils ================== .. py:module:: helios.model.utils Attributes ---------- .. autoapisummary:: helios.model.utils.MODEL_REGISTRY Functions --------- .. autoapisummary:: helios.model.utils.create_model helios.model.utils.find_pretrained_file Module Contents --------------- .. py:data:: MODEL_REGISTRY Global instance of the registry for models. .. rubric:: Example .. code-block:: python import helios.model as hlm # This automatically registers your model. @hlm.MODEL_REGISTRY.register class MyModel: ... # Alternatively you can manually register a model like this: hlm.MODEL_REGISTRY.register(MyModel) .. py:function:: create_model(type_name: str, *args: Any, **kwargs: Any) -> helios.model.model.Model Create the model for the given type. :param type_name: the type of the model to create. :param args: positional arguments to pass into the model. :param kwargs: keyword arguments to pass into the model. :returns: The model. .. py:function:: find_pretrained_file(root: pathlib.Path, name: str) -> pathlib.Path Find the pre-trained file in the given root. The assumption is the following: Given a root ``/models/cifar`` and a name ``resnet-50``, then the name of the pre-trained file will contain ``cifar_resnet-50_`` as a prefix. If no file is found, an exception is raised. :param root: the root where the file is stored. :param net_name: the save name of the file. :returns: The path to the file. :raises RuntimeError: if no pre-trained network was found.