Skip to content

Commit 571d9ed

Browse files
Merge pull request AI-Hypercomputer#4154 from AI-Hypercomputer:multimodal_notebook
PiperOrigin-RevId: 938717576
2 parents 9b0c52a + 7eba4d3 commit 571d9ed

8 files changed

Lines changed: 381 additions & 259 deletions

File tree

.github/workflows/run_jupyter_notebooks.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,9 @@ jobs:
109109
# Run Hugging Face authentication
110110
hf auth login --token "$HF_TOKEN"
111111
112-
for notebook in "$MAXTEXT_NOTEBOOKS_ROOT"/{sft,rl,lora}*.ipynb; do
112+
for notebook in "$MAXTEXT_NOTEBOOKS_ROOT"/*.ipynb; do
113113
filename=$(basename "$notebook")
114-
# TODO: Update runnner to v6e-8 as RL with LLama3.1-8b doesn't fit on v6e-4
115-
if [[ "$filename" == "sft_llama3_demo_gpu.ipynb" || "$filename" == "maxtext_with_gepa.ipynb" ]]; then
114+
if [[ "$filename" == "sft_llama3_demo_gpu.ipynb" || "$filename" == "maxtext_with_gepa.ipynb" || "$filename" == "demo_decoding.ipynb" ]]; then
116115
echo "Skipping $filename"
117116
continue
118117
fi
@@ -123,6 +122,11 @@ jobs:
123122
echo "------------------------------------------------------"
124123
125124
$PAPERMILL_EXE "$notebook" "$output_name" -k maxtext_venv
125+
126+
# Clean up any checkpoint directories created by the notebook to avoid filling up disk space
127+
echo "Post-notebook disk cleanup for $filename ..."
128+
rm -rf "$MAXTEXT_PKG_DIR"/*_output
129+
rm -rf "$HOME/.cache/huggingface/hub"
126130
done
127131
- name: Upload Outputs
128132
if: always()

docs/tutorials/posttraining/multimodal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document provides a guide to use the multimodal functionalities in MaxText
66
- **Multimodal Decode**: Inference with text+images as input.
77
- **Supervised Fine-Tuning (SFT)**: Apply SFT to the model using a visual-question-answering dataset.
88

9-
We also provide a [colab](https://github.com/AI-Hypercomputer/maxtext/blob/main/src/maxtext/examples/multimodal_gemma3_demo.ipynb) for multimodal features demonstration. The following table provides a list of models and modalities we currently support:
9+
We also provide a [colab](https://github.com/AI-Hypercomputer/maxtext/blob/main/src/maxtext/examples/sft_multimodal_gemma3_demo.ipynb) for multimodal features demonstration. The following table provides a list of models and modalities we currently support:
1010

1111
| Models | Input: Text | Input: Image | Input: Video | Input: Audio | Output |
1212
| :-------------------------- | :---------: | :----------: | :----------: | :----------: | :----: |

src/maxtext/examples/lora_llama3_demo.ipynb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,6 @@
215215
"outputs": [],
216216
"source": [
217217
"if not epath.Path(MODEL_CHECKPOINT_PATH).exists():\n",
218-
" # Install torch for the conversion script\n",
219-
" print(\"Installing torch...\")\n",
220-
" subprocess.run(\n",
221-
" [\n",
222-
" sys.executable, \"-m\", \"pip\", \"install\",\n",
223-
" \"torch\", \"--index-url\", \"https://download.pytorch.org/whl/cpu\"\n",
224-
" ],\n",
225-
" check=True\n",
226-
" )\n",
227-
"\n",
228218
" print(\"Converting checkpoint from HuggingFace...\")\n",
229219
" env = os.environ.copy()\n",
230220
" env[\"JAX_PLATFORMS\"] = \"cpu\"\n",
@@ -607,4 +597,4 @@
607597
},
608598
"nbformat": 4,
609599
"nbformat_minor": 5
610-
}
600+
}

src/maxtext/examples/multimodal_gemma3_demo.ipynb

Lines changed: 0 additions & 211 deletions
This file was deleted.

src/maxtext/examples/rl_llama3_demo.ipynb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,6 @@
193193
"outputs": [],
194194
"source": [
195195
"if not epath.Path(MODEL_CHECKPOINT_PATH).exists():\n",
196-
" # Install torch for the conversion script\n",
197-
" print(\"Installing torch...\")\n",
198-
" subprocess.run(\n",
199-
" [\n",
200-
" sys.executable, \"-m\", \"pip\", \"install\",\n",
201-
" \"torch\", \"--index-url\", \"https://download.pytorch.org/whl/cpu\"\n",
202-
" ],\n",
203-
" check=True\n",
204-
" )\n",
205-
"\n",
206-
" # Run checkpoint conversion with environment variables\n",
207196
" print(\"Converting checkpoint from HuggingFace...\")\n",
208197
" env = os.environ.copy()\n",
209198
" env[\"JAX_PLATFORMS\"] = \"cpu\"\n",
@@ -222,7 +211,7 @@
222211
" check=True,\n",
223212
" env=env\n",
224213
" )\n",
225-
" \n",
214+
"\n",
226215
" MODEL_CHECKPOINT_PATH = os.path.join(MODEL_CHECKPOINT_PATH, \"0/items\")\n",
227216
"else:\n",
228217
" print(f\"Model checkpoint exists at {MODEL_CHECKPOINT_PATH}\")"

src/maxtext/examples/sft_llama3_demo_tpu.ipynb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,6 @@
206206
"outputs": [],
207207
"source": [
208208
"if not epath.Path(MODEL_CHECKPOINT_PATH).exists():\n",
209-
" # Install torch for the conversion script\n",
210-
" print(\"Installing torch...\")\n",
211-
" subprocess.run(\n",
212-
" [\n",
213-
" sys.executable, \"-m\", \"pip\", \"install\",\n",
214-
" \"torch\", \"--index-url\", \"https://download.pytorch.org/whl/cpu\"\n",
215-
" ],\n",
216-
" check=True\n",
217-
" )\n",
218-
"\n",
219-
" # Run checkpoint conversion with environment variables\n",
220209
" print(\"Converting checkpoint from HuggingFace...\")\n",
221210
" env = os.environ.copy()\n",
222211
" env[\"JAX_PLATFORMS\"] = \"cpu\"\n",

0 commit comments

Comments
 (0)