Repository navigation
DiffusionGemma Sudoku: train with DiffusionTrainer (canvas was never passed) - #393
Conversation
…iffusion objective)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b820be852
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "tok = processor.tokenizer if hasattr(processor, \"tokenizer\") else processor\n", | ||
| "pad = tok.pad_token_id if tok.pad_token_id is not None else eos\n", | ||
| "from datasets import Dataset\n", | ||
| "from unsloth import DiffusionTrainer, DiffusionConfig\n", |
There was a problem hiding this comment.
Ship DiffusionTrainer before importing it
In the generated Colab path, the installation cell installs the ordinary released unsloth package, but the current package and upstream main do not export DiffusionTrainer or DiffusionConfig; the commit message also identifies the implementation PR as not yet merged or released. Consequently, running the notebook now stops here with ImportError before training. Land and release the dependency first, or pin/install the implementation that provides these classes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Intentional merge order: this PR stays unmerged until unslothai/unsloth#13157 (which adds DiffusionTrainer) is merged and released, as stated in the description.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b820be852
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| " opt.step(); sched.step(); opt.zero_grad(set_to_none=True)\n", | ||
| " if step % 20 == 0:\n", | ||
| " print(f\"step {step:4d}/{STEPS} | loss {step_loss:.4f} | {time.time()-t0:.0f}s\", flush=True)" | ||
| "trainer = DiffusionTrainer(\n", |
There was a problem hiding this comment.
Regenerate the user-facing notebook variants
This trainer replacement exists only in original_template/; the commit leaves nb/DiffusionGemma_(26B-A4B)-Sudoku.ipynb, its Kaggle/AMD variants, and the generated Python/Molab copies on the old broken canvas_ids training loop. Since the README's Colab link points to the nb/ copy (README.md:232) and no workflow regenerates or commits these artifacts after merge, users will not receive the fix at all. Run update_all_notebooks.py --to_main_repo and commit the generated outputs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7fae053: regenerated the nb/, Kaggle, python_scripts and molab DiffusionGemma copies with update_all_notebooks.py --to_main_repo.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # molab/DiffusionGemma_(26B-A4B)-Sudoku.py
The DiffusionGemma Sudoku notebook trained with
model(input_ids = ..., canvas_ids = corrupt(x0), ...).DiffusionGemmaForBlockDiffusion.forwardhas nocanvas_idsargument (the canvas isdecoder_input_ids), so it was dropped through**kwargsand every step denoised a fresh uniform random canvas instead of the corrupted solution. Reported in unslothai/unsloth#7515. The loop also differed from the reference recipe: no self-conditioning, no encoder autoregressive co-loss, an unsupervised pad tail instead of the EOS-filled canvas, andtdrawn from U(0.1, 1).This switches the training cell to
DiffusionTrainer/DiffusionConfigfrom Unsloth, which implements the reference block-diffusion objective, on a prompt / completion dataset withcompletion_only_loss. Onlyoriginal_template/DiffusionGemma_(26B-A4B)-Sudoku.ipynbchanges; the generated copies come fromupdate_all_notebooks.py.Other changes in the notebook:
warmup_stepsinstead ofwarmup_ratio(removed in transformers 5).On one B200 (bf16, LoRA r=64, 60 steps x grad accum 4, 30 held-out puzzles, greedy), cell accuracy at 32 denoising steps went from 82.8% (base) to 18.1% with the old loop and to 85.8% with
DiffusionTrainer. The converted notebook also runs end to end on the tiny DiffusionGemma.Needs unslothai/unsloth#13157 (which adds
DiffusionTrainer) merged and released first.