Skip to content

Commit 4b2cbf8

Browse files
8bitmp3markmcd
andauthored
Minor tweaks to JAX Gemma docs (google#290)
* Minor tweaks to JAX Gemma docs * Run nbfmt --------- Co-authored-by: Mark McDonald <[email protected]>
1 parent c908a50 commit 4b2cbf8

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

site/en/gemma/docs/jax_finetune.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"\n",
103103
"After you've completed the Gemma setup, move on to the next section, where you'll set environment variables for your Colab environment.\n",
104104
"\n",
105-
"### Set environment variables\n",
105+
"### 2. Set environment variables\n",
106106
"\n",
107107
"Set environment variables for `KAGGLE_USERNAME` and `KAGGLE_KEY`. When prompted with the \"Grant access?\" messages, agree to provide secret access."
108108
]
@@ -128,7 +128,7 @@
128128
"id": "m1UE1CEnE9ql"
129129
},
130130
"source": [
131-
"### 2. Install the `gemma` library\n",
131+
"### 3. Install the `gemma` library\n",
132132
"\n",
133133
"Free Colab hardware acceleration is currently *insufficient* to run this notebook. If you are using [Colab Pay As You Go or Colab Pro](https://colab.research.google.com/signup), click on **Edit** > **Notebook settings** > Select **A100 GPU** > **Save** to enable hardware acceleration.\n",
134134
"\n",
@@ -170,7 +170,7 @@
170170
"id": "-mRkkT-iPYoq"
171171
},
172172
"source": [
173-
"### 3. Import libraries\n",
173+
"### 4. Import libraries\n",
174174
"\n",
175175
"This notebook uses [Flax](https://flax.readthedocs.io) (for neural networks), core [JAX](https://jax.readthedocs.io), [SentencePiece](https://github.com/google/sentencepiece) (for tokenization), [Chex](https://chex.readthedocs.io/en/latest/) (a library of utilities for writing reliable JAX code), and TensorFlow Datasets."
176176
]
@@ -912,9 +912,9 @@
912912
"source": [
913913
"## Configure the model\n",
914914
"\n",
915-
"Before you begin fine-tuning the Gemma model, configure it as follows:\n",
915+
"Before you begin fine-tuning the Gemma model, you need to configure it.\n",
916916
"\n",
917-
"Load and format the Gemma model checkpoint with the [`gemma.params`](https://github.com/google-deepmind/gemma/blob/main/gemma/params.py) method:"
917+
"First, load and format the Gemma model checkpoint with the [`gemma.params.load_and_format_params`](https://github.com/google-deepmind/gemma/blob/c6bd156c246530e1620a7c62de98542a377e3934/gemma/params.py#L27) method:"
918918
]
919919
},
920920
{
@@ -934,7 +934,7 @@
934934
"id": "BtJhJkkZzsy1"
935935
},
936936
"source": [
937-
"To automatically load the correct configuration from the Gemma model checkpoint, use [`gemma.transformer.TransformerConfig`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L65). The `cache_size` argument is the number of time steps in the Gemma `transformer` cache. Afterwards, instantiate the Gemma model as `transformer` with [`gemma.transformer.Transformer`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L136) (which inherits from [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html).\n",
937+
"To automatically load the correct configuration from the Gemma model checkpoint, use [`gemma.transformer.TransformerConfig`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L65). The `cache_size` argument is the number of time steps in the Gemma `Transformer` cache. Afterwards, instantiate the Gemma model as `model_2b` with [`gemma.transformer.Transformer`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L136) (which inherits from [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html)).\n",
938938
"\n",
939939
"**Note:** The vocabulary size is smaller than the number of input embeddings because of unused tokens in the current Gemma release."
940940
]
@@ -1375,7 +1375,7 @@
13751375
"source": [
13761376
"## Learn more\n",
13771377
"\n",
1378-
"- You can learn more about the Google DeepMind [`gemma` library on GitHub](https://github.com/google-deepmind/gemma), which contains docstrings of methods you used in this tutorial, such as [`gemma.params`](https://github.com/google-deepmind/gemma/blob/main/gemma/params.py),\n",
1378+
"- You can learn more about the Google DeepMind [`gemma` library on GitHub](https://github.com/google-deepmind/gemma), which contains docstrings of modules you used in this tutorial, such as [`gemma.params`](https://github.com/google-deepmind/gemma/blob/main/gemma/params.py),\n",
13791379
"[`gemma.transformer`](https://github.com/google-deepmind/gemma/blob/main/gemma/transformer.py), and\n",
13801380
"[`gemma.sampler`](https://github.com/google-deepmind/gemma/blob/main/gemma/sampler.py).\n",
13811381
"- The following libraries have their own documentation sites: [core JAX](https://jax.readthedocs.io), [Flax](https://flax.readthedocs.io), [Chex](https://chex.readthedocs.io/en/latest/), [Optax](https://optax.readthedocs.io/en/latest/), and [Orbax](https://orbax.readthedocs.io/).\n",

site/en/gemma/docs/jax_inference.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"\n",
101101
"After you've completed the Gemma setup, move on to the next section, where you'll set environment variables for your Colab environment.\n",
102102
"\n",
103-
"### Set environment variables\n",
103+
"### 2. Set environment variables\n",
104104
"\n",
105105
"Set environment variables for `KAGGLE_USERNAME` and `KAGGLE_KEY`. When prompted with the \"Grant access?\" messages, agree to provide secret access."
106106
]
@@ -126,7 +126,7 @@
126126
"id": "AO7a1Q4Yyc9Z"
127127
},
128128
"source": [
129-
"### 2. Install the `gemma` library\n",
129+
"### 3. Install the `gemma` library\n",
130130
"\n",
131131
"This notebook focuses on using a free Colab GPU. To enable hardware acceleration, click on **Edit** > **Notebook settings** > Select **T4 GPU** > **Save**.\n",
132132
"\n",
@@ -291,7 +291,7 @@
291291
"id": "aEe3p8geqekV"
292292
},
293293
"source": [
294-
"1. Load and format the Gemma model checkpoint with the [`gemma.params`](https://github.com/google-deepmind/gemma/blob/main/gemma/params.py) method:"
294+
"1. Load and format the Gemma model checkpoint with the [`gemma.params.load_and_format_params`](https://github.com/google-deepmind/gemma/blob/c6bd156c246530e1620a7c62de98542a377e3934/gemma/params.py#L27) method:"
295295
]
296296
},
297297
{
@@ -347,7 +347,7 @@
347347
"id": "IkAf4fkNrY-3"
348348
},
349349
"source": [
350-
"3. To automatically load the correct configuration from the Gemma model checkpoint, use [`gemma.transformer.TransformerConfig`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L65). The `cache_size` argument is the number of time steps in the Gemma `transformer` cache. Afterwards, instantiate the Gemma model as `transformer` with [`gemma.transformer.Transformer`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L136) (which inherits from [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html)).\n",
350+
"3. To automatically load the correct configuration from the Gemma model checkpoint, use [`gemma.transformer.TransformerConfig`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L65). The `cache_size` argument is the number of time steps in the Gemma `Transformer` cache. Afterwards, instantiate the Gemma model as `transformer` with [`gemma.transformer.Transformer`](https://github.com/google-deepmind/gemma/blob/56e501ce147af4ea5c23cc0ddf5a9c4a6b7bd0d0/gemma/transformer.py#L136) (which inherits from [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html)).\n",
351351
"\n",
352352
"**Note:** The vocabulary size is smaller than the number of input embeddings because of unused tokens in the current Gemma release."
353353
]
@@ -452,7 +452,7 @@
452452
"id": "njxRJy3qsBWw"
453453
},
454454
"source": [
455-
"5. (Option) Run this cell to free up memory if you have completed the notebook and want to try another prompt. Afterwards, you can instantiate the `sampler` again in step 3 and customize and run the prompt in step 4."
455+
"5. (Optional) Run this cell to free up memory if you have completed the notebook and want to try another prompt. Afterwards, you can instantiate the `sampler` again in step 3 and customize and run the prompt in step 4."
456456
]
457457
},
458458
{
@@ -474,7 +474,7 @@
474474
"source": [
475475
"## Learn more\n",
476476
"\n",
477-
"- You can learn more about the Google DeepMind [`gemma` library on GitHub](https://github.com/google-deepmind/gemma), which contains docstrings of methods you used in this tutorial, such as [`gemma.params`](https://github.com/google-deepmind/gemma/blob/main/gemma/params.py),\n",
477+
"- You can learn more about the Google DeepMind [`gemma` library on GitHub](https://github.com/google-deepmind/gemma), which contains docstrings of modules you used in this tutorial, such as [`gemma.params`](https://github.com/google-deepmind/gemma/blob/main/gemma/params.py),\n",
478478
"[`gemma.transformer`](https://github.com/google-deepmind/gemma/blob/main/gemma/transformer.py), and\n",
479479
"[`gemma.sampler`](https://github.com/google-deepmind/gemma/blob/main/gemma/sampler.py).\n",
480480
"- The following libraries have their own documentation sites: [core JAX](https://jax.readthedocs.io), [Flax](https://flax.readthedocs.io), and [Orbax](https://orbax.readthedocs.io/).\n",

0 commit comments

Comments
 (0)