From 614c3293f66eb7c497ee106d17ebcaf036ef8342 Mon Sep 17 00:00:00 2001 From: hrehard Date: Sat, 18 Jul 2026 16:05:29 -0700 Subject: [PATCH] fix(examples): add missing json/re imports in DPO notebook pretty_print dpo_trainer_example_notebook_v3_prod defines a pretty_print helper that calls json.dumps() and re.findall(), but the cell imports neither json nor re -- they are only imported in a later cell. So the first pretty_print(training_job) call fails with NameError: name 'json' is not defined. Import json and re at the top of the helper cell so it runs standalone. --- .../dpo_trainer_example_notebook_v3_prod.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/v3-examples/model-customization-examples/dpo_trainer_example_notebook_v3_prod.ipynb b/v3-examples/model-customization-examples/dpo_trainer_example_notebook_v3_prod.ipynb index 6666c75467..1965e37fb2 100644 --- a/v3-examples/model-customization-examples/dpo_trainer_example_notebook_v3_prod.ipynb +++ b/v3-examples/model-customization-examples/dpo_trainer_example_notebook_v3_prod.ipynb @@ -200,6 +200,8 @@ }, "outputs": [], "source": [ + "import json\n", + "import re\n", "from pprint import pprint\n", "from sagemaker.core.utils.utils import Unassigned\n", "\n",