-
Notifications
You must be signed in to change notification settings - Fork 185
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
ddpm #915
base: develop
Are you sure you want to change the base?
ddpm #915
Conversation
Thanks for your contribution! |
|
git 提交之前需要先用pre-commit进行检查,可参考https://zhuanlan.zhihu.com/p/590275006等,安装pre-commit |
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.
辛苦提交代码~请注意:
- 修改所有注释为英文半角,删除不必要的注释
- 为重要的函数和类写hints
- 修改含义不明的变量,变量名有意义,但不要太长
- 注意文件中的代码排布,尽量将同类功能的代码放在同个文件或同个部分,如plot相关的代码放一起
- 删除冗余代码,如没有用到的函数或变量赋值
- 修改代码实现格式
- 重新提交时使用pre-commit进行检查
谢谢
@@ -0,0 +1,64 @@ | |||
mode: train |
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.
config文件格式请参考其他案例(如aneurysm)修改,增加hydra部分,剩余参数分为MODEL/TRAIN/EVAL和其他,并精简删除没有用到的参数
resume_training: false | ||
data: | ||
dataset: "kolmogorov flow" | ||
data_dir: "/home/aistudio/data/data264003/train_data.npy" |
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.
修改路径为ddpm下的相对路径,之后yaml文件中的其他路径也是
@@ -0,0 +1,50 @@ | |||
log_dir: "./experiments/kmflow_re1000_rs256_ddim_recons_conditional_log" |
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.
同上一个文件
@@ -0,0 +1,201 @@ | |||
import paddle |
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.
请删除函数中的注释(除了特别需要解释的部分),复杂函数开头写上hint,注释需要使用英文、半角,修改后请使用pre-commit检查代码格式
dx_func = kwargs.get("dx_func", None) | ||
clamp_func = kwargs.get("clamp_func", None) | ||
cache = kwargs.get("cache", False) | ||
logger = kwargs.get("logger", None) |
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.
请参考paddlescience格式修改:
- 此处是否可以删除某些变量的设置,如logger
- kwargs.get试图获取“ dx_func”对应的变量,如果没有就设置dx_func=None,请参考其他example将这种写法修改为def ddim_steps(dx_func:xxtype(如int)=None)
def transform_out(outputs): | ||
loss = (outputs[1] - outputs[0]).square().sum(axis=(1, 2, 3)).mean(axis=0) | ||
|
||
return {"loss": loss} |
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.
为什么输出为loss?
Returns: | ||
paddle.Tensor: Loss value. | ||
""" | ||
return result_dict["loss"] |
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.
这个函数似乎没有必要?是还没写完吗
return x | ||
|
||
|
||
def voriticity_residual_train(w, re=1000.0, dt=1 / 32): |
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.
这部分和functions中的有重复吗?如果有的话需要提取和整理,尽量避免重复代码
|
||
|
||
def get_beta_schedule_train( | ||
beta_schedule, *, beta_start, beta_end, num_diffusion_timesteps |
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.
这个*的写法尽量修改
return betas | ||
|
||
|
||
class EMAHelper(object): |
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.
这个类是做什么的?也没在其他代码中找到
PR types
new feature
PR changes
new ddpm.py in ppsci.arch;new ddpm folder in example folder.
Describe