-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(wrh): add edm initial implementation #1
base: main
Are you sure you want to change the base?
Conversation
ruiheng123
commented
Aug 20, 2024
- Paper reference: https://arxiv.org/abs/2206.00364
- Code reference: https://github.com/NVlabs/edm
grl/generative_models/edm_diffusion_model/edm_diffusion_model.py
Outdated
Show resolved
Hide resolved
def __init__(self, config: Optional[EasyDict]=None) -> None: | ||
|
||
super().__init__() | ||
self.config= config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use single-layer config
return loss | ||
|
||
|
||
def _get_sigma_steps_t_steps(self, num_steps=18, epsilon_s=1e-3, rho=7): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this method is called with the same argument during training, you should just call it once
grl/generative_models/edm_diffusion_model/edm_diffusion_model.py
Outdated
Show resolved
Hide resolved
grl/generative_models/edm_diffusion_model/edm_preconditioner.py
Outdated
Show resolved
Hide resolved
c_in = 1 / (sigma ** 2 + 1).sqrt() | ||
c_noise = self.M - 1 - self.round_sigma(sigma, return_index=True).to(torch.float32) | ||
elif self.precondition_type == "EDM": | ||
c_skip = self.sigma_data ** 2 / (sigma ** 2 + self.sigma_data ** 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for some constant variable, such as self.sigma_data ** 2
, we can pre-compute them to save computation.
grl/generative_models/edm_diffusion_model/edm_diffusion_model.py
Outdated
Show resolved
Hide resolved
…into dev-edm merge it the commit.
49f5fc0
to
9fa1b41
Compare