Skip to content

Commit 98a8bb9

Browse files
authored
Add gemma.css to site notebooks. (#509)
* Add gemma.css to site notebooks. This is fragile, but it's only a temp measure until the CSS is included in the site bundle. * Fix buttons on distributed tuning guide too
1 parent df4921a commit 98a8bb9

17 files changed

+319
-14
lines changed

site/en/gemma/docs/agile_classifiers.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {

site/en/gemma/docs/codegemma/code_assist_keras.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {

site/en/gemma/docs/codegemma/codegemma_flax_inference.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {

site/en/gemma/docs/codegemma/keras_quickstart.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {

site/en/gemma/docs/distributed_tuning.ipynb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {
@@ -42,7 +52,7 @@
4252
" <a target=\"_blank\" href=\"https://ai.google.dev/gemma/docs/distributed_tuning\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on ai.google.dev</a>\n",
4353
" </td>\n",
4454
" <td>\n",
45-
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/googlecolab/colabtools/blob/main/notebooks/Gemma_Distributed_Fine_tuning_on_TPU.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
55+
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/gemma/docs/distributed_tuning.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
4656
" </td>\n",
4757
" <td>\n",
4858
" <a target=\"_blank\" href=\"https://www.kaggle.com/code/nilaychauhan/keras-gemma-distributed-finetuning-and-inference\"><img src=\"https://www.kaggle.com/static/images/logos/kaggle-logo-transparent-300.png\" height=\"32\" width=\"70\"/>Run in Kaggle</a>\n",

site/en/gemma/docs/gemma_chat.ipynb

Lines changed: 128 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"id": "JLOS92ZAhfFj"
6+
"id": "G3MMAcssHTML"
77
},
88
"source": [
9-
"Project: /gemma/_project.yaml\n",
10-
"Book: /gemma/_book.yaml\n",
11-
"\n",
12-
"<link rel=\"stylesheet\" href=\"/site-assets/css/style.css\">\n",
13-
"\n",
14-
"<!-- DO NOT EDIT! Automatically generated file. -->"
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
1511
]
1612
},
1713
{
@@ -569,7 +565,13 @@
569565
"outputs": [
570566
{
571567
"data": {
572-
"text/markdown": "<font size='+1' color='brown'>🙋‍♂️<blockquote>Tell me, in a few words, how to compute all prime numbers up to 1000?</blockquote></font><font size='+1' color='teal'>🤖\n\n> **Sieve of Eratosthenes.** \n> <end_of_turn>\n</font>",
568+
"text/markdown": [
569+
"<font size='+1' color='brown'>🙋‍♂️<blockquote>Tell me, in a few words, how to compute all prime numbers up to 1000?</blockquote></font><font size='+1' color='teal'>🤖\n",
570+
"\n",
571+
"> **Sieve of Eratosthenes.** \n",
572+
"> <end_of_turn>\n",
573+
"</font>"
574+
],
573575
"text/plain": [
574576
"<IPython.core.display.Markdown object>"
575577
]
@@ -603,7 +605,43 @@
603605
"outputs": [
604606
{
605607
"data": {
606-
"text/markdown": "<font size='+1' color='brown'>🙋‍♂️<blockquote>Now in Python! No numpy, please!</blockquote></font><font size='+1' color='teal'>🤖\n\n> ```python\n> def sieve_of_eratosthenes(n):\n> \"\"\"Returns a list of prime numbers up to n.\"\"\"\n> primes = [True] * (n + 1)\n> primes[0] = primes[1] = False\n> for i in range(2, int(n**0.5) + 1):\n> if primes[i]:\n> for j in range(i * i, n + 1, i):\n> primes[j] = False\n> return [i for i, is_prime in enumerate(primes) if is_prime]\n> \n> primes = sieve_of_eratosthenes(1000)\n> print(primes)\n> ```\n> \n> **Explanation:**\n> \n> 1. **Initialization:**\n> - `primes = [True] * (n + 1)`: Creates a list `primes` of boolean values, initially assuming all numbers are prime.\n> - `primes[0] = primes[1] = False`: Sets 0 and 1 as non-prime.\n> \n> 2. **Iteration:**\n> - `for i in range(2, int(n**0.5) + 1):`: Iterates from 2 to the square root of `n`. We only need to check up to the square root because any composite number must have a prime factor less than or equal to its square root.\n> - `if primes[i]:`: If `i` is marked as prime:\n> - `for j in range(i * i, n + 1, i):`: Marks all multiples of `i` as non-prime.\n> \n> 3. **Result:**\n> - `return [i for i, is_prime in enumerate(primes) if is_prime]`: Creates a list of indices where `primes[i]` is True, representing the prime numbers.\n> \n> \n> Let me know if you'd like a more detailed explanation of any part! \n> <end_of_turn>\n</font>",
608+
"text/markdown": [
609+
"<font size='+1' color='brown'>🙋‍♂️<blockquote>Now in Python! No numpy, please!</blockquote></font><font size='+1' color='teal'>🤖\n",
610+
"\n",
611+
"> ```python\n",
612+
"> def sieve_of_eratosthenes(n):\n",
613+
"> \"\"\"Returns a list of prime numbers up to n.\"\"\"\n",
614+
"> primes = [True] * (n + 1)\n",
615+
"> primes[0] = primes[1] = False\n",
616+
"> for i in range(2, int(n**0.5) + 1):\n",
617+
"> if primes[i]:\n",
618+
"> for j in range(i * i, n + 1, i):\n",
619+
"> primes[j] = False\n",
620+
"> return [i for i, is_prime in enumerate(primes) if is_prime]\n",
621+
"> \n",
622+
"> primes = sieve_of_eratosthenes(1000)\n",
623+
"> print(primes)\n",
624+
"> ```\n",
625+
"> \n",
626+
"> **Explanation:**\n",
627+
"> \n",
628+
"> 1. **Initialization:**\n",
629+
"> - `primes = [True] * (n + 1)`: Creates a list `primes` of boolean values, initially assuming all numbers are prime.\n",
630+
"> - `primes[0] = primes[1] = False`: Sets 0 and 1 as non-prime.\n",
631+
"> \n",
632+
"> 2. **Iteration:**\n",
633+
"> - `for i in range(2, int(n**0.5) + 1):`: Iterates from 2 to the square root of `n`. We only need to check up to the square root because any composite number must have a prime factor less than or equal to its square root.\n",
634+
"> - `if primes[i]:`: If `i` is marked as prime:\n",
635+
"> - `for j in range(i * i, n + 1, i):`: Marks all multiples of `i` as non-prime.\n",
636+
"> \n",
637+
"> 3. **Result:**\n",
638+
"> - `return [i for i, is_prime in enumerate(primes) if is_prime]`: Creates a list of indices where `primes[i]` is True, representing the prime numbers.\n",
639+
"> \n",
640+
"> \n",
641+
"> Let me know if you'd like a more detailed explanation of any part! \n",
642+
"> <end_of_turn>\n",
643+
"</font>"
644+
],
607645
"text/plain": [
608646
"<IPython.core.display.Markdown object>"
609647
]
@@ -627,7 +665,45 @@
627665
"outputs": [
628666
{
629667
"data": {
630-
"text/markdown": "<font size='+1' color='brown'>🙋‍♂️<blockquote>Thank you, it works! Can you explain the code in French?</blockquote></font><font size='+1' color='teal'>🤖\n\n> Bien sûr ! Voici une explication du code en français :\n> \n> ```python\n> def sieve_of_eratosthenes(n):\n> \"\"\"Retourne une liste de nombres premiers jusqu'à n.\"\"\"\n> primes = [True] * (n + 1)\n> primes[0] = primes[1] = False\n> for i in range(2, int(n**0.5) + 1):\n> if primes[i]:\n> for j in range(i * i, n + 1, i):\n> primes[j] = False\n> return [i for i, is_prime in enumerate(primes) if is_prime]\n> \n> primes = sieve_of_eratosthenes(1000)\n> print(primes)\n> ```\n> \n> **Explication:**\n> \n> 1. **Initialisation:**\n> - `primes = [True] * (n + 1)`: Crée une liste `primes` de valeurs booléennes, initialement supposant que tous les nombres sont premiers.\n> - `primes[0] = primes[1] = False`: Définit 0 et 1 comme non-premiers.\n> \n> 2. **Itération:**\n> - `for i in range(2, int(n**0.5) + 1):`: Itère de 2 jusqu'à la racine carrée de `n`. Nous ne devons vérifier que jusqu'à la racine carrée car tout nombre composite doit avoir un facteur premier inférieur ou égal à sa racine carrée.\n> - `if primes[i]:`: Si `i` est considéré comme premier:\n> - `for j in range(i * i, n + 1, i):`: Marquer tous les multiples de `i` comme non-premiers.\n> \n> 3. **Resultat:**\n> - `return [i for i, is_prime in enumerate(primes) if is_prime]`: Crée une liste des indices où `primes[i]` est vrai, représentant les nombres premiers.\n> \n> \n> N'hésitez pas à me demander si vous avez besoin d'une explication plus détaillée de quelque chose! \n> <end_of_turn>\n</font>",
668+
"text/markdown": [
669+
"<font size='+1' color='brown'>🙋‍♂️<blockquote>Thank you, it works! Can you explain the code in French?</blockquote></font><font size='+1' color='teal'>🤖\n",
670+
"\n",
671+
"> Bien sûr ! Voici une explication du code en français :\n",
672+
"> \n",
673+
"> ```python\n",
674+
"> def sieve_of_eratosthenes(n):\n",
675+
"> \"\"\"Retourne une liste de nombres premiers jusqu'à n.\"\"\"\n",
676+
"> primes = [True] * (n + 1)\n",
677+
"> primes[0] = primes[1] = False\n",
678+
"> for i in range(2, int(n**0.5) + 1):\n",
679+
"> if primes[i]:\n",
680+
"> for j in range(i * i, n + 1, i):\n",
681+
"> primes[j] = False\n",
682+
"> return [i for i, is_prime in enumerate(primes) if is_prime]\n",
683+
"> \n",
684+
"> primes = sieve_of_eratosthenes(1000)\n",
685+
"> print(primes)\n",
686+
"> ```\n",
687+
"> \n",
688+
"> **Explication:**\n",
689+
"> \n",
690+
"> 1. **Initialisation:**\n",
691+
"> - `primes = [True] * (n + 1)`: Crée une liste `primes` de valeurs booléennes, initialement supposant que tous les nombres sont premiers.\n",
692+
"> - `primes[0] = primes[1] = False`: Définit 0 et 1 comme non-premiers.\n",
693+
"> \n",
694+
"> 2. **Itération:**\n",
695+
"> - `for i in range(2, int(n**0.5) + 1):`: Itère de 2 jusqu'à la racine carrée de `n`. Nous ne devons vérifier que jusqu'à la racine carrée car tout nombre composite doit avoir un facteur premier inférieur ou égal à sa racine carrée.\n",
696+
"> - `if primes[i]:`: Si `i` est considéré comme premier:\n",
697+
"> - `for j in range(i * i, n + 1, i):`: Marquer tous les multiples de `i` comme non-premiers.\n",
698+
"> \n",
699+
"> 3. **Resultat:**\n",
700+
"> - `return [i for i, is_prime in enumerate(primes) if is_prime]`: Crée une liste des indices où `primes[i]` est vrai, représentant les nombres premiers.\n",
701+
"> \n",
702+
"> \n",
703+
"> N'hésitez pas à me demander si vous avez besoin d'une explication plus détaillée de quelque chose! \n",
704+
"> <end_of_turn>\n",
705+
"</font>"
706+
],
631707
"text/plain": [
632708
"<IPython.core.display.Markdown object>"
633709
]
@@ -651,7 +727,48 @@
651727
"outputs": [
652728
{
653729
"data": {
654-
"text/markdown": "<font size='+1' color='brown'>🙋‍♂️<blockquote>Great! Now add those explanations as comments in the code.</blockquote></font><font size='+1' color='teal'>🤖\n\n> ```python\n> def sieve_of_eratosthenes(n):\n> \"\"\"Retourne une liste de nombres premiers jusqu'à n.\"\"\"\n> # Initialise une liste de boolean avec True pour tous les nombres de 0 à n\n> primes = [True] * (n + 1)\n> # Définit 0 et 1 comme non-premiers\n> primes[0] = primes[1] = False\n> # Itère de 2 à la racine carrée de n\n> for i in range(2, int(n**0.5) + 1):\n> # Si i est considéré comme premier\n> if primes[i]:\n> # Itère sur tous les multiples de i\n> for j in range(i * i, n + 1, i):\n> # Définit les multiples de i comme non-premiers\n> primes[j] = False\n> # Retourne la liste des indices des nombres premiers\n> return [i for i, is_prime in enumerate(primes) if is_prime]\n> \n> primes = sieve_of_eratosthenes(1000)\n> print(primes)\n> ```\n> \n> **Explication:**\n> \n> * **Initialisation:**\n> * `primes = [True] * (n + 1)`: Crée une liste `primes` de valeurs booléennes, initialement supposant que tous les nombres sont premiers.\n> * `primes[0] = primes[1] = False`: Définit 0 et 1 comme non-premiers.\n> * **Itération:**\n> * `for i in range(2, int(n**0.5) + 1):`: Itère de 2 jusqu'à la racine carrée de `n`. Nous ne devons vérifier que jusqu'à la racine carrée car tout nombre composite doit avoir un facteur premier inférieur ou égal à sa racine carrée.\n> * `if primes[i]:`: Si `i` est considéré comme premier:\n> * `for j in range(i * i, n + 1, i):`: Marquer tous les multiples de `i` comme non-premiers.\n> * **Resultat:**\n> * `return [i for i, is_prime in enumerate(primes) if is_prime]`: Crée une liste des indices où `primes[i]` est vrai, représentant les nombres premiers. \n> \n> \n> \n> <end_of_turn>\n</font>",
730+
"text/markdown": [
731+
"<font size='+1' color='brown'>🙋‍♂️<blockquote>Great! Now add those explanations as comments in the code.</blockquote></font><font size='+1' color='teal'>🤖\n",
732+
"\n",
733+
"> ```python\n",
734+
"> def sieve_of_eratosthenes(n):\n",
735+
"> \"\"\"Retourne une liste de nombres premiers jusqu'à n.\"\"\"\n",
736+
"> # Initialise une liste de boolean avec True pour tous les nombres de 0 à n\n",
737+
"> primes = [True] * (n + 1)\n",
738+
"> # Définit 0 et 1 comme non-premiers\n",
739+
"> primes[0] = primes[1] = False\n",
740+
"> # Itère de 2 à la racine carrée de n\n",
741+
"> for i in range(2, int(n**0.5) + 1):\n",
742+
"> # Si i est considéré comme premier\n",
743+
"> if primes[i]:\n",
744+
"> # Itère sur tous les multiples de i\n",
745+
"> for j in range(i * i, n + 1, i):\n",
746+
"> # Définit les multiples de i comme non-premiers\n",
747+
"> primes[j] = False\n",
748+
"> # Retourne la liste des indices des nombres premiers\n",
749+
"> return [i for i, is_prime in enumerate(primes) if is_prime]\n",
750+
"> \n",
751+
"> primes = sieve_of_eratosthenes(1000)\n",
752+
"> print(primes)\n",
753+
"> ```\n",
754+
"> \n",
755+
"> **Explication:**\n",
756+
"> \n",
757+
"> * **Initialisation:**\n",
758+
"> * `primes = [True] * (n + 1)`: Crée une liste `primes` de valeurs booléennes, initialement supposant que tous les nombres sont premiers.\n",
759+
"> * `primes[0] = primes[1] = False`: Définit 0 et 1 comme non-premiers.\n",
760+
"> * **Itération:**\n",
761+
"> * `for i in range(2, int(n**0.5) + 1):`: Itère de 2 jusqu'à la racine carrée de `n`. Nous ne devons vérifier que jusqu'à la racine carrée car tout nombre composite doit avoir un facteur premier inférieur ou égal à sa racine carrée.\n",
762+
"> * `if primes[i]:`: Si `i` est considéré comme premier:\n",
763+
"> * `for j in range(i * i, n + 1, i):`: Marquer tous les multiples de `i` comme non-premiers.\n",
764+
"> * **Resultat:**\n",
765+
"> * `return [i for i, is_prime in enumerate(primes) if is_prime]`: Crée une liste des indices où `primes[i]` est vrai, représentant les nombres premiers. \n",
766+
"> \n",
767+
"> \n",
768+
"> \n",
769+
"> <end_of_turn>\n",
770+
"</font>"
771+
],
655772
"text/plain": [
656773
"<IPython.core.display.Markdown object>"
657774
]

site/en/gemma/docs/integrations/langchain.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {

site/en/gemma/docs/jax_finetune.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {

site/en/gemma/docs/jax_inference.ipynb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {
@@ -387,7 +397,8 @@
387397
"name": "stderr",
388398
"output_type": "stream",
389399
"text": [
390-
"\r100%|██████████| 22.5k/22.5k [00:00<00:00, 24.7MB/s]\n",
400+
"\r",
401+
"100%|██████████| 22.5k/22.5k [00:00<00:00, 24.7MB/s]\n",
391402
"\n",
392403
"\n",
393404
" 1%| | 17.0M/1.70G [00:00<00:36, 49.5MB/s]\u001b[A\u001b[A\n",

site/en/gemma/docs/keras_inference.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "G3MMAcssHTML"
7+
},
8+
"source": [
9+
"<link rel=\"stylesheet\" href=\"/site-assets/css/gemma.css\">\n",
10+
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Google+Symbols:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\" />"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {

0 commit comments

Comments
 (0)