Skip to content

Commit c5e605e

Browse files
committed
Add separate Gemma 4 README section above Gemma
Gemma 4 notebooks were grouped under the Gemma section together with Gemma 3, Gemma 2, FunctionGemma, EmbeddingGemma and CodeGemma. Split them out into their own "### Gemma 4 Notebooks" section so the newer family is visually separated from the legacy Gemma models. Two changes: 1. ARCHITECTURE_MAPPING gains a "gemma4" -> "Gemma 4" entry. Because _get_arch in extract_model_info_refined sorts mapping keys by length descending, "gemma4" (6 chars) is tried before "gemma" (5 chars). The word-boundary regex \\bgemma4\\b matches the word in "Gemma4 (E4B)" / "Gemma4 (E2B)" / "Gemma4 (31B)" / "Gemma4 (26B A4B)" but does NOT match Gemma3, Gemma3N, Gemma2, FunctionGemma, EmbeddingGemma or CodeGemma -- so only Gemma 4 notebooks move into the new section, and everything else stays in the existing Gemma section. 2. update_readme reorders list_models so "Gemma 4" appears immediately before "Gemma". Default alphabetical sort would have placed it after Gemma (because "Gemma" is a prefix of "Gemma 4"), but the user wants the newer family on top. Surgical reorder via list.remove + list.insert at the index of "Gemma". Result: README now has ### Gemma 4 Notebooks <- 10 rows (E4B / E2B / 31B / 26B A4B x Vision / Conversational / Audio) ### Gemma Notebooks <- 17 rows (Gemma3N, Gemma3, Gemma2, FunctionGemma, EmbeddingGemma, CodeGemma)
1 parent 56006a9 commit c5e605e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Below are Colab notebooks, organized by model. You can also view all [notebooks
155155
| **(DGX Spark) gpt oss** **(20B)** | GRPO 2048 | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/gpt_oss_(20B)_Reinforcement_Learning_2048_Game_DGX_Spark.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
156156
| **(A100) gpt oss** **(120B)** | Fine Tuning | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/gpt-oss-(120B)_A100-Fine-tuning.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
157157

158-
### Gemma Notebooks
158+
### Gemma 4 Notebooks
159159
| Model | Type | Notebook Link |
160160
| --- | --- | --- |
161161
| **Gemma4** **(E4B)** | Vision | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma4_(E4B)-Vision.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
@@ -168,6 +168,10 @@ Below are Colab notebooks, organized by model. You can also view all [notebooks
168168
| **Gemma4** **(31B)** | Conversational | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma4_(31B)-Text.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
169169
| **Gemma4** **(26B A4B)** | Vision | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma4_(26B_A4B)-Vision.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
170170
| **Gemma4** **(26B A4B)** | Conversational | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma4_(26B_A4B)-Text.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
171+
172+
### Gemma Notebooks
173+
| Model | Type | Notebook Link |
174+
| --- | --- | --- |
171175
| **Gemma3N** **(4B)** | Vision | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3N_(4B)-Vision.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
172176
| **Gemma3N** **(4B)** | Multimodal | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3N_(4B)-Conversational.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |
173177
| **Gemma3N** **(4B)** | Audio | <a href="https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3N_(4B)-Audio.ipynb" target="_blank" rel="noopener noreferrer"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> |

update_all_notebooks.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,11 @@ def _replace(m):
805805

806806
ARCHITECTURE_MAPPING = {
807807
# Gemma Family
808+
# NOTE: "gemma4" must appear before "gemma" so that the longest-key-first
809+
# match in extract_model_info_refined routes Gemma 4 notebooks to their
810+
# own section. Other Gemma* notebooks (Gemma3, Gemma3N, Gemma2,
811+
# FunctionGemma, EmbeddingGemma, CodeGemma) still resolve to "Gemma".
812+
"gemma4": "Gemma 4",
808813
"gemma": "Gemma",
809814
"codegemma": "Gemma", # Explicitly map specific models if needed
810815

@@ -2950,6 +2955,13 @@ def update_readme(
29502955
if arch not in list_models:
29512956
list_models.append(arch)
29522957

2958+
# Place "Gemma 4" immediately before "Gemma" so the newer family appears
2959+
# above its predecessor instead of after it (default alphabetical sort
2960+
# would order "Gemma" before "Gemma 4" because "Gemma" is a prefix).
2961+
if "Gemma 4" in list_models and "Gemma" in list_models:
2962+
list_models.remove("Gemma 4")
2963+
list_models.insert(list_models.index("Gemma"), "Gemma 4")
2964+
29532965
# Cross-cutting sections (notebooks can appear in multiple sections)
29542966
for cross_section in ["Vision (Multimodal)", "Embedding", "OCR"]:
29552967
if cross_section not in list_models:

0 commit comments

Comments
 (0)