onnx_diagnostic.torch_models.hghub.hub_api

onnx_diagnostic.torch_models.hghub.hub_api.enumerate_model_list(n: int = 50, task: str | None = None, library: str | None = None, tags: str | List[str] | None = None, search: str | None = None, dump: str | None = None, filter: str | None = None, verbose: int = 0)[source]

Enumerates models coming from huggingface_hub.

Parameters:
  • n – number of models to retrieve (-1 for all)

  • task – see huggingface_hub.HfApi.list_models()

  • tags – see huggingface_hub.HfApi.list_models()

  • library – see huggingface_hub.HfApi.list_models()

  • search – see huggingface_hub.HfApi.list_models()

  • filter – see huggingface_hub.HfApi.list_models()

  • dump – dumps the result in this csv file

  • verbose – show progress

onnx_diagnostic.torch_models.hghub.hub_api.get_model_info(model_id) str[source]

Returns the model info for a model_id.

onnx_diagnostic.torch_models.hghub.hub_api.get_pretrained_config(model_id: str, trust_remote_code: bool = True) str[source]

Returns the config for a model_id.

onnx_diagnostic.torch_models.hghub.hub_api.task_from_arch(arch: str, default_value: str | None = None) str[source]

This function relies on stored information. That information needs to be refresh.

Parameters:
  • arch – architecture name

  • default_value – default value in case the task cannot be determined

Returns:

task

    last refresh 2025-03-26

List of supported architectures, see load_architecture_task.

onnx_diagnostic.torch_models.hghub.hub_api.task_from_id(model_id: str, default_value: str | None = None, pretrained: bool = False, fall_back_to_pretrained: bool = True) str[source]

Returns the task attached to a model id.

Parameters:
  • model_id – model id

  • default_value – if specified, the function returns this value if the task cannot be determined

  • pretrained – uses the config

  • fall_back_to_pretrained – balls back to pretrained config

Returns:

task

onnx_diagnostic.torch_models.hghub.hub_api.task_from_tags(tags: str | List[str]) str[source]

Guesses the task from the list of tags. If given by a string, | should be the separator.