ssube / onnx-web

web UI for GPU-accelerated ONNX pipelines like Stable Diffusion, even on Windows and AMD
https://discord.gg/7CdQmutGuw
MIT License
201 stars 26 forks source link

add support for more ESRGAN models #456

Closed ssube closed 9 months ago

ssube commented 9 months ago

Some third-party ESRGAN models use different keys, which are not supported by the current converter.

Example keys ``` Missing key(s) in state_dict: "conv_first.weight", "conv_first.bias", "body.0.rdb1.conv1.weight", "body.0.rdb1.conv1.bias", "body.0.rdb1.conv2.weight", "body.0.rdb1.conv2.bias", "body.0.rdb1.conv3.weight", "body.0.rdb1.conv3.bias", "body.0.rdb1.conv4.weight", "body.0.rdb1.conv4.bias", "body.0.rdb1.conv5.weight", "body.0.rdb1.conv5.bias", "body.0.rdb2.conv1.weight", "body.0.rdb2.conv1.bias", ... "body.22.rdb3.conv5.weight", "body.22.rdb3.conv5.bias", "conv_body.weight", "conv_body.bias", "conv_up1.weight", "conv_up1.bias", "conv_up2.weight", "conv_up2.bias", "conv_hr.weight", "conv_hr.bias", "conv_last.weight", "conv_last.bias" Unexpected key(s) in state_dict: "model.0.weight", "model.0.bias", "model.1.sub.0.RDB1.conv1.0.weight", "model.1.sub.0.RDB1.conv1.0.bias", "model.1.sub.0.RDB1.conv2.0.weight", "model.1.sub.0.RDB1.conv2.0.bias", "model.1.sub.0.RDB1.conv3.0.weight", "model.1.sub.0.RDB1.conv3.0.bias", "model.1.sub.0.RDB1.conv4.0.weight", "model.1.sub.0.RDB1.conv4.0.bias", "model.1.sub.0.RDB1.conv5.0.weight", "model.1.sub.0.RDB1.conv5.0.bias", "model.1.sub.0.RDB2.conv1.0.weight", "model.1.sub.0.RDB2.conv1.0.bias", "model.1.sub.0.RDB2.conv2.0.weight", "model.1.sub.0.RDB2.conv2.0.bias", ... "model.1.sub.22.RDB3.conv4.0.weight", "model.1.sub.22.RDB3.conv4.0.bias", "model.1.sub.22.RDB3.conv5.0.weight", "model.1.sub.22.RDB3.conv5.0.bias", "model.1.sub.23.weight", "model.1.sub.23.bias", "model.3.weight", "model.3.bias", "model.6.weight", "model.6.bias", "model.8.weight", "model.8.bias", "model.10.weight", "model.10.bias" 'model.1.sub.23.weight', 'model.1.sub.23.bias', 'model.2.weight', 'model.2.bias', 'model.4.weight', 'model.4.bias' ]) ```

Add a function to convert them to the expected keys, like we do for SDXL LoRAs.