Skip to content

fix(examples): add missing json/re imports in DPO notebook pretty_print#6058

Merged
aviruthen merged 1 commit into
aws:masterfrom
Hannah14295:fix/dpo-trainer-missing-json-re-imports
Jul 20, 2026
Merged

fix(examples): add missing json/re imports in DPO notebook pretty_print#6058
aviruthen merged 1 commit into
aws:masterfrom
Hannah14295:fix/dpo-trainer-missing-json-re-imports

Conversation

@Hannah14295

Copy link
Copy Markdown
Contributor

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.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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.
@aviruthen
aviruthen merged commit 1195088 into aws:master Jul 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants