Skip to content

Fix UNet segmentation example - #114

Open
xrhd wants to merge 1 commit into
jax-ml:mainfrom
xrhd:fix/UNet_segmentation_example
Open

Fix UNet segmentation example#114
xrhd wants to merge 1 commit into
jax-ml:mainfrom
xrhd:fix/UNet_segmentation_example

Conversation

@xrhd

@xrhd xrhd commented Dec 27, 2025

Copy link
Copy Markdown

Resolves #113 #73

Reference

Checklist

  • I have read the Contribution Guidelines and used pre-commit hooks to format this commit.
  • [] I have added all the necessary unit tests for my change. (run_model.py for model usage, test_outputs.py and/or model_validation_colab.ipynb for quality).
  • [] (If using an LLM) I have carefully reviewed and removed all superfluous comments or unneeded, commented-out code. Only necessary and functional code remains.
  • I have signed the Contributor License Agreement (CLA).

@chapman20j

Copy link
Copy Markdown
Collaborator

Hi @xrhd. Thanks for this commit. Just leaving some brief comments.

  1. Could you remove emojis from the notebook
  2. Could you update the intro information to reflect that this is no longer a work in progress
  3. In section 4, the script re-loads the weights and then trains again. The further trained weights aren't used in the final inference outputs. Could you just use the weights from section 4 in section 6?

@jenriver

Copy link
Copy Markdown
Member

Also, please update the branch to make sure latest codes are in. Thanks!

@xrhd
xrhd force-pushed the fix/UNet_segmentation_example branch from 67b45bd to 32e04bb Compare January 18, 2026 22:31
@jenriver

Copy link
Copy Markdown
Member

Hi @xrhd, thanks for the update!

It looks like the pre-commit check is failing because we recently added jupytext to the repository. We use this to automatically sync .ipynb files with a paired .md file, which makes reviewing notebook diffs much easier.
Since your environment might not have the updated dependencies yet, the .md file wasn't generated when you saved the notebook. Could you please run the following steps to fix the sync?

# 1. Update your dev dependencies (to install jupytext)
pip install -e ".[dev]"

# 2. Run pre-commit manually
pre-commit run --all-files

This will likely modify the .ipynb metadata slightly and generate/update the corresponding .md file. Please add those changes to your commit, and the checks should pass.

@xrhd

xrhd commented Feb 6, 2026

Copy link
Copy Markdown
Author

Hi @chapman20j and @jenriver,

Thanks for the review and feedback!

First of all, sorry for the delay in getting back to this. I've gone ahead and applied the changes you requested:

  • Updated the intro to reflect that it's no longer a WIP.
  • Adjusted the logic in sections 4 and 6 to ensure the correct weights are used for inference.

I also followed the steps to fix the pre-commit and jupytext sync, so the checks should be passing now.

@chapman20j

Copy link
Copy Markdown
Collaborator

Hi. Sorry for the delays in getting this accepted. I took a look and it looks good to me. Could you squash this commit into 1 commit?

@xrhd
xrhd force-pushed the fix/UNet_segmentation_example branch from c9a23c9 to fa8052f Compare February 16, 2026 20:16
@xrhd

xrhd commented Feb 16, 2026

Copy link
Copy Markdown
Author

Hi. Sorry for the delays in getting this accepted. I took a look and it looks good to me. Could you squash this commit into 1 commit?

Squashed and rebased @chapman20j :)

- Use absolute path for Orbax checkpoints
- Use jax.extend to get backend info
- Update UNet example to use in-memory weights for inference
- Remove WIP markers and sync jupytext md file
@xrhd
xrhd force-pushed the fix/UNet_segmentation_example branch from fa8052f to ec102c6 Compare February 21, 2026 18:57
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.

Failed to save and load checkpoints in UNet segmentation example

3 participants