Add epsilon predictor support to diffusion framework#1563
Add epsilon predictor support to diffusion framework#1563CharlelieLrt wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
Signed-off-by: CharlelieLrt <claurent@nvidia.com>
Greptile SummaryThis PR adds epsilon-predictor support to the diffusion framework by introducing four new conversion methods ( Important Files Changed
|
Signed-off-by: CharlelieLrt <claurent@nvidia.com>
Signed-off-by: CharlelieLrt <claurent@nvidia.com>
laserkelvin
left a comment
There was a problem hiding this comment.
Left some design considerations - let me know what you think.
| self.model = model | ||
| self.noise_scheduler = noise_scheduler | ||
|
|
||
| if prediction_type == "x0": |
There was a problem hiding this comment.
Personal style, but I think if there are three cases it's probably better to do
match prediction_type:
case "x0": ...
case "score": ...
case "epsilon": ...
case _: raise Exception| model: DiffusionModel, | ||
| noise_scheduler: NoiseScheduler, | ||
| prediction_type: Literal["x0", "score"] = "x0", | ||
| prediction_type: Literal["x0", "score", "epsilon"] = "x0", |
There was a problem hiding this comment.
Maybe consider aliasing prediction_type, so that you can re-use it in the Loss __init__?
| >>> score.shape | ||
| torch.Size([2, 4]) | ||
| """ | ||
| t_bc = t.reshape(-1, *([1] * (epsilon.ndim - 1))) |
There was a problem hiding this comment.
This is pretty hard to read IMO
There was a problem hiding this comment.
What would you suggest to improve readability?
There was a problem hiding this comment.
expected_shape = (-1,) + (1,) * (epsilon.ndim - 1)
t_bc = t.reshape(expected_shape)There was a problem hiding this comment.
Understandably subjective :)
| >>> eps.shape | ||
| torch.Size([2, 4]) | ||
| """ | ||
| t_bc = t.reshape(-1, *([1] * (score.ndim - 1))) |
There was a problem hiding this comment.
Same readability comment
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.