Kaggle Models Intermediate

The Kaggle Models hub provides a curated collection of pre-trained models that you can use directly in your notebooks. Browse models from Google, Meta, Hugging Face, and the community.

Kaggle Models Hub

Visit kaggle.com/models to browse available models. The hub organizes models by:

  • Framework: TensorFlow, PyTorch, JAX, Keras, ONNX
  • Task: Image classification, text generation, object detection, NLP, etc.
  • Publisher: Google, Meta, Hugging Face, community contributors
  • Size: From small models suitable for free GPUs to large foundation models

Pre-trained Models Available

Kaggle hosts models across many categories:

  • NLP: BERT, GPT-2, T5, Gemma, LLaMA, Mistral, Phi
  • Computer Vision: ResNet, EfficientNet, ViT, YOLO, SAM
  • Generative: Stable Diffusion, DALL-E, Whisper
  • Multimodal: CLIP, LLaVA, Gemma with vision
  • Audio: Whisper, Wav2Vec, HuBERT

Using Models in Notebooks

Add a pre-trained model to your Kaggle notebook:

  1. Click + Add Input in your notebook
  2. Switch to the Models tab
  3. Search for the model you need
  4. Select the framework and variation
  5. The model files are available at /kaggle/input/
# Example: Load a pre-trained model from Kaggle Models
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Model attached via Kaggle UI is at /kaggle/input/
model_path = '/kaggle/input/gemma/pytorch/2b-it/1'

tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
    model_path,
    torch_dtype=torch.float16,
    device_map='auto'
)

# Generate text
inputs = tokenizer("What is machine learning?", return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Hugging Face Integration

Kaggle Models integrates with Hugging Face, making thousands of models accessible:

# Use Hugging Face models directly in Kaggle
from transformers import pipeline

# Sentiment analysis
classifier = pipeline("sentiment-analysis")
result = classifier("Kaggle is an amazing platform for learning data science!")
print(result)

# Text generation
generator = pipeline("text-generation", model="gpt2")
text = generator("The future of AI is", max_length=50)
print(text)

# Image classification
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
model = AutoModelForImageClassification.from_pretrained("google/vit-base-patch16-224")

Model Versioning

  • Models on Kaggle support versioning (v1, v2, v3...)
  • Each version includes model weights, configuration, and metadata
  • You can pin a specific version in your notebook for reproducibility
  • Model publishers can update with new versions while keeping old ones available

Publishing Your Own Models

  1. Train Your Model

    Train and validate your model in a Kaggle notebook or locally.

  2. Save Model Files

    Save weights, config, tokenizer, and any other required files.

  3. Create Model on Kaggle

    Go to Models → New Model. Upload your files and add documentation.

  4. Add Metadata

    Specify the framework, task type, license, and a model card with usage instructions.

  5. Publish

    Set visibility to public and share with the community.

Popular Models

ModelPublisherTaskFrameworks
GemmaGoogleText GenerationPyTorch, Keras, JAX
LLaMA 3MetaText GenerationPyTorch
MistralMistral AIText GenerationPyTorch
BERTGoogleNLP / ClassificationTensorFlow, PyTorch
EfficientNetGoogleImage ClassificationTensorFlow, PyTorch
WhisperOpenAISpeech-to-TextPyTorch
Stable DiffusionStability AIImage GenerationPyTorch
ViTGoogleImage ClassificationPyTorch, JAX
Tip: Using models from Kaggle Models (attached via + Add Input) is faster than downloading from Hugging Face because the model files are already on Kaggle's servers. This saves time and does not require internet access in your notebook.

Ready to Go Deeper?

Live instructor-led courses from our partners. Affiliate disclosure.