stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

Gradient Vanish when I import load_model_from_config function from scripts.txt2img

Open jin-qq opened this issue 3 years ago • 1 comments

When I tried to finetune stable-diffusion, I import the load_model_from_config from scripts.txt2img, I found that gradient value equal to None even if require grad==True. When I import load_model_from_config, I create a MLP network (only one nn.Linear layer), this network do not have gradient as well. However, if I do not import load_model_from_config or any function from scripts.txt2img, MLP network have grandient and can be trained.

jin-qq avatar Oct 25 '23 07:10 jin-qq

If I use https://github.com/facebookresearch/stable_signature/blob/main/utils_model.py#L134 to replace load_model_from_config , my other network have gradient and can be trained but stable-diffusion does not have gradient.

jin-qq avatar Oct 25 '23 07:10 jin-qq