From 6885558f997f0b300471a2ba947b4e658a8f00ba Mon Sep 17 00:00:00 2001 From: Vaibhavs10 Date: Mon, 9 Jun 2025 10:46:36 +0200 Subject: [PATCH 1/2] Update notebooks doc w/ Kaggle and Colab usage. --- docs/hub/notebooks.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/hub/notebooks.md b/docs/hub/notebooks.md index 4f68017698..960633b293 100644 --- a/docs/hub/notebooks.md +++ b/docs/hub/notebooks.md @@ -2,6 +2,26 @@ [Jupyter notebooks](https://jupyter.org/) are a very popular format for sharing code and data analysis for machine learning and data science. They are interactive documents that can contain code, visualizations, and text. +## Directly open models in Google Colab and Kaggle + +When you visit a model page on the Hugging Face Hub, you’ll see a new “Google Colab”/ "Kaggle" button in the “Use this model” drop down. Clicking this will generate a ready-to-run notebook with basic code to load and test the model. This is perfect for quick prototyping, inference testing, or fine-tuning experiments — all without leaving your browser. + +![Google Colab and Kaggle option for models on the Hub](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/hf-google-colab/gemma3-4b-it-dark.png) + +Users can also access a ready-to-run notebook by appending /colab to the model card’s URL. As an example, for the latest Gemma 3 4B IT model, the corresponding Colab notebook can be reached by taking the model card URL: +https://huggingface.co/google/gemma-3-4b-it + +And then appending `/colab` to it: +https://huggingface.co/google/gemma-3-4b-it/colab + +and similarly for kaggle: +https://huggingface.co/google/gemma-3-4b-it/kaggle + + +If a model repository includes a file called `notebook.ipynb`, Hub will prioritize that over the auto-generated notebook content. Model authors can provide tailored examples, detailed walkthroughs, or advanced use cases while still benefiting from one-click Colab integration. [NousResearch/Genstruct-7B](https://huggingface.co/NousResearch/Genstruct-7B) is one such example. + +![](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/hf-google-colab/genstruct-notebook-dark.png) + ## Rendering Jupyter notebooks on the Hub Under the hood, Jupyter Notebook files (usually shared with a `.ipynb` extension) are JSON files. While viewing these files directly is possible, it's not a format intended to be read by humans. The Hub has rendering support for notebooks hosted on the Hub. This means that notebooks are displayed in a human-readable format. From 3b99819a2a698baa28e761eea20235ae1f2c045d Mon Sep 17 00:00:00 2001 From: vb Date: Mon, 9 Jun 2025 21:36:45 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Pedro Cuenca --- docs/hub/notebooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/hub/notebooks.md b/docs/hub/notebooks.md index 960633b293..5f4dbe064d 100644 --- a/docs/hub/notebooks.md +++ b/docs/hub/notebooks.md @@ -2,7 +2,7 @@ [Jupyter notebooks](https://jupyter.org/) are a very popular format for sharing code and data analysis for machine learning and data science. They are interactive documents that can contain code, visualizations, and text. -## Directly open models in Google Colab and Kaggle +## Open models in Google Colab and Kaggle When you visit a model page on the Hugging Face Hub, you’ll see a new “Google Colab”/ "Kaggle" button in the “Use this model” drop down. Clicking this will generate a ready-to-run notebook with basic code to load and test the model. This is perfect for quick prototyping, inference testing, or fine-tuning experiments — all without leaving your browser. @@ -18,7 +18,7 @@ and similarly for kaggle: https://huggingface.co/google/gemma-3-4b-it/kaggle -If a model repository includes a file called `notebook.ipynb`, Hub will prioritize that over the auto-generated notebook content. Model authors can provide tailored examples, detailed walkthroughs, or advanced use cases while still benefiting from one-click Colab integration. [NousResearch/Genstruct-7B](https://huggingface.co/NousResearch/Genstruct-7B) is one such example. +If a model repository includes a file called `notebook.ipynb`, we will use it for Colab and Kaggle instead of the auto-generated notebook content. Model authors can provide tailored examples, detailed walkthroughs, or advanced use cases while still benefiting from one-click Colab integration. [NousResearch/Genstruct-7B](https://huggingface.co/NousResearch/Genstruct-7B) is one such example. ![](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/hf-google-colab/genstruct-notebook-dark.png)