{ "cells": [ { "cell_type": "markdown", "id": "book-header", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "Supplementary code for the Build a Large Language Model From Scratch book by Sebastian Raschka
\n", "
Code repository: https://github.com/rasbt/LLMs-from-scratch\n", "
\n", "
\n", "\n", "
" ] }, { "cell_type": "markdown", "id": "title-cell", "metadata": {}, "source": [ "# Gemma 3 270M With Hugging Face Transformers" ] }, { "cell_type": "markdown", "id": "intro-cell", "metadata": {}, "source": [ "- This notebook uses the minimal `AutoTokenizer` / `AutoModelForCausalLM` workflow from the Transformers tutorials.\n", "- It uses the same user prompt as [standalone-gemma3.ipynb](../standalone-gemma3.ipynb): `Give me a short introduction to large language models.`" ] }, { "cell_type": "code", "execution_count": 1, "id": "install-cell", "metadata": {}, "outputs": [], "source": [ "# pip install transformers sentencepiece" ] }, { "cell_type": "code", "execution_count": 2, "id": "login-cell", "metadata": {}, "outputs": [], "source": [ "# Uncomment and run the following code if you are executing the notebook for the first time\n", "\n", "# from huggingface_hub import login\n", "# login()" ] }, { "cell_type": "code", "execution_count": 3, "id": "load-cell", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c3b335b4a1da4658b90e1ef960de8b49", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Loading weights: 0%| | 0/236 [00:00