medkit.tools.hf_utils#

This module needs extra-dependencies not installed as core dependencies of medkit. To install them, use pip install medkit-lib[hf-utils].

Functions:

check_model_for_task_HF(model, task[, ...])

Check compatibility of a model with a task HuggingFace.

check_model_for_task_HF(model, task, hf_auth_token=None)[source]#

Check compatibility of a model with a task HuggingFace. The model could be in the HuggingFace hub or in local files.

Parameters
  • model (Union[str, Path]) – Name (on the HuggingFace models hub) or path of the model.

  • task (str) – A string representing the HF task to check i.e : ‘token-classification’

  • hf_auth_token (Optional[str]) – HuggingFace Authentication token (to access private models on the hub)

Return type

bool

Returns

bool – Model compatibility with the task