Refactor TopoDiff recipe to use diffusion framework#1562
Refactor TopoDiff recipe to use diffusion framework#1562CharlelieLrt wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
Greptile SummaryThis PR refactors the TopoDiff example scripts to use the There are two P1 bugs affecting training correctness:
Important Files Changed
|
| @@ -64,8 +63,8 @@ def main(cfg: DictConfig) -> None: | |||
| batch = torch.tensor(train_img[idx]).float().unsqueeze(1).to(device) * 2 - 1 | |||
There was a problem hiding this comment.
Double normalization — training data scaled to [-3, 1] instead of [-1, 1]
load_data_classifier returns pixel values in [0, 1]. Lines 39–40 already map those to [-1, 1] via train_img = 2 * train_img - 1. The training loop then applies * 2 - 1 a second time, mapping [-1, 1] → [-3, 1]. The classifier therefore never sees correctly scaled inputs, which will hurt convergence. Remove the redundant transform:
| batch = torch.tensor(train_img[idx]).float().unsqueeze(1).to(device) * 2 - 1 | |
| batch = torch.tensor(train_img[idx]).float().unsqueeze(1).to(device) |
There was a problem hiding this comment.
That's a valid point. However, the scope of this PR is only to refactor the TopoDiff recipe such that it uses the diffusion toolkit. Fixing pre-existing bugs is out-of-scope for this PR.
There was a problem hiding this comment.
I'll let @mnabian chime in, but it does look like a bug to me
There was a problem hiding this comment.
I agree that this is a valid point. But I suggest we leave it as is (or add a comment to the code about this issue) since the results are already validated.
Signed-off-by: CharlelieLrt <claurent@nvidia.com>
35a1292 to
3355188
Compare
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
coreyjadams
left a comment
There was a problem hiding this comment.
approved for pyproject.toml
mnabian
left a comment
There was a problem hiding this comment.
I think the changes look good overall. I could not spot any major issues. It would be good to track the known bugs in the code in an issue. Hopefully at some point in the future we can revisit this example and extend it to 3D cases.
PhysicsNeMo Pull Request
Description
Checklist
Dependencies
Review Process
All PRs are reviewed by the PhysicsNeMo team before merging.
Depending on which files are changed, GitHub may automatically assign a maintainer for review.
We are also testing AI-based code review tools (e.g., Greptile), which may add automated comments with a confidence score.
This score reflects the AI’s assessment of merge readiness and is not a qualitative judgment of your work, nor is
it an indication that the PR will be accepted / rejected.
AI-generated feedback should be reviewed critically for usefulness.
You are not required to respond to every AI comment, but they are intended to help both authors and reviewers.
Please react to Greptile comments with 👍 or 👎 to provide feedback on their accuracy.