asteroid.models.publisher module¶
-
asteroid.models.publisher.
display_one_level_dict
(dic)[source]¶ Single level dict to HTML :param dic: :type dic: dict
Returns: str for HTML-encoded single level dic
-
asteroid.models.publisher.
make_license_notice
(model_name, licenses, uploader=None)[source]¶ Make license notice based on license dicts.
Parameters: Returns: - str, the license note describing the model, it’s attribution,
the original licenses, what we license it under and the licensor.
-
asteroid.models.publisher.
make_metadata_from_model
(model)[source]¶ Create Zenodo deposit metadata for a given publishable model. :param model: Dictionary with all infos needed to publish.
More info to come.Returns: dict, the metadata to create the Zenodo deposit with.
-
asteroid.models.publisher.
save_publishable
(publish_dir, model_dict, metrics=None, train_conf=None, recipe=None)[source]¶ Save models to prepare for publication / model sharing.
Parameters: - publish_dir (str) – Path to the publishing directory. Usually under exp/exp_name/publish_dir
- model_dict (dict) – dict at least with keys model_args, state_dict,`dataset` or licenses
- metrics (dict) – dict with evaluation metrics.
- train_conf (dict) – Training configuration dict (from conf.yml).
- recipe (str) – Name of the recipe.
Returns: dict, same as model_dict with added fields.
Raises: AssertionError when either `model_args`, `state_dict`,`dataset` or – licenses are not present is model_dict.keys()
-
asteroid.models.publisher.
two_level_dict_html
(dic)[source]¶ Two-level dict to HTML. :param dic: two-level dict :type dic: dict
Returns: str for HTML-encoded two level dic
-
asteroid.models.publisher.
upload_publishable
(publish_dir, uploader=None, affiliation=None, git_username=None, token=None, force_publish=False, use_sandbox=False, unit_test=False)[source]¶ Entry point to upload publishable model.
Parameters: - publish_dir (str) – Path to the publishing directory. Usually under exp/exp_name/publish_dir
- uploader (str) – Full name of the uploader (Ex: Manuel Pariente)
- affiliation (str, optional) – Affiliation (no accent).
- git_username (str, optional) – GitHub username.
- token (str) – Access token generated to upload depositions.
- force_publish (bool) – Whether to directly publish without asking confirmation before. Defaults to False.
- use_sandbox (bool) – Whether to use Zenodo’s sandbox instead of the official Zenodo.
- unit_test (bool) – If True, we do not ask user input and do not publish.