models.get_model

The get_model function provides a way to quickly download a prebuilt model for easy testing of leap-ie.

preprocessing_fn, model, class_list = get_model(model_name)

Arguments

  • model_name (str): Name of a Torchvision or Hugging Face model.

    • Required: Yes

    • Default: None

    • Examples:

      • Torchvision:get_model('torchvision.resnet18')

      • Hugging Face: get_model('nateraw/vit-age-classifier')

Returns

  • preprocessing_fn

    • The preprocessing function used on inputs for inference.

  • model

    • The model.

  • class_list

    • List of class names corresponding to the model's output classes.