gligen / GLIGEN

Open-Set Grounded Text-to-Image Generation
MIT License
2.02k stars 151 forks source link

Problems on trainer, the unexpected_keys #52

Closed zcai0612 closed 1 year ago

zcai0612 commented 1 year ago

Since you use the

if level != len(channel_mult) - 1: # will not go to this downsample branch in the last feature

in UNet, when initializing the trainer, the missing Downsample module will be taken as an unexpected key.

missing_keys, unexpected_keys = self.model.load_state_dict( state_dict["model"], strict=False  )
assert unexpected_keys == []

The code will be wrong. I hope you'll get back to me if I have a wrong understanding.

zcai0612 commented 1 year ago

Since you use the

if level != len(channel_mult) - 1: # will not go to this downsample branch in the last feature

in UNet, when initializing the trainer, the missing Downsample module will be taken as an unexpected key.

missing_keys, unexpected_keys = self.model.load_state_dict( state_dict["model"], strict=False  )
assert unexpected_keys == []

The code will be wrong. I hope you'll get back to me if I have a wrong understanding.

zcai0612 commented 1 year ago

Well, I propose this problem since I got it wrong in

missing_keys, unexpected_keys = self.model.load_state_dict( state_dict["model"], strict=False  )
assert unexpected_keys == []

Now I know there is nothing wrong here, I will go for some other reasons. 😢