Hugging Face and Kaggle Integration for Model Access

Hugging Face and Kaggle have launched a new integration to improve the discoverability and usability of Hugging Face models for AI developers. This integration allows users to move seamlessly between the two platforms, enabling faster model deployment in Kaggle notebooks and better visibility of community examples.

Seamless Model Deployment and Navigation

Users can now initiate the use of a Hugging Face model within a Kaggle notebook through a direct integration. From a Hugging Face model page, users can click "Use this model" and select "Kaggle" to open a Kaggle notebook with a pre-populated code snippet for loading the model. Conversely, users can click the "Code" button on a Hugging Face model page hosted on Kaggle to achieve the same result.

When a Kaggle notebook referencing a Hugging Face Hub model is executed, the system automatically generates a Hugging Face model page on Kaggle if one does not already exist. If the notebook is made public, it will be automatically listed on the "Code" tab of the Kaggle model page. Users can explore Hugging Face models and associated public notebook examples at https://www.kaggle.com/models.

Handling Private and Consent-Gated Models

The integration maintains existing security and access controls for restricted models:

  • Private Models: To use a private Hugging Face model in a Kaggle notebook, users must authenticate using their Hugging Face account by adding an HF_TOKEN in the "Add-ons > Secrets" menu of the notebook editor. Private models do not trigger the generation of a Kaggle model page.
  • Consent-Gated Models: Access to consent-gated models requires the user to request access via their Hugging Face account and follow the standard prompts on the Hugging Face model page. Once access is granted, the integration functions identically to non-gated models.

Future Integration for Offline Competitions

Hugging Face and Kaggle are developing a solution to allow the seamless use of Hugging Face models in Kaggle competitions that require offline notebook submissions. This feature is expected to be completed in several months.

The development of this specific feature is focused on preventing data leakage and model contamination to preserve the empirical rigor and integrity of AI competitions. This effort aligns with Kaggle's position that AI competitions serve as a gold standard for GenAI evaluation.

Sources