You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f2e6fae
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: skills/gemma-docs/SKILL.md
+21-8Lines changed: 21 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ This skill guides coding agents and contributors in maintaining and authoring do
57
57
58
58
| Data File | Governs | Generator / Consumer |
59
59
|---|---|---|
60
-
|`data/models.yml`| Model families, parameter sizes, context lengths, memory requirements, framework-specific checkpoint IDs |`scripts/generate_model_names.py` -> `docs/javascripts/model-data.js` and `overrides/partials/model-names.html`|
60
+
|`data/models.yml`| Model families, parameter sizes, context lengths, memory requirements, framework-specific checkpoint IDs |`scripts/generate_model_names.py` -> `docs/javascripts/model-data.js` and `overrides/partials/model-names.html`; `scripts/notebooks.py` -> `docs/notebooks/*.ipynb`|
61
61
|`data/frameworks.yml`| Engine metadata, blurbs, icons, URLs, `tuning_paths`| Rendered by Jinja macros (`{{ engines(...) }}`, `{{ paths(...) }}`) in pages |
62
62
|`data/links.yml`| URLs used on more than one page, model version tags |`scripts/generate_snippets.py` -> `snippets/links.md` (auto-appended to all pages) |
63
63
|`data/glossary.yml`| Acronyms and term definitions |`scripts/generate_snippets.py` -> `snippets/glossary.md` (opt-in via `--8<-- "glossary.md"`) |
@@ -68,6 +68,7 @@ Whenever editing files in `data/`, run:
68
68
uv run --frozen python scripts/generate_model_names.py
69
69
uv run --frozen python scripts/generate_snippets.py
70
70
uv run --frozen python scripts/agent_docs.py
71
+
uv run --frozen python scripts/notebooks.py
71
72
```
72
73
`scripts/lint_docs.py --check generated` will fail if generated files are out of sync with `data/`.
73
74
@@ -83,14 +84,18 @@ Every page must have valid YAML frontmatter matching `scripts/frontmatter_schema
83
84
title: Page Title
84
85
description: Concise 1-2 sentence description for search and previews.
85
86
models: [gemma-4] # Optional: list of relevant model family IDs
86
-
frameworks: [ollama, vllm] # Optional: list of relevant framework IDs
87
+
frameworks: [transformers] # Optional: list of relevant framework IDs
colab: https://colab.research.google.com/github/google-gemma/docs/blob/main/docs/notebooks/tutorial-gemma-4-e2b-it.ipynb # Optional: Colab link
87
90
prerequisites: # Optional: list of prerequisite topics
88
91
- get-started/index.md
89
92
source_url: "https://..."# Mandatory on imported pages; omitted on original pages
90
93
---
91
94
```
92
95
-**Authored keys only**: Do NOT add computed keys (e.g. token counts).
93
96
-**Vocabularies**: Model and framework identifiers must exist in `data/models.yml` and `data/frameworks.yml`.
97
+
-**Modality gating**: Use `requires:` to restrict model selection and notebook export to models supporting that modality (e.g., `audio` excludes 26B/31B).
98
+
-**Colab link**: For swappable tutorials, link to the default model notebook (`-gemma-4-e2b-it.ipynb`). The model switcher updates the link dynamically when readers select other models.
94
99
95
100
### Headings and Anchor Links
96
101
- Use standard markdown headings (`# H1`, `## 1. Step`, `### Substep`).
@@ -101,7 +106,7 @@ source_url: "https://..." # Mandatory on imported pages; omitted on original pa
101
106
To enable interactive model switching in code examples:
102
107
```python { .model-swap }
103
108
# Use default model name in authoring; the JS switcher replaces it dynamically:
104
-
model_id ="google/gemma-4-it"
109
+
model_id ="google/gemma-4-E2B-it"
105
110
```
106
111
107
112
### Shared Links & Citations
@@ -124,16 +129,24 @@ To create or edit a tutorial that exports to a Jupyter notebook:
124
129
from transformers import AutoModelForCausalLM
125
130
```
126
131
````
127
-
2.**Display-Only Code**: Normal fences (without `.notebook-cell`) stay in Markdown and become text cells in notebooks.
128
-
3.**Outputs**: Fences marked `{ .output }` are omitted during notebook export.
129
-
4.**Site-Only Blocks**: Wrap web-only elements (such as interactive widgets or card grids) in skip comments:
132
+
2.**Model-Swappable Cells**: Combine with `{ .model-swap }` to export multi-model notebooks:
133
+
````markdown
134
+
```python { .notebook-cell .model-swap }
135
+
model_id ="google/gemma-4-E2B-it"
136
+
```
137
+
````
138
+
During export, `scripts/notebooks.py` detects swappable engines in marked blocks and candidate models matching any `requires:` frontmatter. For swappable tutorials, it generates model-specific notebooks named `<stem>-gemma-4-<size>-it.ipynb` (e.g., `thinking-gemma-4-e2b-it.ipynb`, `thinking-gemma-4-12b-it.ipynb`). Non-swappable tutorials generate a single `<stem>.ipynb`.
139
+
3.**Display-Only Code**: Normal fences (without `.notebook-cell`) stay in Markdown and become text cells in notebooks.
140
+
4.**Outputs**: Fences marked `{ .output }` are omitted during notebook export.
141
+
5.**Site-Only Blocks**: Wrap web-only elements (such as interactive widgets or card grids) in skip comments:
130
142
```markdown
131
143
<!-- notebook:skip-start -->
132
144
{{ engines(["ollama", "vllm"]) }}
133
145
<!-- notebook:skip-end -->
134
146
```
135
-
5.**Registration**: Register new notebook tutorials in `NOTEBOOKS` in `scripts/notebooks.py`.
136
-
6.**Export**: Run `uv run --frozen python scripts/notebooks.py` to regenerate `docs/notebooks/*.ipynb`.
147
+
6.**Registration**: Register new notebook source tutorials in `SOURCES` in `scripts/notebooks.py`.
148
+
7.**Colab Link**: For swappable tutorials, add the default model notebook's Colab URL to frontmatter (`colab: .../<stem>-gemma-4-e2b-it.ipynb`). The page context switcher dynamically updates the link when readers select a different model.
149
+
8.**Export & Verify**: Run `uv run --frozen python scripts/notebooks.py` to regenerate `docs/notebooks/*.ipynb`, and verify with `uv run --frozen python scripts/notebooks.py --check`.
0 commit comments