Diff-UNet icon indicating copy to clipboard operation
Diff-UNet copied to clipboard

in fucntion training_step, why x_start = (x_start) * 2 - 1

Open cqlouis opened this issue 1 year ago • 4 comments

def training_step(self, batch):
        image, label = self.get_input(batch)
        x_start = label

        x_start = (x_start) * 2 - 1

why x_start = (x_start)*2 -1 ?

Can I use x_start directly, instead of two times and minus1?

cqlouis avatar Oct 12 '23 05:10 cqlouis

Yes, it's ok. This operator makes x_start in [-1, 1] range, bacause the diffusion model's input is usually in [-1, 1].

920232796 avatar Oct 12 '23 05:10 920232796

Yes, it's ok. This operator makes x_start in [-1, 1] range, bacause the diffusion model's input is usually in [-1, 1].

Thanks for your quick reply.

Another question: I was wondering if there should be some modification in the rest of coding on the condition of making x_start in [-1, 1] or not.

In Chinese: 把x_start 转化为[-1,1]和不转换,直接使用其值在[0,1],这两种情况,在代码上,是不是有什么地方需要做对应的修改?

cqlouis avatar Oct 12 '23 06:10 cqlouis

No. You can train the model directly, and this operator only has a little change on the validation results.

920232796 avatar Oct 12 '23 07:10 920232796

No. You can train the model directly, and this operator only has a little change on the validation results.

Thanks!

cqlouis avatar Oct 12 '23 11:10 cqlouis