How the check decides
Tasks are grouped into three task families, and each family has its own training images. The task your model file declares in itscategory variable (see Mandatory variables) decides the family. The family decides which packages the model file may import.
- Only the top-level package counts.
import torch.nn as nnandfrom torch.utils.data import DataLoaderare bothtorch. - Your own files are always allowed. In a zipped, multi-file upload, your files may import each other. The rule applies to every other import.
Packages per task family
Every task may also import
collections and math.
Across all tasks, these are the only packages a model file may import at all: catboost, collections, interpret, lifelines, lightgbm, math, peft, pycox, pytorch_forecasting, sklearn, sksurv, timm, torch, torchvision, transformers, xgboost.
When an upload imports something else
-
A package no task may import (for example
tensorflow,requestsoros) is refused whatever the task. -
A package another family allows but yours does not is refused. The message names the task family, the imports its training image does not provide, and every package a model for that task may import. For example, an object detection model that imports scikit-learn is refused with a message that begins:
To fix it, remove the import, or rewrite that part of the model with a package from your task’s list.
-
A
categorythe check does not recognise is not held to any family. The upload is recorded, not refused by this check, but it may still import only the packages allowed across all tasks. - If the check itself cannot run, the upload is refused with “The model’s imports could not be checked against its task family. Please retry the upload; if this persists, contact support.” Nothing is wrong with your model; retry the upload.
The task
tabular_classification was once called generic_classification. A model file that still declares category = "generic_classification" is checked as tabular_classification.