Collection Class

class modelindex.models.Collection.Collection(name: Optional[str] = None, metadata: Optional[Union[Dict, modelindex.models.Metadata.Metadata, str]] = None, results: Optional[Union[List, modelindex.models.ResultList.ResultList, modelindex.models.Result.Result, Dict, str]] = None, paper: Optional[Union[str, Dict]] = None, code: Optional[str] = None, weights: Optional[str] = None, config: Optional[str] = None, readme: Optional[str] = None, in_collection: Optional[Union[str, List[str]]] = None, image: Optional[str] = None, _filepath: Optional[str] = None, _path_to_readme: Optional[str] = None, **kwargs)[source]

A collection of models with common characteristics.

Parameters
  • name (str) – Name of the model

  • metadata (Metadata, dict, str) – Metadata object, metadata dict or a filepath to the metadata file

  • results (ResultList, Result, list, dict, str) – ResultList, a single Results, a list of result dicts, a single result dict, or a filepath to the result file

  • paper (str, dict) – URL to the paper, or a structured dict with paper metadata (title, url)

  • code (str) – URL to the code snippet

  • weights (str) – URL to the pretrained weights

  • config (str) – URL to the config file

  • readme (str) – path to the README file for the model

  • in_collection (str, List) – name of the collection to which the model belongs to

  • image (str) – path or URL to an image for the model

  • _filepath – The file path to where the data was loaded from

  • _path_to_readme – Path to the markdown readme file if data is coming from there

  • **kwargs – Any other custom fields

static from_file(filepath: Optional[str] = None, parent_filepath: Optional[str] = None)[source]

Load a Collection from a file.

Parameters
  • filepath (str) – File from which to load the collection

  • parent_filepath (str) – Parent filename (if file is imported from another file)