From 64d3c2b1e9b017568421b4bdebe45aa3e471380b Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 7 Jul 2024 21:32:42 +0200 Subject: [PATCH] Rename all `arch` directories to `__arch` (#283) --- CONTRIBUTING.md | 10 +- README.md | 2 +- .../ATD/{arch => __arch}/LICENSE | 0 .../ATD/{arch => __arch}/atd_arch.py | 0 .../spandrel/architectures/ATD/__init__.py | 2 +- .../CRAFT/{arch => __arch}/CRAFT.py | 0 .../CRAFT/{arch => __arch}/LICENSE | 0 .../spandrel/architectures/CRAFT/__init__.py | 2 +- .../Compact/{arch => __arch}/LICENSE | 0 .../Compact/{arch => __arch}/SRVGG.py | 0 .../architectures/Compact/__init__.py | 2 +- .../architectures/DAT/{arch => __arch}/DAT.py | 0 .../DAT/{arch => __arch}/LICENSE | 0 .../spandrel/architectures/DAT/__init__.py | 2 +- .../DCTLSA/{arch => __arch}/LICENSE | 0 .../DCTLSA/{arch => __arch}/dctlsa.py | 0 .../spandrel/architectures/DCTLSA/__init__.py | 2 +- .../DITN/{arch => __arch}/DITN_Real.py | 0 .../DITN/{arch => __arch}/LICENSE | 0 .../spandrel/architectures/DITN/__init__.py | 2 +- .../DRCT/{arch => __arch}/LICENSE | 0 .../DRCT/{arch => __arch}/drct_arch.py | 0 .../spandrel/architectures/DRCT/__init__.py | 2 +- .../DRUNet/{arch => __arch}/LICENSE | 0 .../DRUNet/{arch => __arch}/network_unet.py | 0 .../spandrel/architectures/DRUNet/__init__.py | 2 +- .../DnCNN/{arch => __arch}/LICENSE | 0 .../DnCNN/{arch => __arch}/network_dncnn.py | 0 .../spandrel/architectures/DnCNN/__init__.py | 2 +- .../ESRGAN/{arch => __arch}/LICENSE | 0 .../ESRGAN/{arch => __arch}/RRDB.py | 0 .../spandrel/architectures/ESRGAN/__init__.py | 2 +- .../FBCNN/{arch => __arch}/FBCNN.py | 0 .../FBCNN/{arch => __arch}/LICENSE | 0 .../spandrel/architectures/FBCNN/__init__.py | 2 +- .../FFTformer/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/fftformer_arch.py | 0 .../architectures/FFTformer/__init__.py | 2 +- .../GFPGAN/{arch => __arch}/LICENSE | 0 .../GFPGAN/{arch => __arch}/arcface_arch.py | 0 .../GFPGAN/{arch => __arch}/fused_act.py | 0 .../{arch => __arch}/gfpgan_bilinear_arch.py | 0 .../GFPGAN/{arch => __arch}/gfpganv1_arch.py | 0 .../{arch => __arch}/gfpganv1_clean_arch.py | 0 .../GFPGAN/{arch => __arch}/stylegan2_arch.py | 0 .../stylegan2_bilinear_arch.py | 0 .../{arch => __arch}/stylegan2_clean_arch.py | 0 .../GFPGAN/{arch => __arch}/upfirdn2d.py | 0 .../spandrel/architectures/GFPGAN/__init__.py | 2 +- .../GRL/{arch => __arch}/LICENSE | 0 .../GRL/{arch => __arch}/config.py | 0 .../architectures/GRL/{arch => __arch}/grl.py | 0 .../GRL/{arch => __arch}/mixed_attn_block.py | 0 .../mixed_attn_block_efficient.py | 0 .../architectures/GRL/{arch => __arch}/ops.py | 0 .../GRL/{arch => __arch}/swin_v1_block.py | 0 .../GRL/{arch => __arch}/upsample.py | 0 .../spandrel/architectures/GRL/__init__.py | 2 +- .../architectures/HAT/{arch => __arch}/HAT.py | 0 .../HAT/{arch => __arch}/LICENSE | 0 .../spandrel/architectures/HAT/__init__.py | 2 +- .../{arch => __arch}/HVI_transform.py | 0 .../HVICIDNet/{arch => __arch}/LCA.py | 0 .../HVICIDNet/{arch => __arch}/LICENSE | 0 .../HVICIDNet/{arch => __arch}/cidnet.py | 0 .../{arch => __arch}/transformer_utils.py | 0 .../architectures/HVICIDNet/__init__.py | 2 +- .../IPT/{arch => __arch}/LICENSE | 0 .../IPT/{arch => __arch}/common.py | 0 .../architectures/IPT/{arch => __arch}/ipt.py | 0 .../IPT/{arch => __arch}/model.py | 0 .../spandrel/architectures/IPT/__init__.py | 4 +- .../KBNet/{arch => __arch}/LICENSE | 0 .../KBNet/{arch => __arch}/kb_utils.py | 0 .../KBNet/{arch => __arch}/kbnet_l.py | 0 .../KBNet/{arch => __arch}/kbnet_s.py | 0 .../spandrel/architectures/KBNet/__init__.py | 4 +- .../LaMa/{arch => __arch}/LICENSE | 0 .../LaMa/{arch => __arch}/LaMa.py | 0 .../spandrel/architectures/LaMa/__init__.py | 2 +- .../MMRealSR/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/mmrealsr_arch.py | 0 .../architectures/MMRealSR/__init__.py | 2 +- .../MixDehazeNet/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/MixDehazeNet.py | 0 .../architectures/MixDehazeNet/__init__.py | 2 +- .../NAFNet/{arch => __arch}/LICENSE | 0 .../NAFNet/{arch => __arch}/NAFNet_arch.py | 0 .../NAFNet/{arch => __arch}/arch_util.py | 0 .../spandrel/architectures/NAFNet/__init__.py | 2 +- .../{arch => __arch}/ChannelAttention.py | 0 .../OmniSR/{arch => __arch}/LICENSE | 0 .../OmniSR/{arch => __arch}/OSA.py | 0 .../OmniSR/{arch => __arch}/OSAG.py | 0 .../OmniSR/{arch => __arch}/OmniSR.py | 0 .../OmniSR/{arch => __arch}/esa.py | 0 .../OmniSR/{arch => __arch}/layernorm.py | 0 .../OmniSR/{arch => __arch}/pixelshuffle.py | 0 .../spandrel/architectures/OmniSR/__init__.py | 2 +- .../PLKSR/{arch => __arch}/LICENSE | 42 +- .../PLKSR/{arch => __arch}/PLKSR.py | 690 +++++++++--------- .../PLKSR/{arch => __arch}/RealPLKSR.py | 282 +++---- .../spandrel/architectures/PLKSR/__init__.py | 4 +- .../RGT/{arch => __arch}/LICENSE | 0 .../architectures/RGT/{arch => __arch}/rgt.py | 0 .../spandrel/architectures/RGT/__init__.py | 2 +- .../RealCUGAN/{arch => __arch}/LICENSE | 0 .../RealCUGAN/{arch => __arch}/upcunet_v3.py | 0 .../architectures/RealCUGAN/__init__.py | 2 +- .../RestoreFormer/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/restoreformer_arch.py | 0 .../architectures/RestoreFormer/__init__.py | 2 +- .../RetinexFormer/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/retinexformer_arch.py | 0 .../architectures/RetinexFormer/__init__.py | 2 +- .../SAFMN/{arch => __arch}/LICENSE | 0 .../SAFMN/{arch => __arch}/safmn.py | 0 .../spandrel/architectures/SAFMN/__init__.py | 2 +- .../SAFMNBCIE/{arch => __arch}/LICENSE | 0 .../SAFMNBCIE/{arch => __arch}/safmn_bcie.py | 0 .../architectures/SAFMNBCIE/__init__.py | 2 +- .../SCUNet/{arch => __arch}/LICENSE | 0 .../SCUNet/{arch => __arch}/SCUNet.py | 0 .../spandrel/architectures/SCUNet/__init__.py | 2 +- .../SPAN/{arch => __arch}/LICENSE | 0 .../SPAN/{arch => __arch}/span.py | 0 .../spandrel/architectures/SPAN/__init__.py | 2 +- .../SwiftSRGAN/{arch => __arch}/LICENSE | 0 .../SwiftSRGAN/{arch => __arch}/SwiftSRGAN.py | 0 .../architectures/SwiftSRGAN/__init__.py | 2 +- .../Swin2SR/{arch => __arch}/LICENSE | 0 .../Swin2SR/{arch => __arch}/Swin2SR.py | 0 .../architectures/Swin2SR/__init__.py | 2 +- .../SwinIR/{arch => __arch}/LICENSE | 0 .../SwinIR/{arch => __arch}/SwinIR.py | 0 .../spandrel/architectures/SwinIR/__init__.py | 2 +- .../Uformer/{arch => __arch}/LICENSE | 0 .../Uformer/{arch => __arch}/Uformer.py | 0 .../architectures/Uformer/__init__.py | 2 +- .../AdaCode/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/adacode_contrast_arch.py | 2 +- .../architectures/AdaCode/__init__.py | 2 +- .../CodeFormer/{arch => __arch}/LICENSE | 0 .../CodeFormer/{arch => __arch}/codeformer.py | 0 .../architectures/CodeFormer/__init__.py | 2 +- .../DDColor/{arch => __arch}/LICENSE | 0 .../DDColor/{arch => __arch}/convnext.py | 0 .../DDColor/{arch => __arch}/ddcolor.py | 0 .../{arch => __arch}/position_encoding.py | 0 .../DDColor/{arch => __arch}/transformer.py | 0 .../{arch => __arch}/transformer_utils.py | 0 .../DDColor/{arch => __arch}/unet.py | 0 .../DDColor/{color.py => __color.py} | 0 .../architectures/DDColor/__init__.py | 4 +- .../FeMaSR/{arch => __arch}/LICENSE | 0 .../FeMaSR/{arch => __arch}/fema_utils.py | 0 .../FeMaSR/{arch => __arch}/femasr.py | 2 +- .../architectures/FeMaSR/__init__.py | 2 +- .../M3SNet/{arch => __arch}/LICENSE | 0 .../M3SNet/{arch => __arch}/M3SNet.py | 0 .../M3SNet/{arch => __arch}/arch_utils.py | 0 .../M3SNet/{arch => __arch}/local_arch.py | 0 .../architectures/M3SNet/__init__.py | 2 +- .../MAT/{arch => __arch}/LICENSE | 0 .../architectures/MAT/{arch => __arch}/MAT.py | 0 .../MAT/{arch => __arch}/utils.py | 0 .../architectures/MAT/__init__.py | 2 +- .../MIRNet2/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/mirnet_v2_arch.py | 0 .../architectures/MIRNet2/__init__.py | 2 +- .../MPRNet/{arch => __arch}/LICENSE | 0 .../MPRNet/{arch => __arch}/MPRNet.py | 0 .../architectures/MPRNet/__init__.py | 2 +- .../Restormer/{arch => __arch}/LICENSE | 0 .../{arch => __arch}/restormer_arch.py | 0 .../architectures/Restormer/__init__.py | 2 +- .../SRFormer/{arch => __arch}/LICENSE | 0 .../SRFormer/{arch => __arch}/SRFormer.py | 0 .../architectures/SRFormer/__init__.py | 2 +- pyproject.toml | 2 +- 180 files changed, 566 insertions(+), 566 deletions(-) rename libs/spandrel/spandrel/architectures/ATD/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/ATD/{arch => __arch}/atd_arch.py (100%) rename libs/spandrel/spandrel/architectures/CRAFT/{arch => __arch}/CRAFT.py (100%) rename libs/spandrel/spandrel/architectures/CRAFT/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/Compact/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/Compact/{arch => __arch}/SRVGG.py (100%) rename libs/spandrel/spandrel/architectures/DAT/{arch => __arch}/DAT.py (100%) rename libs/spandrel/spandrel/architectures/DAT/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/DCTLSA/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/DCTLSA/{arch => __arch}/dctlsa.py (100%) rename libs/spandrel/spandrel/architectures/DITN/{arch => __arch}/DITN_Real.py (100%) rename libs/spandrel/spandrel/architectures/DITN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/DRCT/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/DRCT/{arch => __arch}/drct_arch.py (100%) rename libs/spandrel/spandrel/architectures/DRUNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/DRUNet/{arch => __arch}/network_unet.py (100%) rename libs/spandrel/spandrel/architectures/DnCNN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/DnCNN/{arch => __arch}/network_dncnn.py (100%) rename libs/spandrel/spandrel/architectures/ESRGAN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/ESRGAN/{arch => __arch}/RRDB.py (100%) rename libs/spandrel/spandrel/architectures/FBCNN/{arch => __arch}/FBCNN.py (100%) rename libs/spandrel/spandrel/architectures/FBCNN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/FFTformer/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/FFTformer/{arch => __arch}/fftformer_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/arcface_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/fused_act.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/gfpgan_bilinear_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/gfpganv1_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/gfpganv1_clean_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/stylegan2_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/stylegan2_bilinear_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/stylegan2_clean_arch.py (100%) rename libs/spandrel/spandrel/architectures/GFPGAN/{arch => __arch}/upfirdn2d.py (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/config.py (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/grl.py (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/mixed_attn_block.py (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/mixed_attn_block_efficient.py (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/ops.py (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/swin_v1_block.py (100%) rename libs/spandrel/spandrel/architectures/GRL/{arch => __arch}/upsample.py (100%) rename libs/spandrel/spandrel/architectures/HAT/{arch => __arch}/HAT.py (100%) rename libs/spandrel/spandrel/architectures/HAT/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/HVICIDNet/{arch => __arch}/HVI_transform.py (100%) rename libs/spandrel/spandrel/architectures/HVICIDNet/{arch => __arch}/LCA.py (100%) rename libs/spandrel/spandrel/architectures/HVICIDNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/HVICIDNet/{arch => __arch}/cidnet.py (100%) rename libs/spandrel/spandrel/architectures/HVICIDNet/{arch => __arch}/transformer_utils.py (100%) rename libs/spandrel/spandrel/architectures/IPT/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/IPT/{arch => __arch}/common.py (100%) rename libs/spandrel/spandrel/architectures/IPT/{arch => __arch}/ipt.py (100%) rename libs/spandrel/spandrel/architectures/IPT/{arch => __arch}/model.py (100%) rename libs/spandrel/spandrel/architectures/KBNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/KBNet/{arch => __arch}/kb_utils.py (100%) rename libs/spandrel/spandrel/architectures/KBNet/{arch => __arch}/kbnet_l.py (100%) rename libs/spandrel/spandrel/architectures/KBNet/{arch => __arch}/kbnet_s.py (100%) rename libs/spandrel/spandrel/architectures/LaMa/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/LaMa/{arch => __arch}/LaMa.py (100%) rename libs/spandrel/spandrel/architectures/MMRealSR/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/MMRealSR/{arch => __arch}/mmrealsr_arch.py (100%) rename libs/spandrel/spandrel/architectures/MixDehazeNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/MixDehazeNet/{arch => __arch}/MixDehazeNet.py (100%) rename libs/spandrel/spandrel/architectures/NAFNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/NAFNet/{arch => __arch}/NAFNet_arch.py (100%) rename libs/spandrel/spandrel/architectures/NAFNet/{arch => __arch}/arch_util.py (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/ChannelAttention.py (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/OSA.py (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/OSAG.py (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/OmniSR.py (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/esa.py (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/layernorm.py (100%) rename libs/spandrel/spandrel/architectures/OmniSR/{arch => __arch}/pixelshuffle.py (100%) rename libs/spandrel/spandrel/architectures/PLKSR/{arch => __arch}/LICENSE (98%) rename libs/spandrel/spandrel/architectures/PLKSR/{arch => __arch}/PLKSR.py (96%) rename libs/spandrel/spandrel/architectures/PLKSR/{arch => __arch}/RealPLKSR.py (96%) rename libs/spandrel/spandrel/architectures/RGT/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/RGT/{arch => __arch}/rgt.py (100%) rename libs/spandrel/spandrel/architectures/RealCUGAN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/RealCUGAN/{arch => __arch}/upcunet_v3.py (100%) rename libs/spandrel/spandrel/architectures/RestoreFormer/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/RestoreFormer/{arch => __arch}/restoreformer_arch.py (100%) rename libs/spandrel/spandrel/architectures/RetinexFormer/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/RetinexFormer/{arch => __arch}/retinexformer_arch.py (100%) rename libs/spandrel/spandrel/architectures/SAFMN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/SAFMN/{arch => __arch}/safmn.py (100%) rename libs/spandrel/spandrel/architectures/SAFMNBCIE/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/SAFMNBCIE/{arch => __arch}/safmn_bcie.py (100%) rename libs/spandrel/spandrel/architectures/SCUNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/SCUNet/{arch => __arch}/SCUNet.py (100%) rename libs/spandrel/spandrel/architectures/SPAN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/SPAN/{arch => __arch}/span.py (100%) rename libs/spandrel/spandrel/architectures/SwiftSRGAN/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/SwiftSRGAN/{arch => __arch}/SwiftSRGAN.py (100%) rename libs/spandrel/spandrel/architectures/Swin2SR/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/Swin2SR/{arch => __arch}/Swin2SR.py (100%) rename libs/spandrel/spandrel/architectures/SwinIR/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/SwinIR/{arch => __arch}/SwinIR.py (100%) rename libs/spandrel/spandrel/architectures/Uformer/{arch => __arch}/LICENSE (100%) rename libs/spandrel/spandrel/architectures/Uformer/{arch => __arch}/Uformer.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/{arch => __arch}/adacode_contrast_arch.py (98%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/{arch => __arch}/codeformer.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{arch => __arch}/convnext.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{arch => __arch}/ddcolor.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{arch => __arch}/position_encoding.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{arch => __arch}/transformer.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{arch => __arch}/transformer_utils.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{arch => __arch}/unet.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/{color.py => __color.py} (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/{arch => __arch}/fema_utils.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/{arch => __arch}/femasr.py (99%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/{arch => __arch}/M3SNet.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/{arch => __arch}/arch_utils.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/{arch => __arch}/local_arch.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/{arch => __arch}/MAT.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/{arch => __arch}/utils.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/{arch => __arch}/mirnet_v2_arch.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/{arch => __arch}/MPRNet.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/{arch => __arch}/restormer_arch.py (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/{arch => __arch}/LICENSE (100%) rename libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/{arch => __arch}/SRFormer.py (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3baf4a3..90e5c7b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,11 +110,11 @@ Of course, the copy this code, we first have to find it! Unfortunately, project In the case of DITN, the file is called [`models/DITN_Real.py`](https://github.com/yongliuy/DITN/blob/3438e429c0538ee5061a7cfca587df0c4097703f/models/DITN_Real.py#L197). -Once you have found the file, create a new directory `libs/spandrel/architectures//arch/` and copy the file into it. This directory will contain all code that we will copy. Since we respect the copy right of the original authors, we will also copy the `LICENSE` file of the repo into this directory. +Once you have found the file, create a new directory `libs/spandrel/architectures//__arch/` and copy the file into it. This directory will contain all code that we will copy. Since we respect the copy right of the original authors, we will also copy the `LICENSE` file of the repo into this directory. -In the case of DITN, we copy `models/DITN_Real.py` to `libs/spandrel/architectures/DITN/arch/DITN_Real.py` and add the `LICENSE` file of the repo. +In the case of DITN, we copy `models/DITN_Real.py` to `libs/spandrel/architectures/DITN/__arch/DITN_Real.py` and add the `LICENSE` file of the repo. -The main model file might also reference other files in the repo. You have to copy those files into your `arch/` directory as well. +The main model file might also reference other files in the repo. You have to copy those files into your `__arch/` directory as well. In the case of DITN, the main model file doesn't reference any other files, so we are done. @@ -160,7 +160,7 @@ Create a file `libs/spandrel/architectures//__init__.py` and add the ```python from ...__helpers.model_descriptor import ImageModelDescriptor, StateDict -from .arch.ARCH_NAME import ARCH_NAME +from .__arch.ARCH_NAME import ARCH_NAME def load(state_dict: StateDict) -> ImageModelDescriptor[ARCH_NAME]: @@ -205,7 +205,7 @@ In the case of DITN, the filled in template looks like this: ```python from ...__helpers.model_descriptor import ImageModelDescriptor, StateDict -from .arch.DITN_Real import DITN_Real as DITN +from .__arch.DITN_Real import DITN_Real as DITN def load(state_dict: StateDict) -> ImageModelDescriptor[DITN]: diff --git a/README.md b/README.md index 5a5e96ce..d3c78828 100644 --- a/README.md +++ b/README.md @@ -169,4 +169,4 @@ Here are some cool projects that use Spandrel: ## License -This repo is bounded by the MIT license. However, the code of implemented architectures (everything inside an `arch/` directory) is bound by their original respective licenses (which are included in their respective `arch/` directories). +This repo is bounded by the MIT license. However, the code of implemented architectures (everything inside an `__arch/` directory) is bound by their original respective licenses (which are included in their respective `__arch/` directories). diff --git a/libs/spandrel/spandrel/architectures/ATD/arch/LICENSE b/libs/spandrel/spandrel/architectures/ATD/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/ATD/arch/LICENSE rename to libs/spandrel/spandrel/architectures/ATD/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/ATD/arch/atd_arch.py b/libs/spandrel/spandrel/architectures/ATD/__arch/atd_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/ATD/arch/atd_arch.py rename to libs/spandrel/spandrel/architectures/ATD/__arch/atd_arch.py diff --git a/libs/spandrel/spandrel/architectures/ATD/__init__.py b/libs/spandrel/spandrel/architectures/ATD/__init__.py index 2bfe594f..1603368d 100644 --- a/libs/spandrel/spandrel/architectures/ATD/__init__.py +++ b/libs/spandrel/spandrel/architectures/ATD/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.atd_arch import ATD +from .__arch.atd_arch import ATD class ATDArch(Architecture[ATD]): diff --git a/libs/spandrel/spandrel/architectures/CRAFT/arch/CRAFT.py b/libs/spandrel/spandrel/architectures/CRAFT/__arch/CRAFT.py similarity index 100% rename from libs/spandrel/spandrel/architectures/CRAFT/arch/CRAFT.py rename to libs/spandrel/spandrel/architectures/CRAFT/__arch/CRAFT.py diff --git a/libs/spandrel/spandrel/architectures/CRAFT/arch/LICENSE b/libs/spandrel/spandrel/architectures/CRAFT/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/CRAFT/arch/LICENSE rename to libs/spandrel/spandrel/architectures/CRAFT/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/CRAFT/__init__.py b/libs/spandrel/spandrel/architectures/CRAFT/__init__.py index 8effd96a..afb2f061 100644 --- a/libs/spandrel/spandrel/architectures/CRAFT/__init__.py +++ b/libs/spandrel/spandrel/architectures/CRAFT/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.CRAFT import CRAFT +from .__arch.CRAFT import CRAFT class CRAFTArch(Architecture[CRAFT]): diff --git a/libs/spandrel/spandrel/architectures/Compact/arch/LICENSE b/libs/spandrel/spandrel/architectures/Compact/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/Compact/arch/LICENSE rename to libs/spandrel/spandrel/architectures/Compact/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/Compact/arch/SRVGG.py b/libs/spandrel/spandrel/architectures/Compact/__arch/SRVGG.py similarity index 100% rename from libs/spandrel/spandrel/architectures/Compact/arch/SRVGG.py rename to libs/spandrel/spandrel/architectures/Compact/__arch/SRVGG.py diff --git a/libs/spandrel/spandrel/architectures/Compact/__init__.py b/libs/spandrel/spandrel/architectures/Compact/__init__.py index b2da0d71..897f1ee8 100644 --- a/libs/spandrel/spandrel/architectures/Compact/__init__.py +++ b/libs/spandrel/spandrel/architectures/Compact/__init__.py @@ -3,7 +3,7 @@ from spandrel.util import KeyCondition, get_scale_and_output_channels, get_seq_len from ...__helpers.model_descriptor import Architecture, ImageModelDescriptor, StateDict -from .arch.SRVGG import SRVGGNetCompact +from .__arch.SRVGG import SRVGGNetCompact class CompactArch(Architecture[SRVGGNetCompact]): diff --git a/libs/spandrel/spandrel/architectures/DAT/arch/DAT.py b/libs/spandrel/spandrel/architectures/DAT/__arch/DAT.py similarity index 100% rename from libs/spandrel/spandrel/architectures/DAT/arch/DAT.py rename to libs/spandrel/spandrel/architectures/DAT/__arch/DAT.py diff --git a/libs/spandrel/spandrel/architectures/DAT/arch/LICENSE b/libs/spandrel/spandrel/architectures/DAT/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/DAT/arch/LICENSE rename to libs/spandrel/spandrel/architectures/DAT/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/DAT/__init__.py b/libs/spandrel/spandrel/architectures/DAT/__init__.py index e4139991..6ed57566 100644 --- a/libs/spandrel/spandrel/architectures/DAT/__init__.py +++ b/libs/spandrel/spandrel/architectures/DAT/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.DAT import DAT +from .__arch.DAT import DAT class DATArch(Architecture[DAT]): diff --git a/libs/spandrel/spandrel/architectures/DCTLSA/arch/LICENSE b/libs/spandrel/spandrel/architectures/DCTLSA/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/DCTLSA/arch/LICENSE rename to libs/spandrel/spandrel/architectures/DCTLSA/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/DCTLSA/arch/dctlsa.py b/libs/spandrel/spandrel/architectures/DCTLSA/__arch/dctlsa.py similarity index 100% rename from libs/spandrel/spandrel/architectures/DCTLSA/arch/dctlsa.py rename to libs/spandrel/spandrel/architectures/DCTLSA/__arch/dctlsa.py diff --git a/libs/spandrel/spandrel/architectures/DCTLSA/__init__.py b/libs/spandrel/spandrel/architectures/DCTLSA/__init__.py index 11adbad1..b420227e 100644 --- a/libs/spandrel/spandrel/architectures/DCTLSA/__init__.py +++ b/libs/spandrel/spandrel/architectures/DCTLSA/__init__.py @@ -8,7 +8,7 @@ SizeRequirements, StateDict, ) -from .arch.dctlsa import DCTLSA +from .__arch.dctlsa import DCTLSA class DCTLSAArch(Architecture[DCTLSA]): diff --git a/libs/spandrel/spandrel/architectures/DITN/arch/DITN_Real.py b/libs/spandrel/spandrel/architectures/DITN/__arch/DITN_Real.py similarity index 100% rename from libs/spandrel/spandrel/architectures/DITN/arch/DITN_Real.py rename to libs/spandrel/spandrel/architectures/DITN/__arch/DITN_Real.py diff --git a/libs/spandrel/spandrel/architectures/DITN/arch/LICENSE b/libs/spandrel/spandrel/architectures/DITN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/DITN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/DITN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/DITN/__init__.py b/libs/spandrel/spandrel/architectures/DITN/__init__.py index 7ba2341c..d03c1d03 100644 --- a/libs/spandrel/spandrel/architectures/DITN/__init__.py +++ b/libs/spandrel/spandrel/architectures/DITN/__init__.py @@ -12,7 +12,7 @@ SizeRequirements, StateDict, ) -from .arch.DITN_Real import DITN_Real as DITN +from .__arch.DITN_Real import DITN_Real as DITN class DITNArch(Architecture[DITN]): diff --git a/libs/spandrel/spandrel/architectures/DRCT/arch/LICENSE b/libs/spandrel/spandrel/architectures/DRCT/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/DRCT/arch/LICENSE rename to libs/spandrel/spandrel/architectures/DRCT/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/DRCT/arch/drct_arch.py b/libs/spandrel/spandrel/architectures/DRCT/__arch/drct_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/DRCT/arch/drct_arch.py rename to libs/spandrel/spandrel/architectures/DRCT/__arch/drct_arch.py diff --git a/libs/spandrel/spandrel/architectures/DRCT/__init__.py b/libs/spandrel/spandrel/architectures/DRCT/__init__.py index 64230dc9..64d7bae1 100644 --- a/libs/spandrel/spandrel/architectures/DRCT/__init__.py +++ b/libs/spandrel/spandrel/architectures/DRCT/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.drct_arch import DRCT +from .__arch.drct_arch import DRCT class DRCTArch(Architecture[DRCT]): diff --git a/libs/spandrel/spandrel/architectures/DRUNet/arch/LICENSE b/libs/spandrel/spandrel/architectures/DRUNet/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/DRUNet/arch/LICENSE rename to libs/spandrel/spandrel/architectures/DRUNet/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/DRUNet/arch/network_unet.py b/libs/spandrel/spandrel/architectures/DRUNet/__arch/network_unet.py similarity index 100% rename from libs/spandrel/spandrel/architectures/DRUNet/arch/network_unet.py rename to libs/spandrel/spandrel/architectures/DRUNet/__arch/network_unet.py diff --git a/libs/spandrel/spandrel/architectures/DRUNet/__init__.py b/libs/spandrel/spandrel/architectures/DRUNet/__init__.py index d036ee6b..44d47c6e 100644 --- a/libs/spandrel/spandrel/architectures/DRUNet/__init__.py +++ b/libs/spandrel/spandrel/architectures/DRUNet/__init__.py @@ -11,7 +11,7 @@ SizeRequirements, StateDict, ) -from .arch.network_unet import DRUNet +from .__arch.network_unet import DRUNet class DRUNetArch(Architecture[DRUNet]): diff --git a/libs/spandrel/spandrel/architectures/DnCNN/arch/LICENSE b/libs/spandrel/spandrel/architectures/DnCNN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/DnCNN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/DnCNN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/DnCNN/arch/network_dncnn.py b/libs/spandrel/spandrel/architectures/DnCNN/__arch/network_dncnn.py similarity index 100% rename from libs/spandrel/spandrel/architectures/DnCNN/arch/network_dncnn.py rename to libs/spandrel/spandrel/architectures/DnCNN/__arch/network_dncnn.py diff --git a/libs/spandrel/spandrel/architectures/DnCNN/__init__.py b/libs/spandrel/spandrel/architectures/DnCNN/__init__.py index 7d299666..fa62bd10 100644 --- a/libs/spandrel/spandrel/architectures/DnCNN/__init__.py +++ b/libs/spandrel/spandrel/architectures/DnCNN/__init__.py @@ -13,7 +13,7 @@ SizeRequirements, StateDict, ) -from .arch.network_dncnn import DnCNN +from .__arch.network_dncnn import DnCNN class DnCNNArch(Architecture[DnCNN]): diff --git a/libs/spandrel/spandrel/architectures/ESRGAN/arch/LICENSE b/libs/spandrel/spandrel/architectures/ESRGAN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/ESRGAN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/ESRGAN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/ESRGAN/arch/RRDB.py b/libs/spandrel/spandrel/architectures/ESRGAN/__arch/RRDB.py similarity index 100% rename from libs/spandrel/spandrel/architectures/ESRGAN/arch/RRDB.py rename to libs/spandrel/spandrel/architectures/ESRGAN/__arch/RRDB.py diff --git a/libs/spandrel/spandrel/architectures/ESRGAN/__init__.py b/libs/spandrel/spandrel/architectures/ESRGAN/__init__.py index ce68718e..bedb788f 100644 --- a/libs/spandrel/spandrel/architectures/ESRGAN/__init__.py +++ b/libs/spandrel/spandrel/architectures/ESRGAN/__init__.py @@ -15,7 +15,7 @@ SizeRequirements, StateDict, ) -from .arch.RRDB import RRDBNet +from .__arch.RRDB import RRDBNet def _new_to_old_arch(state: StateDict, state_map: dict, num_blocks: int): diff --git a/libs/spandrel/spandrel/architectures/FBCNN/arch/FBCNN.py b/libs/spandrel/spandrel/architectures/FBCNN/__arch/FBCNN.py similarity index 100% rename from libs/spandrel/spandrel/architectures/FBCNN/arch/FBCNN.py rename to libs/spandrel/spandrel/architectures/FBCNN/__arch/FBCNN.py diff --git a/libs/spandrel/spandrel/architectures/FBCNN/arch/LICENSE b/libs/spandrel/spandrel/architectures/FBCNN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/FBCNN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/FBCNN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/FBCNN/__init__.py b/libs/spandrel/spandrel/architectures/FBCNN/__init__.py index 02462a22..46f2cff4 100644 --- a/libs/spandrel/spandrel/architectures/FBCNN/__init__.py +++ b/libs/spandrel/spandrel/architectures/FBCNN/__init__.py @@ -3,7 +3,7 @@ from spandrel.util import KeyCondition, get_seq_len from ...__helpers.model_descriptor import Architecture, ImageModelDescriptor, StateDict -from .arch.FBCNN import FBCNN +from .__arch.FBCNN import FBCNN class FBCNNArch(Architecture[FBCNN]): diff --git a/libs/spandrel/spandrel/architectures/FFTformer/arch/LICENSE b/libs/spandrel/spandrel/architectures/FFTformer/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/FFTformer/arch/LICENSE rename to libs/spandrel/spandrel/architectures/FFTformer/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/FFTformer/arch/fftformer_arch.py b/libs/spandrel/spandrel/architectures/FFTformer/__arch/fftformer_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/FFTformer/arch/fftformer_arch.py rename to libs/spandrel/spandrel/architectures/FFTformer/__arch/fftformer_arch.py diff --git a/libs/spandrel/spandrel/architectures/FFTformer/__init__.py b/libs/spandrel/spandrel/architectures/FFTformer/__init__.py index 3824aade..eb69bda7 100644 --- a/libs/spandrel/spandrel/architectures/FFTformer/__init__.py +++ b/libs/spandrel/spandrel/architectures/FFTformer/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.fftformer_arch import FFTformer +from .__arch.fftformer_arch import FFTformer class FFTformerArch(Architecture[FFTformer]): diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/LICENSE b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/arcface_arch.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/arcface_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/arcface_arch.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/arcface_arch.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/fused_act.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/fused_act.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/fused_act.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/fused_act.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/gfpgan_bilinear_arch.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/gfpgan_bilinear_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/gfpgan_bilinear_arch.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/gfpgan_bilinear_arch.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/gfpganv1_arch.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/gfpganv1_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/gfpganv1_arch.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/gfpganv1_arch.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/gfpganv1_clean_arch.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/gfpganv1_clean_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/gfpganv1_clean_arch.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/gfpganv1_clean_arch.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/stylegan2_arch.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/stylegan2_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/stylegan2_arch.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/stylegan2_arch.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/stylegan2_bilinear_arch.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/stylegan2_bilinear_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/stylegan2_bilinear_arch.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/stylegan2_bilinear_arch.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/stylegan2_clean_arch.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/stylegan2_clean_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/stylegan2_clean_arch.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/stylegan2_clean_arch.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/arch/upfirdn2d.py b/libs/spandrel/spandrel/architectures/GFPGAN/__arch/upfirdn2d.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GFPGAN/arch/upfirdn2d.py rename to libs/spandrel/spandrel/architectures/GFPGAN/__arch/upfirdn2d.py diff --git a/libs/spandrel/spandrel/architectures/GFPGAN/__init__.py b/libs/spandrel/spandrel/architectures/GFPGAN/__init__.py index 557bd3f6..fa08646f 100644 --- a/libs/spandrel/spandrel/architectures/GFPGAN/__init__.py +++ b/libs/spandrel/spandrel/architectures/GFPGAN/__init__.py @@ -8,7 +8,7 @@ SizeRequirements, StateDict, ) -from .arch.gfpganv1_clean_arch import GFPGANv1Clean +from .__arch.gfpganv1_clean_arch import GFPGANv1Clean class GFPGANArch(Architecture[GFPGANv1Clean]): diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/LICENSE b/libs/spandrel/spandrel/architectures/GRL/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/LICENSE rename to libs/spandrel/spandrel/architectures/GRL/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/config.py b/libs/spandrel/spandrel/architectures/GRL/__arch/config.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/config.py rename to libs/spandrel/spandrel/architectures/GRL/__arch/config.py diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/grl.py b/libs/spandrel/spandrel/architectures/GRL/__arch/grl.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/grl.py rename to libs/spandrel/spandrel/architectures/GRL/__arch/grl.py diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/mixed_attn_block.py b/libs/spandrel/spandrel/architectures/GRL/__arch/mixed_attn_block.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/mixed_attn_block.py rename to libs/spandrel/spandrel/architectures/GRL/__arch/mixed_attn_block.py diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/mixed_attn_block_efficient.py b/libs/spandrel/spandrel/architectures/GRL/__arch/mixed_attn_block_efficient.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/mixed_attn_block_efficient.py rename to libs/spandrel/spandrel/architectures/GRL/__arch/mixed_attn_block_efficient.py diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/ops.py b/libs/spandrel/spandrel/architectures/GRL/__arch/ops.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/ops.py rename to libs/spandrel/spandrel/architectures/GRL/__arch/ops.py diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/swin_v1_block.py b/libs/spandrel/spandrel/architectures/GRL/__arch/swin_v1_block.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/swin_v1_block.py rename to libs/spandrel/spandrel/architectures/GRL/__arch/swin_v1_block.py diff --git a/libs/spandrel/spandrel/architectures/GRL/arch/upsample.py b/libs/spandrel/spandrel/architectures/GRL/__arch/upsample.py similarity index 100% rename from libs/spandrel/spandrel/architectures/GRL/arch/upsample.py rename to libs/spandrel/spandrel/architectures/GRL/__arch/upsample.py diff --git a/libs/spandrel/spandrel/architectures/GRL/__init__.py b/libs/spandrel/spandrel/architectures/GRL/__init__.py index 43dbc7e9..851be55e 100644 --- a/libs/spandrel/spandrel/architectures/GRL/__init__.py +++ b/libs/spandrel/spandrel/architectures/GRL/__init__.py @@ -15,7 +15,7 @@ from ...__helpers.canonicalize import remove_common_prefix from ...__helpers.model_descriptor import Architecture, ImageModelDescriptor, StateDict -from .arch.grl import GRL +from .__arch.grl import GRL _NON_PERSISTENT_BUFFERS = [ "table_w", diff --git a/libs/spandrel/spandrel/architectures/HAT/arch/HAT.py b/libs/spandrel/spandrel/architectures/HAT/__arch/HAT.py similarity index 100% rename from libs/spandrel/spandrel/architectures/HAT/arch/HAT.py rename to libs/spandrel/spandrel/architectures/HAT/__arch/HAT.py diff --git a/libs/spandrel/spandrel/architectures/HAT/arch/LICENSE b/libs/spandrel/spandrel/architectures/HAT/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/HAT/arch/LICENSE rename to libs/spandrel/spandrel/architectures/HAT/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/HAT/__init__.py b/libs/spandrel/spandrel/architectures/HAT/__init__.py index 3dfdb9a4..2a219d26 100644 --- a/libs/spandrel/spandrel/architectures/HAT/__init__.py +++ b/libs/spandrel/spandrel/architectures/HAT/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.HAT import HAT +from .__arch.HAT import HAT def _get_overlap_ratio(window_size: int, with_overlap: int) -> float: diff --git a/libs/spandrel/spandrel/architectures/HVICIDNet/arch/HVI_transform.py b/libs/spandrel/spandrel/architectures/HVICIDNet/__arch/HVI_transform.py similarity index 100% rename from libs/spandrel/spandrel/architectures/HVICIDNet/arch/HVI_transform.py rename to libs/spandrel/spandrel/architectures/HVICIDNet/__arch/HVI_transform.py diff --git a/libs/spandrel/spandrel/architectures/HVICIDNet/arch/LCA.py b/libs/spandrel/spandrel/architectures/HVICIDNet/__arch/LCA.py similarity index 100% rename from libs/spandrel/spandrel/architectures/HVICIDNet/arch/LCA.py rename to libs/spandrel/spandrel/architectures/HVICIDNet/__arch/LCA.py diff --git a/libs/spandrel/spandrel/architectures/HVICIDNet/arch/LICENSE b/libs/spandrel/spandrel/architectures/HVICIDNet/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/HVICIDNet/arch/LICENSE rename to libs/spandrel/spandrel/architectures/HVICIDNet/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/HVICIDNet/arch/cidnet.py b/libs/spandrel/spandrel/architectures/HVICIDNet/__arch/cidnet.py similarity index 100% rename from libs/spandrel/spandrel/architectures/HVICIDNet/arch/cidnet.py rename to libs/spandrel/spandrel/architectures/HVICIDNet/__arch/cidnet.py diff --git a/libs/spandrel/spandrel/architectures/HVICIDNet/arch/transformer_utils.py b/libs/spandrel/spandrel/architectures/HVICIDNet/__arch/transformer_utils.py similarity index 100% rename from libs/spandrel/spandrel/architectures/HVICIDNet/arch/transformer_utils.py rename to libs/spandrel/spandrel/architectures/HVICIDNet/__arch/transformer_utils.py diff --git a/libs/spandrel/spandrel/architectures/HVICIDNet/__init__.py b/libs/spandrel/spandrel/architectures/HVICIDNet/__init__.py index b880ca9d..55abcd13 100644 --- a/libs/spandrel/spandrel/architectures/HVICIDNet/__init__.py +++ b/libs/spandrel/spandrel/architectures/HVICIDNet/__init__.py @@ -9,7 +9,7 @@ SizeRequirements, StateDict, ) -from .arch.cidnet import CIDNet as HVICIDNet +from .__arch.cidnet import CIDNet as HVICIDNet class HVICIDNetArch(Architecture[HVICIDNet]): diff --git a/libs/spandrel/spandrel/architectures/IPT/arch/LICENSE b/libs/spandrel/spandrel/architectures/IPT/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/IPT/arch/LICENSE rename to libs/spandrel/spandrel/architectures/IPT/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/IPT/arch/common.py b/libs/spandrel/spandrel/architectures/IPT/__arch/common.py similarity index 100% rename from libs/spandrel/spandrel/architectures/IPT/arch/common.py rename to libs/spandrel/spandrel/architectures/IPT/__arch/common.py diff --git a/libs/spandrel/spandrel/architectures/IPT/arch/ipt.py b/libs/spandrel/spandrel/architectures/IPT/__arch/ipt.py similarity index 100% rename from libs/spandrel/spandrel/architectures/IPT/arch/ipt.py rename to libs/spandrel/spandrel/architectures/IPT/__arch/ipt.py diff --git a/libs/spandrel/spandrel/architectures/IPT/arch/model.py b/libs/spandrel/spandrel/architectures/IPT/__arch/model.py similarity index 100% rename from libs/spandrel/spandrel/architectures/IPT/arch/model.py rename to libs/spandrel/spandrel/architectures/IPT/__arch/model.py diff --git a/libs/spandrel/spandrel/architectures/IPT/__init__.py b/libs/spandrel/spandrel/architectures/IPT/__init__.py index 54c5761c..aa511863 100644 --- a/libs/spandrel/spandrel/architectures/IPT/__init__.py +++ b/libs/spandrel/spandrel/architectures/IPT/__init__.py @@ -14,8 +14,8 @@ SizeRequirements, StateDict, ) -from .arch.ipt import IPT -from .arch.model import Model +from .__arch.ipt import IPT +from .__arch.model import Model class IPTArch(Architecture[IPT]): diff --git a/libs/spandrel/spandrel/architectures/KBNet/arch/LICENSE b/libs/spandrel/spandrel/architectures/KBNet/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/KBNet/arch/LICENSE rename to libs/spandrel/spandrel/architectures/KBNet/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/KBNet/arch/kb_utils.py b/libs/spandrel/spandrel/architectures/KBNet/__arch/kb_utils.py similarity index 100% rename from libs/spandrel/spandrel/architectures/KBNet/arch/kb_utils.py rename to libs/spandrel/spandrel/architectures/KBNet/__arch/kb_utils.py diff --git a/libs/spandrel/spandrel/architectures/KBNet/arch/kbnet_l.py b/libs/spandrel/spandrel/architectures/KBNet/__arch/kbnet_l.py similarity index 100% rename from libs/spandrel/spandrel/architectures/KBNet/arch/kbnet_l.py rename to libs/spandrel/spandrel/architectures/KBNet/__arch/kbnet_l.py diff --git a/libs/spandrel/spandrel/architectures/KBNet/arch/kbnet_s.py b/libs/spandrel/spandrel/architectures/KBNet/__arch/kbnet_s.py similarity index 100% rename from libs/spandrel/spandrel/architectures/KBNet/arch/kbnet_s.py rename to libs/spandrel/spandrel/architectures/KBNet/__arch/kbnet_s.py diff --git a/libs/spandrel/spandrel/architectures/KBNet/__init__.py b/libs/spandrel/spandrel/architectures/KBNet/__init__.py index ce10310e..9a574a5f 100644 --- a/libs/spandrel/spandrel/architectures/KBNet/__init__.py +++ b/libs/spandrel/spandrel/architectures/KBNet/__init__.py @@ -12,8 +12,8 @@ SizeRequirements, StateDict, ) -from .arch.kbnet_l import KBNet_l -from .arch.kbnet_s import KBNet_s +from .__arch.kbnet_l import KBNet_l +from .__arch.kbnet_s import KBNet_s # KBCNN is essentially 2 similar but different architectures: KBNet_l and KBNet_s. _KBNet = Union[KBNet_l, KBNet_s] diff --git a/libs/spandrel/spandrel/architectures/LaMa/arch/LICENSE b/libs/spandrel/spandrel/architectures/LaMa/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/LaMa/arch/LICENSE rename to libs/spandrel/spandrel/architectures/LaMa/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/LaMa/arch/LaMa.py b/libs/spandrel/spandrel/architectures/LaMa/__arch/LaMa.py similarity index 100% rename from libs/spandrel/spandrel/architectures/LaMa/arch/LaMa.py rename to libs/spandrel/spandrel/architectures/LaMa/__arch/LaMa.py diff --git a/libs/spandrel/spandrel/architectures/LaMa/__init__.py b/libs/spandrel/spandrel/architectures/LaMa/__init__.py index 5254ac8c..b3008936 100644 --- a/libs/spandrel/spandrel/architectures/LaMa/__init__.py +++ b/libs/spandrel/spandrel/architectures/LaMa/__init__.py @@ -8,7 +8,7 @@ SizeRequirements, StateDict, ) -from .arch.LaMa import LaMa +from .__arch.LaMa import LaMa class LaMaArch(Architecture[LaMa]): diff --git a/libs/spandrel/spandrel/architectures/MMRealSR/arch/LICENSE b/libs/spandrel/spandrel/architectures/MMRealSR/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/MMRealSR/arch/LICENSE rename to libs/spandrel/spandrel/architectures/MMRealSR/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/MMRealSR/arch/mmrealsr_arch.py b/libs/spandrel/spandrel/architectures/MMRealSR/__arch/mmrealsr_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/MMRealSR/arch/mmrealsr_arch.py rename to libs/spandrel/spandrel/architectures/MMRealSR/__arch/mmrealsr_arch.py diff --git a/libs/spandrel/spandrel/architectures/MMRealSR/__init__.py b/libs/spandrel/spandrel/architectures/MMRealSR/__init__.py index a266cbe4..ca519a75 100644 --- a/libs/spandrel/spandrel/architectures/MMRealSR/__init__.py +++ b/libs/spandrel/spandrel/architectures/MMRealSR/__init__.py @@ -12,7 +12,7 @@ SizeRequirements, StateDict, ) -from .arch.mmrealsr_arch import MMRRDBNet_test as MMRealSR +from .__arch.mmrealsr_arch import MMRRDBNet_test as MMRealSR def _get_in_ch_and_scale(combined: int, num_out_ch: int) -> tuple[int, int]: diff --git a/libs/spandrel/spandrel/architectures/MixDehazeNet/arch/LICENSE b/libs/spandrel/spandrel/architectures/MixDehazeNet/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/MixDehazeNet/arch/LICENSE rename to libs/spandrel/spandrel/architectures/MixDehazeNet/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/MixDehazeNet/arch/MixDehazeNet.py b/libs/spandrel/spandrel/architectures/MixDehazeNet/__arch/MixDehazeNet.py similarity index 100% rename from libs/spandrel/spandrel/architectures/MixDehazeNet/arch/MixDehazeNet.py rename to libs/spandrel/spandrel/architectures/MixDehazeNet/__arch/MixDehazeNet.py diff --git a/libs/spandrel/spandrel/architectures/MixDehazeNet/__init__.py b/libs/spandrel/spandrel/architectures/MixDehazeNet/__init__.py index f6742df0..601314d3 100644 --- a/libs/spandrel/spandrel/architectures/MixDehazeNet/__init__.py +++ b/libs/spandrel/spandrel/architectures/MixDehazeNet/__init__.py @@ -11,7 +11,7 @@ SizeRequirements, StateDict, ) -from .arch.MixDehazeNet import MixDehazeNet +from .__arch.MixDehazeNet import MixDehazeNet class MixDehazeNetArch(Architecture[MixDehazeNet]): diff --git a/libs/spandrel/spandrel/architectures/NAFNet/arch/LICENSE b/libs/spandrel/spandrel/architectures/NAFNet/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/NAFNet/arch/LICENSE rename to libs/spandrel/spandrel/architectures/NAFNet/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/NAFNet/arch/NAFNet_arch.py b/libs/spandrel/spandrel/architectures/NAFNet/__arch/NAFNet_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/NAFNet/arch/NAFNet_arch.py rename to libs/spandrel/spandrel/architectures/NAFNet/__arch/NAFNet_arch.py diff --git a/libs/spandrel/spandrel/architectures/NAFNet/arch/arch_util.py b/libs/spandrel/spandrel/architectures/NAFNet/__arch/arch_util.py similarity index 100% rename from libs/spandrel/spandrel/architectures/NAFNet/arch/arch_util.py rename to libs/spandrel/spandrel/architectures/NAFNet/__arch/arch_util.py diff --git a/libs/spandrel/spandrel/architectures/NAFNet/__init__.py b/libs/spandrel/spandrel/architectures/NAFNet/__init__.py index b65c6aa0..c9aae804 100644 --- a/libs/spandrel/spandrel/architectures/NAFNet/__init__.py +++ b/libs/spandrel/spandrel/architectures/NAFNet/__init__.py @@ -5,7 +5,7 @@ from spandrel.util import KeyCondition, get_seq_len from ...__helpers.model_descriptor import Architecture, ImageModelDescriptor, StateDict -from .arch.NAFNet_arch import NAFNet +from .__arch.NAFNet_arch import NAFNet class NAFNetArch(Architecture[NAFNet]): diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/ChannelAttention.py b/libs/spandrel/spandrel/architectures/OmniSR/__arch/ChannelAttention.py similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/ChannelAttention.py rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/ChannelAttention.py diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/LICENSE b/libs/spandrel/spandrel/architectures/OmniSR/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/LICENSE rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/OSA.py b/libs/spandrel/spandrel/architectures/OmniSR/__arch/OSA.py similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/OSA.py rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/OSA.py diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/OSAG.py b/libs/spandrel/spandrel/architectures/OmniSR/__arch/OSAG.py similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/OSAG.py rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/OSAG.py diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/OmniSR.py b/libs/spandrel/spandrel/architectures/OmniSR/__arch/OmniSR.py similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/OmniSR.py rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/OmniSR.py diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/esa.py b/libs/spandrel/spandrel/architectures/OmniSR/__arch/esa.py similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/esa.py rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/esa.py diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/layernorm.py b/libs/spandrel/spandrel/architectures/OmniSR/__arch/layernorm.py similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/layernorm.py rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/layernorm.py diff --git a/libs/spandrel/spandrel/architectures/OmniSR/arch/pixelshuffle.py b/libs/spandrel/spandrel/architectures/OmniSR/__arch/pixelshuffle.py similarity index 100% rename from libs/spandrel/spandrel/architectures/OmniSR/arch/pixelshuffle.py rename to libs/spandrel/spandrel/architectures/OmniSR/__arch/pixelshuffle.py diff --git a/libs/spandrel/spandrel/architectures/OmniSR/__init__.py b/libs/spandrel/spandrel/architectures/OmniSR/__init__.py index 50cd037e..97904a86 100644 --- a/libs/spandrel/spandrel/architectures/OmniSR/__init__.py +++ b/libs/spandrel/spandrel/architectures/OmniSR/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.OmniSR import OmniSR +from .__arch.OmniSR import OmniSR class OmniSRArch(Architecture[OmniSR]): diff --git a/libs/spandrel/spandrel/architectures/PLKSR/arch/LICENSE b/libs/spandrel/spandrel/architectures/PLKSR/__arch/LICENSE similarity index 98% rename from libs/spandrel/spandrel/architectures/PLKSR/arch/LICENSE rename to libs/spandrel/spandrel/architectures/PLKSR/__arch/LICENSE index bf3ea526..21c76744 100644 --- a/libs/spandrel/spandrel/architectures/PLKSR/arch/LICENSE +++ b/libs/spandrel/spandrel/architectures/PLKSR/__arch/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2024 Dongheon Lee - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2024 Dongheon Lee + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/libs/spandrel/spandrel/architectures/PLKSR/arch/PLKSR.py b/libs/spandrel/spandrel/architectures/PLKSR/__arch/PLKSR.py similarity index 96% rename from libs/spandrel/spandrel/architectures/PLKSR/arch/PLKSR.py rename to libs/spandrel/spandrel/architectures/PLKSR/__arch/PLKSR.py index 1cf3c8bc..593871a1 100644 --- a/libs/spandrel/spandrel/architectures/PLKSR/arch/PLKSR.py +++ b/libs/spandrel/spandrel/architectures/PLKSR/__arch/PLKSR.py @@ -1,345 +1,345 @@ -from functools import partial -from typing import Literal, Sequence - -import torch -import torch.nn as nn -import torch.nn.functional as F -from torch.nn.init import trunc_normal_ - -from spandrel.util import store_hyperparameters - - -# Since Pytorch's interleave is not supported by CoreML, we use this function instead for mobile conversion -def repeat_interleave(x, n): - x = x.unsqueeze(2) - x = x.repeat(1, 1, n, 1, 1) - x = x.reshape(x.shape[0], x.shape[1] * n, x.shape[3], x.shape[4]) - return x - - -class CCM(nn.Sequential): - "Convolutional Channel Mixer" - - def __init__(self, dim: int): - super().__init__( - nn.Conv2d(dim, dim * 2, 3, 1, 1), - nn.GELU(), - nn.Conv2d(dim * 2, dim, 1, 1, 0), - ) - trunc_normal_(self[-1].weight, std=0.02) - - -class ICCM(nn.Sequential): - "Inverted Convolutional Channel Mixer" - - def __init__(self, dim: int): - super().__init__( - nn.Conv2d(dim, dim * 2, 1, 1, 0), - nn.GELU(), - nn.Conv2d(dim * 2, dim, 3, 1, 1), - ) - trunc_normal_(self[-1].weight, std=0.02) - - -class DCCM(nn.Sequential): - "Doubled Convolutional Channel Mixer" - - def __init__(self, dim: int): - super().__init__( - nn.Conv2d(dim, dim * 2, 3, 1, 1), - nn.GELU(), - nn.Conv2d(dim * 2, dim, 3, 1, 1), - ) - trunc_normal_(self[-1].weight, std=0.02) - - -class PLKConv2d(nn.Module): - "Partial Large Kernel Convolutional Layer" - - def __init__(self, dim, kernel_size, with_idt): - super().__init__() - self.with_idt = with_idt - self.conv = nn.Conv2d(dim, dim, kernel_size, 1, kernel_size // 2) - trunc_normal_(self.conv.weight, std=0.02) - self.idx = dim - - def forward(self, x: torch.Tensor) -> torch.Tensor: - if self.training: - x1, x2 = torch.split(x, [self.idx, x.size(1) - self.idx], dim=1) - if self.with_idt: - x1 = self.conv(x1) + x1 - else: - x1 = self.conv(x1) - return torch.cat([x1, x2], dim=1) - else: - if self.with_idt: - x[:, : self.idx] = x[:, : self.idx] + self.conv(x[:, : self.idx]) - else: - x[:, : self.idx] = self.conv(x[:, : self.idx]) - return x - - -class RectSparsePLKConv2d(nn.Module): - "Rectangular Sparse Partial Large Kernel Convolutional Layer (SLaK style)" - - def __init__(self, dim, kernel_size): - super().__init__() - self.idx = dim - m = kernel_size - n = kernel_size // 3 - self.mn_conv = nn.Conv2d(dim, dim, (m, n), 1, (m // 2, n // 2)) - self.nm_conv = nn.Conv2d(dim, dim, (n, m), 1, (n // 2, m // 2)) - self.nn_conv = nn.Conv2d(dim, dim, (n, n), 1, (n // 2, n // 2)) - - trunc_normal_(self.mn_conv.weight, std=0.02) - trunc_normal_(self.nm_conv.weight, std=0.02) - trunc_normal_(self.nn_conv.weight, std=0.02) - - def forward( - self, x: torch.Tensor - ) -> torch.Tensor: # No reparametrization since this is for a ablative study - if self.training: - x1, x2 = x[:, : self.idx], x[:, self.idx :] - x1 = self.mn_conv(x1) + self.nm_conv(x1) + self.nn_conv(x1) - return torch.cat([x1, x2], dim=1) - - else: - x[:, : self.idx] = ( - self.mn_conv(x[:, : self.idx]) - + self.nm_conv(x[:, : self.idx]) - + self.nn_conv(x[:, : self.idx]) - ) - return x - - -class SparsePLKConv2d(nn.Module): - "Sparse Partial Large Kernel Convolutional Layer (RepLKNet and UniRepLKNet style)" - - def __init__( - self, - dim, - max_kernel_size, - sub_kernel_sizes, - dilations, - use_max_kernel, - with_idt, - ): - super().__init__() - self.use_max_kernel = use_max_kernel - self.max_kernel_size = max_kernel_size - for k, d in zip(sub_kernel_sizes, dilations): - m_k = self._calc_rep_kernel_size(k, d) - if m_k > self.max_kernel_size: - self.max_kernel_size = m_k - self.with_idt = with_idt - - convs = [ - nn.Conv2d( - dim, dim, sub_kernel_size, 1, (sub_kernel_size // 2) * d, dilation=d - ) - for sub_kernel_size, d in zip(sub_kernel_sizes, dilations) - ] - if use_max_kernel: - convs.append( - nn.Conv2d(dim, dim, self.max_kernel_size, 1, self.max_kernel_size // 2) - ) - self.convs = nn.ModuleList(convs) - for m in self.convs: - trunc_normal_(m.weight, std=0.02) - self.idx = dim - self.is_convert = False - - def forward(self, x: torch.Tensor) -> torch.Tensor: - if self.is_convert: - x[:, : self.idx, :, :] = self.conv(x[:, : self.idx, :, :]) - return x - else: - x1, x2 = torch.split(x, [self.idx, x.size(1) - self.idx], dim=1) - if self.with_idt: - out = x1 - else: - out = 0.0 - for conv in self.convs: - out = out + conv(x1) - return torch.cat([out, x2], dim=1) # type: ignore - - @staticmethod - def _calc_rep_kernel_size(ks, dilation): - return (ks - 1) * dilation + 1 - - @staticmethod - def _get_origin_kernel(kernel, dilation=1, p=0): - I = torch.ones((1, 1, 1, 1)).to(kernel.device) # noqa: E741 - if kernel.size(1) == 1: # Depth-wise Convolution - dilated = F.conv_transpose2d(kernel, I, stride=dilation) - else: - slices = [] # Dense or Group - for i in range(kernel.size(1)): - dilated = F.conv_transpose2d( - kernel[:, i : i + 1, :, :], I, stride=dilation - ) - slices.append(dilated) - dilated = torch.cat(slices, dim=1) - - # Pad boundary - if p != 0: - dilated = F.pad(dilated, (p, p, p, p)) - return dilated - - @staticmethod - def _dwc_to_dense(kernel): - n_groups = kernel.size(0) - - kernels = [] - for g in range(n_groups): - kernels.append( - torch.cat( - [ - kernel[g : (g + 1)] - if g == i - else torch.zeros_like(kernel[g : (g + 1)]) - for i in range(n_groups) - ], - dim=1, - ) - ) - return torch.cat(kernels, dim=0) - - -class EA(nn.Module): - "Element-wise Attention" - - def __init__(self, dim: int): - super().__init__() - self.f = nn.Sequential(nn.Conv2d(dim, dim, 3, 1, 1), nn.Sigmoid()) - trunc_normal_(self.f[0].weight, std=0.02) - - def forward(self, x: torch.Tensor) -> torch.Tensor: - return x * self.f(x) - - -class PLKBlock(nn.Module): - def __init__( - self, - dim: int, - # CCM Rep options - ccm_type: Literal["CCM", "ICCM", "DCCM"], - # LK Options - max_kernel_size: int, - split_ratio: float, - lk_type: Literal["PLK", "SparsePLK", "RectSparsePLK"] = "PLK", - # Sparse Rep options - use_max_kernel: bool = False, - sparse_kernels: Sequence[int] = [5, 5, 5], - sparse_dilations: Sequence[int] = [2, 3, 4], - with_idt: bool = False, - # EA ablation - use_ea: bool = True, - ): - super().__init__() - - # Local Texture - if ccm_type == "CCM": - self.channe_mixer = CCM(dim) - elif ccm_type == "ICCM": - self.channe_mixer = ICCM(dim) - elif ccm_type == "DCCM": - self.channe_mixer = DCCM(dim) - else: - raise ValueError(f"Unknown CCM type: {ccm_type}") - - # Long-range Dependency - pdim = int(dim * split_ratio) - if lk_type == "PLK": - self.lk = PLKConv2d(pdim, max_kernel_size, with_idt) - elif lk_type == "SparsePLK": - self.lk = SparsePLKConv2d( - pdim, - max_kernel_size, - sparse_kernels, - sparse_dilations, - use_max_kernel, - with_idt, - ) - elif lk_type == "RectSparsePLK": - self.lk = RectSparsePLKConv2d(pdim, max_kernel_size) - else: - raise ValueError(f"Unknown LK type: {lk_type}") - - # Instance-dependent modulation - if use_ea: - self.attn = EA(dim) - else: - self.attn = nn.Identity() - - # Refinement - self.refine = nn.Conv2d(dim, dim, 1, 1, 0) - trunc_normal_(self.refine.weight, std=0.02) - - def forward(self, x: torch.Tensor) -> torch.Tensor: - x_skip = x - x = self.channe_mixer(x) - x = self.lk(x) - x = self.attn(x) - x = self.refine(x) - return x + x_skip - - -@store_hyperparameters() -class PLKSR(nn.Module): - hyperparameters = {} - - def __init__( - self, - *, - dim: int = 64, - n_blocks: int = 28, - upscaling_factor: int = 4, - # CCM options - ccm_type: Literal["CCM", "ICCM", "DCCM"] = "CCM", - # LK Options - kernel_size: int = 17, - split_ratio: float = 0.25, - lk_type: Literal["PLK", "SparsePLK", "RectSparsePLK"] = "PLK", - # LK Rep options - use_max_kernel: bool = False, - sparse_kernels: Sequence[int] = [5, 5, 5, 5], - sparse_dilations: Sequence[int] = [1, 2, 3, 4], - with_idt: bool = False, - # EA ablation - use_ea: bool = True, - ): - super().__init__() - - self.feats = nn.Sequential( - *[nn.Conv2d(3, dim, 3, 1, 1)] - + [ - PLKBlock( - dim, - ccm_type, - kernel_size, - split_ratio, - lk_type, - use_max_kernel, - sparse_kernels, - sparse_dilations, - with_idt, - use_ea, - ) - for _ in range(n_blocks) - ] - + [nn.Conv2d(dim, 3 * upscaling_factor**2, 3, 1, 1)] - ) - trunc_normal_(self.feats[0].weight, std=0.02) - trunc_normal_(self.feats[-1].weight, std=0.02) - - self.to_img = nn.PixelShuffle(upscaling_factor) - - self.repeat_op = partial( - torch.repeat_interleave, repeats=upscaling_factor**2, dim=1 - ) - - def forward(self, x: torch.Tensor) -> torch.Tensor: - x = self.feats(x) + self.repeat_op(x) - x = self.to_img(x) - return x +from functools import partial +from typing import Literal, Sequence + +import torch +import torch.nn as nn +import torch.nn.functional as F +from torch.nn.init import trunc_normal_ + +from spandrel.util import store_hyperparameters + + +# Since Pytorch's interleave is not supported by CoreML, we use this function instead for mobile conversion +def repeat_interleave(x, n): + x = x.unsqueeze(2) + x = x.repeat(1, 1, n, 1, 1) + x = x.reshape(x.shape[0], x.shape[1] * n, x.shape[3], x.shape[4]) + return x + + +class CCM(nn.Sequential): + "Convolutional Channel Mixer" + + def __init__(self, dim: int): + super().__init__( + nn.Conv2d(dim, dim * 2, 3, 1, 1), + nn.GELU(), + nn.Conv2d(dim * 2, dim, 1, 1, 0), + ) + trunc_normal_(self[-1].weight, std=0.02) + + +class ICCM(nn.Sequential): + "Inverted Convolutional Channel Mixer" + + def __init__(self, dim: int): + super().__init__( + nn.Conv2d(dim, dim * 2, 1, 1, 0), + nn.GELU(), + nn.Conv2d(dim * 2, dim, 3, 1, 1), + ) + trunc_normal_(self[-1].weight, std=0.02) + + +class DCCM(nn.Sequential): + "Doubled Convolutional Channel Mixer" + + def __init__(self, dim: int): + super().__init__( + nn.Conv2d(dim, dim * 2, 3, 1, 1), + nn.GELU(), + nn.Conv2d(dim * 2, dim, 3, 1, 1), + ) + trunc_normal_(self[-1].weight, std=0.02) + + +class PLKConv2d(nn.Module): + "Partial Large Kernel Convolutional Layer" + + def __init__(self, dim, kernel_size, with_idt): + super().__init__() + self.with_idt = with_idt + self.conv = nn.Conv2d(dim, dim, kernel_size, 1, kernel_size // 2) + trunc_normal_(self.conv.weight, std=0.02) + self.idx = dim + + def forward(self, x: torch.Tensor) -> torch.Tensor: + if self.training: + x1, x2 = torch.split(x, [self.idx, x.size(1) - self.idx], dim=1) + if self.with_idt: + x1 = self.conv(x1) + x1 + else: + x1 = self.conv(x1) + return torch.cat([x1, x2], dim=1) + else: + if self.with_idt: + x[:, : self.idx] = x[:, : self.idx] + self.conv(x[:, : self.idx]) + else: + x[:, : self.idx] = self.conv(x[:, : self.idx]) + return x + + +class RectSparsePLKConv2d(nn.Module): + "Rectangular Sparse Partial Large Kernel Convolutional Layer (SLaK style)" + + def __init__(self, dim, kernel_size): + super().__init__() + self.idx = dim + m = kernel_size + n = kernel_size // 3 + self.mn_conv = nn.Conv2d(dim, dim, (m, n), 1, (m // 2, n // 2)) + self.nm_conv = nn.Conv2d(dim, dim, (n, m), 1, (n // 2, m // 2)) + self.nn_conv = nn.Conv2d(dim, dim, (n, n), 1, (n // 2, n // 2)) + + trunc_normal_(self.mn_conv.weight, std=0.02) + trunc_normal_(self.nm_conv.weight, std=0.02) + trunc_normal_(self.nn_conv.weight, std=0.02) + + def forward( + self, x: torch.Tensor + ) -> torch.Tensor: # No reparametrization since this is for a ablative study + if self.training: + x1, x2 = x[:, : self.idx], x[:, self.idx :] + x1 = self.mn_conv(x1) + self.nm_conv(x1) + self.nn_conv(x1) + return torch.cat([x1, x2], dim=1) + + else: + x[:, : self.idx] = ( + self.mn_conv(x[:, : self.idx]) + + self.nm_conv(x[:, : self.idx]) + + self.nn_conv(x[:, : self.idx]) + ) + return x + + +class SparsePLKConv2d(nn.Module): + "Sparse Partial Large Kernel Convolutional Layer (RepLKNet and UniRepLKNet style)" + + def __init__( + self, + dim, + max_kernel_size, + sub_kernel_sizes, + dilations, + use_max_kernel, + with_idt, + ): + super().__init__() + self.use_max_kernel = use_max_kernel + self.max_kernel_size = max_kernel_size + for k, d in zip(sub_kernel_sizes, dilations): + m_k = self._calc_rep_kernel_size(k, d) + if m_k > self.max_kernel_size: + self.max_kernel_size = m_k + self.with_idt = with_idt + + convs = [ + nn.Conv2d( + dim, dim, sub_kernel_size, 1, (sub_kernel_size // 2) * d, dilation=d + ) + for sub_kernel_size, d in zip(sub_kernel_sizes, dilations) + ] + if use_max_kernel: + convs.append( + nn.Conv2d(dim, dim, self.max_kernel_size, 1, self.max_kernel_size // 2) + ) + self.convs = nn.ModuleList(convs) + for m in self.convs: + trunc_normal_(m.weight, std=0.02) + self.idx = dim + self.is_convert = False + + def forward(self, x: torch.Tensor) -> torch.Tensor: + if self.is_convert: + x[:, : self.idx, :, :] = self.conv(x[:, : self.idx, :, :]) + return x + else: + x1, x2 = torch.split(x, [self.idx, x.size(1) - self.idx], dim=1) + if self.with_idt: + out = x1 + else: + out = 0.0 + for conv in self.convs: + out = out + conv(x1) + return torch.cat([out, x2], dim=1) # type: ignore + + @staticmethod + def _calc_rep_kernel_size(ks, dilation): + return (ks - 1) * dilation + 1 + + @staticmethod + def _get_origin_kernel(kernel, dilation=1, p=0): + I = torch.ones((1, 1, 1, 1)).to(kernel.device) # noqa: E741 + if kernel.size(1) == 1: # Depth-wise Convolution + dilated = F.conv_transpose2d(kernel, I, stride=dilation) + else: + slices = [] # Dense or Group + for i in range(kernel.size(1)): + dilated = F.conv_transpose2d( + kernel[:, i : i + 1, :, :], I, stride=dilation + ) + slices.append(dilated) + dilated = torch.cat(slices, dim=1) + + # Pad boundary + if p != 0: + dilated = F.pad(dilated, (p, p, p, p)) + return dilated + + @staticmethod + def _dwc_to_dense(kernel): + n_groups = kernel.size(0) + + kernels = [] + for g in range(n_groups): + kernels.append( + torch.cat( + [ + kernel[g : (g + 1)] + if g == i + else torch.zeros_like(kernel[g : (g + 1)]) + for i in range(n_groups) + ], + dim=1, + ) + ) + return torch.cat(kernels, dim=0) + + +class EA(nn.Module): + "Element-wise Attention" + + def __init__(self, dim: int): + super().__init__() + self.f = nn.Sequential(nn.Conv2d(dim, dim, 3, 1, 1), nn.Sigmoid()) + trunc_normal_(self.f[0].weight, std=0.02) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return x * self.f(x) + + +class PLKBlock(nn.Module): + def __init__( + self, + dim: int, + # CCM Rep options + ccm_type: Literal["CCM", "ICCM", "DCCM"], + # LK Options + max_kernel_size: int, + split_ratio: float, + lk_type: Literal["PLK", "SparsePLK", "RectSparsePLK"] = "PLK", + # Sparse Rep options + use_max_kernel: bool = False, + sparse_kernels: Sequence[int] = [5, 5, 5], + sparse_dilations: Sequence[int] = [2, 3, 4], + with_idt: bool = False, + # EA ablation + use_ea: bool = True, + ): + super().__init__() + + # Local Texture + if ccm_type == "CCM": + self.channe_mixer = CCM(dim) + elif ccm_type == "ICCM": + self.channe_mixer = ICCM(dim) + elif ccm_type == "DCCM": + self.channe_mixer = DCCM(dim) + else: + raise ValueError(f"Unknown CCM type: {ccm_type}") + + # Long-range Dependency + pdim = int(dim * split_ratio) + if lk_type == "PLK": + self.lk = PLKConv2d(pdim, max_kernel_size, with_idt) + elif lk_type == "SparsePLK": + self.lk = SparsePLKConv2d( + pdim, + max_kernel_size, + sparse_kernels, + sparse_dilations, + use_max_kernel, + with_idt, + ) + elif lk_type == "RectSparsePLK": + self.lk = RectSparsePLKConv2d(pdim, max_kernel_size) + else: + raise ValueError(f"Unknown LK type: {lk_type}") + + # Instance-dependent modulation + if use_ea: + self.attn = EA(dim) + else: + self.attn = nn.Identity() + + # Refinement + self.refine = nn.Conv2d(dim, dim, 1, 1, 0) + trunc_normal_(self.refine.weight, std=0.02) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x_skip = x + x = self.channe_mixer(x) + x = self.lk(x) + x = self.attn(x) + x = self.refine(x) + return x + x_skip + + +@store_hyperparameters() +class PLKSR(nn.Module): + hyperparameters = {} + + def __init__( + self, + *, + dim: int = 64, + n_blocks: int = 28, + upscaling_factor: int = 4, + # CCM options + ccm_type: Literal["CCM", "ICCM", "DCCM"] = "CCM", + # LK Options + kernel_size: int = 17, + split_ratio: float = 0.25, + lk_type: Literal["PLK", "SparsePLK", "RectSparsePLK"] = "PLK", + # LK Rep options + use_max_kernel: bool = False, + sparse_kernels: Sequence[int] = [5, 5, 5, 5], + sparse_dilations: Sequence[int] = [1, 2, 3, 4], + with_idt: bool = False, + # EA ablation + use_ea: bool = True, + ): + super().__init__() + + self.feats = nn.Sequential( + *[nn.Conv2d(3, dim, 3, 1, 1)] + + [ + PLKBlock( + dim, + ccm_type, + kernel_size, + split_ratio, + lk_type, + use_max_kernel, + sparse_kernels, + sparse_dilations, + with_idt, + use_ea, + ) + for _ in range(n_blocks) + ] + + [nn.Conv2d(dim, 3 * upscaling_factor**2, 3, 1, 1)] + ) + trunc_normal_(self.feats[0].weight, std=0.02) + trunc_normal_(self.feats[-1].weight, std=0.02) + + self.to_img = nn.PixelShuffle(upscaling_factor) + + self.repeat_op = partial( + torch.repeat_interleave, repeats=upscaling_factor**2, dim=1 + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = self.feats(x) + self.repeat_op(x) + x = self.to_img(x) + return x diff --git a/libs/spandrel/spandrel/architectures/PLKSR/arch/RealPLKSR.py b/libs/spandrel/spandrel/architectures/PLKSR/__arch/RealPLKSR.py similarity index 96% rename from libs/spandrel/spandrel/architectures/PLKSR/arch/RealPLKSR.py rename to libs/spandrel/spandrel/architectures/PLKSR/__arch/RealPLKSR.py index 86c4b170..4951ef95 100644 --- a/libs/spandrel/spandrel/architectures/PLKSR/arch/RealPLKSR.py +++ b/libs/spandrel/spandrel/architectures/PLKSR/__arch/RealPLKSR.py @@ -1,141 +1,141 @@ -from functools import partial - -import torch -from torch import nn -from torch.nn.init import trunc_normal_ - -from spandrel.util import store_hyperparameters - - -class DCCM(nn.Sequential): - "Doubled Convolutional Channel Mixer" - - def __init__(self, dim: int): - super().__init__( - nn.Conv2d(dim, dim * 2, 3, 1, 1), - nn.Mish(), - nn.Conv2d(dim * 2, dim, 3, 1, 1), - ) - trunc_normal_(self[-1].weight, std=0.02) - - -class PLKConv2d(nn.Module): - "Partial Large Kernel Convolutional Layer" - - def __init__(self, dim: int, kernel_size: int): - super().__init__() - self.conv = nn.Conv2d(dim, dim, kernel_size, 1, kernel_size // 2) - trunc_normal_(self.conv.weight, std=0.02) - self.idx = dim - - def forward(self, x: torch.Tensor) -> torch.Tensor: - if self.training: - x1, x2 = torch.split(x, [self.idx, x.size(1) - self.idx], dim=1) - x1 = self.conv(x1) - return torch.cat([x1, x2], dim=1) - x[:, : self.idx] = self.conv(x[:, : self.idx]) - return x - - -class EA(nn.Module): - "Element-wise Attention" - - def __init__(self, dim: int): - super().__init__() - self.f = nn.Sequential(nn.Conv2d(dim, dim, 3, 1, 1), nn.Sigmoid()) - trunc_normal_(self.f[0].weight, std=0.02) - - def forward(self, x: torch.Tensor) -> torch.Tensor: - return x * self.f(x) - - -class PLKBlock(nn.Module): - def __init__( - self, - dim: int, - kernel_size: int, - split_ratio: float, - norm_groups: int, - use_ea: bool = True, - ): - super().__init__() - - # Local Texture - self.channel_mixer = DCCM(dim) - - # Long-range Dependency - pdim = int(dim * split_ratio) - - # Conv Layer - self.lk = PLKConv2d(pdim, kernel_size) - - # Instance-dependent modulation - if use_ea: - self.attn = EA(dim) - else: - self.attn = nn.Identity() - - # Refinement - self.refine = nn.Conv2d(dim, dim, 1, 1, 0) - trunc_normal_(self.refine.weight, std=0.02) - - # Group Normalization - self.norm = nn.GroupNorm(norm_groups, dim) - - def forward(self, x: torch.Tensor) -> torch.Tensor: - x_skip = x - x = self.channel_mixer(x) - x = self.lk(x) - x = self.attn(x) - x = self.refine(x) - x = self.norm(x) - - return x + x_skip - - -@store_hyperparameters() -class RealPLKSR(nn.Module): - """Partial Large Kernel CNNs for Efficient Super-Resolution: - https://arxiv.org/abs/2404.11848 - """ - - hyperparameters = {} - - def __init__( - self, - *, - dim: int = 64, - n_blocks: int = 28, - upscaling_factor: int = 4, - kernel_size: int = 17, - split_ratio: float = 0.25, - use_ea: bool = True, - norm_groups: int = 4, - dropout: float = 0, - ): - super().__init__() - - if not self.training: - dropout = 0 - - self.feats = nn.Sequential( - *[nn.Conv2d(3, dim, 3, 1, 1)] - + [ - PLKBlock(dim, kernel_size, split_ratio, norm_groups, use_ea) - for _ in range(n_blocks) - ] - + [nn.Dropout2d(dropout)] - + [nn.Conv2d(dim, 3 * upscaling_factor**2, 3, 1, 1)] - ) - trunc_normal_(self.feats[0].weight, std=0.02) - trunc_normal_(self.feats[-1].weight, std=0.02) - - self.repeat_op = partial( - torch.repeat_interleave, repeats=upscaling_factor**2, dim=1 - ) - - self.to_img = nn.PixelShuffle(upscaling_factor) - - def forward(self, x: torch.Tensor) -> torch.Tensor: - x = self.feats(x) + self.repeat_op(x) - return self.to_img(x) +from functools import partial + +import torch +from torch import nn +from torch.nn.init import trunc_normal_ + +from spandrel.util import store_hyperparameters + + +class DCCM(nn.Sequential): + "Doubled Convolutional Channel Mixer" + + def __init__(self, dim: int): + super().__init__( + nn.Conv2d(dim, dim * 2, 3, 1, 1), + nn.Mish(), + nn.Conv2d(dim * 2, dim, 3, 1, 1), + ) + trunc_normal_(self[-1].weight, std=0.02) + + +class PLKConv2d(nn.Module): + "Partial Large Kernel Convolutional Layer" + + def __init__(self, dim: int, kernel_size: int): + super().__init__() + self.conv = nn.Conv2d(dim, dim, kernel_size, 1, kernel_size // 2) + trunc_normal_(self.conv.weight, std=0.02) + self.idx = dim + + def forward(self, x: torch.Tensor) -> torch.Tensor: + if self.training: + x1, x2 = torch.split(x, [self.idx, x.size(1) - self.idx], dim=1) + x1 = self.conv(x1) + return torch.cat([x1, x2], dim=1) + x[:, : self.idx] = self.conv(x[:, : self.idx]) + return x + + +class EA(nn.Module): + "Element-wise Attention" + + def __init__(self, dim: int): + super().__init__() + self.f = nn.Sequential(nn.Conv2d(dim, dim, 3, 1, 1), nn.Sigmoid()) + trunc_normal_(self.f[0].weight, std=0.02) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return x * self.f(x) + + +class PLKBlock(nn.Module): + def __init__( + self, + dim: int, + kernel_size: int, + split_ratio: float, + norm_groups: int, + use_ea: bool = True, + ): + super().__init__() + + # Local Texture + self.channel_mixer = DCCM(dim) + + # Long-range Dependency + pdim = int(dim * split_ratio) + + # Conv Layer + self.lk = PLKConv2d(pdim, kernel_size) + + # Instance-dependent modulation + if use_ea: + self.attn = EA(dim) + else: + self.attn = nn.Identity() + + # Refinement + self.refine = nn.Conv2d(dim, dim, 1, 1, 0) + trunc_normal_(self.refine.weight, std=0.02) + + # Group Normalization + self.norm = nn.GroupNorm(norm_groups, dim) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x_skip = x + x = self.channel_mixer(x) + x = self.lk(x) + x = self.attn(x) + x = self.refine(x) + x = self.norm(x) + + return x + x_skip + + +@store_hyperparameters() +class RealPLKSR(nn.Module): + """Partial Large Kernel CNNs for Efficient Super-Resolution: + https://arxiv.org/abs/2404.11848 + """ + + hyperparameters = {} + + def __init__( + self, + *, + dim: int = 64, + n_blocks: int = 28, + upscaling_factor: int = 4, + kernel_size: int = 17, + split_ratio: float = 0.25, + use_ea: bool = True, + norm_groups: int = 4, + dropout: float = 0, + ): + super().__init__() + + if not self.training: + dropout = 0 + + self.feats = nn.Sequential( + *[nn.Conv2d(3, dim, 3, 1, 1)] + + [ + PLKBlock(dim, kernel_size, split_ratio, norm_groups, use_ea) + for _ in range(n_blocks) + ] + + [nn.Dropout2d(dropout)] + + [nn.Conv2d(dim, 3 * upscaling_factor**2, 3, 1, 1)] + ) + trunc_normal_(self.feats[0].weight, std=0.02) + trunc_normal_(self.feats[-1].weight, std=0.02) + + self.repeat_op = partial( + torch.repeat_interleave, repeats=upscaling_factor**2, dim=1 + ) + + self.to_img = nn.PixelShuffle(upscaling_factor) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = self.feats(x) + self.repeat_op(x) + return self.to_img(x) diff --git a/libs/spandrel/spandrel/architectures/PLKSR/__init__.py b/libs/spandrel/spandrel/architectures/PLKSR/__init__.py index 3b04bf58..c8f3cd1b 100644 --- a/libs/spandrel/spandrel/architectures/PLKSR/__init__.py +++ b/libs/spandrel/spandrel/architectures/PLKSR/__init__.py @@ -8,8 +8,8 @@ from spandrel.util import KeyCondition, get_seq_len from ...__helpers.model_descriptor import Architecture, ImageModelDescriptor, StateDict -from .arch.PLKSR import PLKSR -from .arch.RealPLKSR import RealPLKSR +from .__arch.PLKSR import PLKSR +from .__arch.RealPLKSR import RealPLKSR _PLKSR = Union[PLKSR, RealPLKSR] diff --git a/libs/spandrel/spandrel/architectures/RGT/arch/LICENSE b/libs/spandrel/spandrel/architectures/RGT/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/RGT/arch/LICENSE rename to libs/spandrel/spandrel/architectures/RGT/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/RGT/arch/rgt.py b/libs/spandrel/spandrel/architectures/RGT/__arch/rgt.py similarity index 100% rename from libs/spandrel/spandrel/architectures/RGT/arch/rgt.py rename to libs/spandrel/spandrel/architectures/RGT/__arch/rgt.py diff --git a/libs/spandrel/spandrel/architectures/RGT/__init__.py b/libs/spandrel/spandrel/architectures/RGT/__init__.py index 7bd715a2..df6981be 100644 --- a/libs/spandrel/spandrel/architectures/RGT/__init__.py +++ b/libs/spandrel/spandrel/architectures/RGT/__init__.py @@ -12,7 +12,7 @@ SizeRequirements, StateDict, ) -from .arch.rgt import RGT +from .__arch.rgt import RGT def _get_split_size(state_dict: StateDict) -> tuple[int, int]: diff --git a/libs/spandrel/spandrel/architectures/RealCUGAN/arch/LICENSE b/libs/spandrel/spandrel/architectures/RealCUGAN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/RealCUGAN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/RealCUGAN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/RealCUGAN/arch/upcunet_v3.py b/libs/spandrel/spandrel/architectures/RealCUGAN/__arch/upcunet_v3.py similarity index 100% rename from libs/spandrel/spandrel/architectures/RealCUGAN/arch/upcunet_v3.py rename to libs/spandrel/spandrel/architectures/RealCUGAN/__arch/upcunet_v3.py diff --git a/libs/spandrel/spandrel/architectures/RealCUGAN/__init__.py b/libs/spandrel/spandrel/architectures/RealCUGAN/__init__.py index 0dbd5080..0255b81a 100644 --- a/libs/spandrel/spandrel/architectures/RealCUGAN/__init__.py +++ b/libs/spandrel/spandrel/architectures/RealCUGAN/__init__.py @@ -13,7 +13,7 @@ SizeRequirements, StateDict, ) -from .arch.upcunet_v3 import UpCunet2x, UpCunet2x_fast, UpCunet3x, UpCunet4x +from .__arch.upcunet_v3 import UpCunet2x, UpCunet2x_fast, UpCunet3x, UpCunet4x _RealCUGAN = Union[UpCunet2x, UpCunet3x, UpCunet4x, UpCunet2x_fast] diff --git a/libs/spandrel/spandrel/architectures/RestoreFormer/arch/LICENSE b/libs/spandrel/spandrel/architectures/RestoreFormer/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/RestoreFormer/arch/LICENSE rename to libs/spandrel/spandrel/architectures/RestoreFormer/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/RestoreFormer/arch/restoreformer_arch.py b/libs/spandrel/spandrel/architectures/RestoreFormer/__arch/restoreformer_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/RestoreFormer/arch/restoreformer_arch.py rename to libs/spandrel/spandrel/architectures/RestoreFormer/__arch/restoreformer_arch.py diff --git a/libs/spandrel/spandrel/architectures/RestoreFormer/__init__.py b/libs/spandrel/spandrel/architectures/RestoreFormer/__init__.py index 434c14c6..ee572d38 100644 --- a/libs/spandrel/spandrel/architectures/RestoreFormer/__init__.py +++ b/libs/spandrel/spandrel/architectures/RestoreFormer/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.restoreformer_arch import RestoreFormer +from .__arch.restoreformer_arch import RestoreFormer class RestoreFormerArch(Architecture[RestoreFormer]): diff --git a/libs/spandrel/spandrel/architectures/RetinexFormer/arch/LICENSE b/libs/spandrel/spandrel/architectures/RetinexFormer/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/RetinexFormer/arch/LICENSE rename to libs/spandrel/spandrel/architectures/RetinexFormer/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/RetinexFormer/arch/retinexformer_arch.py b/libs/spandrel/spandrel/architectures/RetinexFormer/__arch/retinexformer_arch.py similarity index 100% rename from libs/spandrel/spandrel/architectures/RetinexFormer/arch/retinexformer_arch.py rename to libs/spandrel/spandrel/architectures/RetinexFormer/__arch/retinexformer_arch.py diff --git a/libs/spandrel/spandrel/architectures/RetinexFormer/__init__.py b/libs/spandrel/spandrel/architectures/RetinexFormer/__init__.py index 1387b15d..afe22e18 100644 --- a/libs/spandrel/spandrel/architectures/RetinexFormer/__init__.py +++ b/libs/spandrel/spandrel/architectures/RetinexFormer/__init__.py @@ -12,7 +12,7 @@ SizeRequirements, StateDict, ) -from .arch.retinexformer_arch import RetinexFormer +from .__arch.retinexformer_arch import RetinexFormer def _call_fn(model: RetinexFormer, t: torch.Tensor) -> torch.Tensor: diff --git a/libs/spandrel/spandrel/architectures/SAFMN/arch/LICENSE b/libs/spandrel/spandrel/architectures/SAFMN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/SAFMN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/SAFMN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/SAFMN/arch/safmn.py b/libs/spandrel/spandrel/architectures/SAFMN/__arch/safmn.py similarity index 100% rename from libs/spandrel/spandrel/architectures/SAFMN/arch/safmn.py rename to libs/spandrel/spandrel/architectures/SAFMN/__arch/safmn.py diff --git a/libs/spandrel/spandrel/architectures/SAFMN/__init__.py b/libs/spandrel/spandrel/architectures/SAFMN/__init__.py index a9ec789e..c629399a 100644 --- a/libs/spandrel/spandrel/architectures/SAFMN/__init__.py +++ b/libs/spandrel/spandrel/architectures/SAFMN/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.safmn import SAFMN +from .__arch.safmn import SAFMN class SAFMNArch(Architecture[SAFMN]): diff --git a/libs/spandrel/spandrel/architectures/SAFMNBCIE/arch/LICENSE b/libs/spandrel/spandrel/architectures/SAFMNBCIE/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/SAFMNBCIE/arch/LICENSE rename to libs/spandrel/spandrel/architectures/SAFMNBCIE/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/SAFMNBCIE/arch/safmn_bcie.py b/libs/spandrel/spandrel/architectures/SAFMNBCIE/__arch/safmn_bcie.py similarity index 100% rename from libs/spandrel/spandrel/architectures/SAFMNBCIE/arch/safmn_bcie.py rename to libs/spandrel/spandrel/architectures/SAFMNBCIE/__arch/safmn_bcie.py diff --git a/libs/spandrel/spandrel/architectures/SAFMNBCIE/__init__.py b/libs/spandrel/spandrel/architectures/SAFMNBCIE/__init__.py index 590b879f..0a4e77e2 100644 --- a/libs/spandrel/spandrel/architectures/SAFMNBCIE/__init__.py +++ b/libs/spandrel/spandrel/architectures/SAFMNBCIE/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.safmn_bcie import SAFMN_BCIE +from .__arch.safmn_bcie import SAFMN_BCIE class SAFMNBCIEArch(Architecture[SAFMN_BCIE]): diff --git a/libs/spandrel/spandrel/architectures/SCUNet/arch/LICENSE b/libs/spandrel/spandrel/architectures/SCUNet/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/SCUNet/arch/LICENSE rename to libs/spandrel/spandrel/architectures/SCUNet/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/SCUNet/arch/SCUNet.py b/libs/spandrel/spandrel/architectures/SCUNet/__arch/SCUNet.py similarity index 100% rename from libs/spandrel/spandrel/architectures/SCUNet/arch/SCUNet.py rename to libs/spandrel/spandrel/architectures/SCUNet/__arch/SCUNet.py diff --git a/libs/spandrel/spandrel/architectures/SCUNet/__init__.py b/libs/spandrel/spandrel/architectures/SCUNet/__init__.py index ed321654..3e9d3778 100644 --- a/libs/spandrel/spandrel/architectures/SCUNet/__init__.py +++ b/libs/spandrel/spandrel/architectures/SCUNet/__init__.py @@ -9,7 +9,7 @@ SizeRequirements, StateDict, ) -from .arch.SCUNet import SCUNet +from .__arch.SCUNet import SCUNet class SCUNetArch(Architecture[SCUNet]): diff --git a/libs/spandrel/spandrel/architectures/SPAN/arch/LICENSE b/libs/spandrel/spandrel/architectures/SPAN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/SPAN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/SPAN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/SPAN/arch/span.py b/libs/spandrel/spandrel/architectures/SPAN/__arch/span.py similarity index 100% rename from libs/spandrel/spandrel/architectures/SPAN/arch/span.py rename to libs/spandrel/spandrel/architectures/SPAN/__arch/span.py diff --git a/libs/spandrel/spandrel/architectures/SPAN/__init__.py b/libs/spandrel/spandrel/architectures/SPAN/__init__.py index 8dc6ad1b..ccce5590 100644 --- a/libs/spandrel/spandrel/architectures/SPAN/__init__.py +++ b/libs/spandrel/spandrel/architectures/SPAN/__init__.py @@ -4,7 +4,7 @@ from spandrel.util import KeyCondition, get_scale_and_output_channels from ...__helpers.model_descriptor import Architecture, ImageModelDescriptor, StateDict -from .arch.span import SPAN +from .__arch.span import SPAN class SPANArch(Architecture[SPAN]): diff --git a/libs/spandrel/spandrel/architectures/SwiftSRGAN/arch/LICENSE b/libs/spandrel/spandrel/architectures/SwiftSRGAN/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/SwiftSRGAN/arch/LICENSE rename to libs/spandrel/spandrel/architectures/SwiftSRGAN/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/SwiftSRGAN/arch/SwiftSRGAN.py b/libs/spandrel/spandrel/architectures/SwiftSRGAN/__arch/SwiftSRGAN.py similarity index 100% rename from libs/spandrel/spandrel/architectures/SwiftSRGAN/arch/SwiftSRGAN.py rename to libs/spandrel/spandrel/architectures/SwiftSRGAN/__arch/SwiftSRGAN.py diff --git a/libs/spandrel/spandrel/architectures/SwiftSRGAN/__init__.py b/libs/spandrel/spandrel/architectures/SwiftSRGAN/__init__.py index 586092ee..f0ae8255 100644 --- a/libs/spandrel/spandrel/architectures/SwiftSRGAN/__init__.py +++ b/libs/spandrel/spandrel/architectures/SwiftSRGAN/__init__.py @@ -3,7 +3,7 @@ from spandrel.util import KeyCondition, get_seq_len from ...__helpers.model_descriptor import Architecture, ImageModelDescriptor, StateDict -from .arch.SwiftSRGAN import Generator as SwiftSRGAN +from .__arch.SwiftSRGAN import Generator as SwiftSRGAN class SwiftSRGANArch(Architecture[SwiftSRGAN]): diff --git a/libs/spandrel/spandrel/architectures/Swin2SR/arch/LICENSE b/libs/spandrel/spandrel/architectures/Swin2SR/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/Swin2SR/arch/LICENSE rename to libs/spandrel/spandrel/architectures/Swin2SR/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/Swin2SR/arch/Swin2SR.py b/libs/spandrel/spandrel/architectures/Swin2SR/__arch/Swin2SR.py similarity index 100% rename from libs/spandrel/spandrel/architectures/Swin2SR/arch/Swin2SR.py rename to libs/spandrel/spandrel/architectures/Swin2SR/__arch/Swin2SR.py diff --git a/libs/spandrel/spandrel/architectures/Swin2SR/__init__.py b/libs/spandrel/spandrel/architectures/Swin2SR/__init__.py index 93ade19c..f755d938 100644 --- a/libs/spandrel/spandrel/architectures/Swin2SR/__init__.py +++ b/libs/spandrel/spandrel/architectures/Swin2SR/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.Swin2SR import Swin2SR +from .__arch.Swin2SR import Swin2SR class Swin2SRArch(Architecture[Swin2SR]): diff --git a/libs/spandrel/spandrel/architectures/SwinIR/arch/LICENSE b/libs/spandrel/spandrel/architectures/SwinIR/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/SwinIR/arch/LICENSE rename to libs/spandrel/spandrel/architectures/SwinIR/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/SwinIR/arch/SwinIR.py b/libs/spandrel/spandrel/architectures/SwinIR/__arch/SwinIR.py similarity index 100% rename from libs/spandrel/spandrel/architectures/SwinIR/arch/SwinIR.py rename to libs/spandrel/spandrel/architectures/SwinIR/__arch/SwinIR.py diff --git a/libs/spandrel/spandrel/architectures/SwinIR/__init__.py b/libs/spandrel/spandrel/architectures/SwinIR/__init__.py index c237a780..e60f0f10 100644 --- a/libs/spandrel/spandrel/architectures/SwinIR/__init__.py +++ b/libs/spandrel/spandrel/architectures/SwinIR/__init__.py @@ -11,7 +11,7 @@ SizeRequirements, StateDict, ) -from .arch.SwinIR import SwinIR +from .__arch.SwinIR import SwinIR class SwinIRArch(Architecture[SwinIR]): diff --git a/libs/spandrel/spandrel/architectures/Uformer/arch/LICENSE b/libs/spandrel/spandrel/architectures/Uformer/__arch/LICENSE similarity index 100% rename from libs/spandrel/spandrel/architectures/Uformer/arch/LICENSE rename to libs/spandrel/spandrel/architectures/Uformer/__arch/LICENSE diff --git a/libs/spandrel/spandrel/architectures/Uformer/arch/Uformer.py b/libs/spandrel/spandrel/architectures/Uformer/__arch/Uformer.py similarity index 100% rename from libs/spandrel/spandrel/architectures/Uformer/arch/Uformer.py rename to libs/spandrel/spandrel/architectures/Uformer/__arch/Uformer.py diff --git a/libs/spandrel/spandrel/architectures/Uformer/__init__.py b/libs/spandrel/spandrel/architectures/Uformer/__init__.py index 1a1dcade..2b4b0c2a 100644 --- a/libs/spandrel/spandrel/architectures/Uformer/__init__.py +++ b/libs/spandrel/spandrel/architectures/Uformer/__init__.py @@ -10,7 +10,7 @@ SizeRequirements, StateDict, ) -from .arch.Uformer import Uformer +from .__arch.Uformer import Uformer class UformerArch(Architecture[Uformer]): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/arch/adacode_contrast_arch.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__arch/adacode_contrast_arch.py similarity index 98% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/arch/adacode_contrast_arch.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__arch/adacode_contrast_arch.py index cddffaef..00e4f6cc 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/arch/adacode_contrast_arch.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__arch/adacode_contrast_arch.py @@ -6,7 +6,7 @@ from spandrel.util import store_hyperparameters -from ...FeMaSR.arch.femasr import DecoderBlock, MultiScaleEncoder, SwinLayers +from ...FeMaSR.__arch.femasr import DecoderBlock, MultiScaleEncoder, SwinLayers class VectorQuantizer(nn.Module): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__init__.py index 070bf8ae..557a2a59 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/AdaCode/__init__.py @@ -10,7 +10,7 @@ ) from spandrel.util import KeyCondition, get_first_seq_index, get_seq_len -from .arch.adacode_contrast_arch import AdaCodeSRNet_Contrast as AdaCode +from .__arch.adacode_contrast_arch import AdaCodeSRNet_Contrast as AdaCode _inv_channel_query_dict = { 256: [8, 16, 32, 64], diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/arch/codeformer.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__arch/codeformer.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/arch/codeformer.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__arch/codeformer.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__init__.py index 322f5702..e7fbf21b 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/CodeFormer/__init__.py @@ -8,7 +8,7 @@ ) from spandrel.util import KeyCondition, get_seq_len -from .arch.codeformer import CodeFormer +from .__arch.codeformer import CodeFormer class CodeFormerArch(Architecture[CodeFormer]): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/convnext.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/convnext.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/convnext.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/convnext.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/ddcolor.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/ddcolor.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/ddcolor.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/ddcolor.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/position_encoding.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/position_encoding.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/position_encoding.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/position_encoding.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/transformer.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/transformer.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/transformer.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/transformer.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/transformer_utils.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/transformer_utils.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/transformer_utils.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/transformer_utils.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/unet.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/unet.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/arch/unet.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__arch/unet.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/color.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__color.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/color.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__color.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__init__.py index 3beafaf7..90fb28f9 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/DDColor/__init__.py @@ -13,8 +13,8 @@ ) from spandrel.util import KeyCondition, get_seq_len -from .arch.ddcolor import DDColor -from .color import lab_to_rgb, linear_rgb_to_lab, rgb_to_linear_rgb +from .__arch.ddcolor import DDColor +from .__color import lab_to_rgb, linear_rgb_to_lab, rgb_to_linear_rgb def _call(model: DDColor, input: Tensor) -> Tensor: diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/arch/fema_utils.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__arch/fema_utils.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/arch/fema_utils.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__arch/fema_utils.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/arch/femasr.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__arch/femasr.py similarity index 99% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/arch/femasr.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__arch/femasr.py index e7aec357..0a62650f 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/arch/femasr.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__arch/femasr.py @@ -4,7 +4,7 @@ import torch from torch import nn as nn -from spandrel.architectures.SwinIR.arch.SwinIR import RSTB +from spandrel.architectures.SwinIR.__arch.SwinIR import RSTB from spandrel.util import store_hyperparameters from .fema_utils import CombineQuantBlock, ResBlock diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__init__.py index 5333889d..a51c82dd 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/FeMaSR/__init__.py @@ -10,7 +10,7 @@ ) from spandrel.util import KeyCondition, get_first_seq_index, get_seq_len -from .arch.femasr import FeMaSRNet as FeMaSR +from .__arch.femasr import FeMaSRNet as FeMaSR _inv_channel_query_dict = { 256: [8, 16, 32, 64], diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/M3SNet.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/M3SNet.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/M3SNet.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/M3SNet.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/arch_utils.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/arch_utils.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/arch_utils.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/arch_utils.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/local_arch.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/local_arch.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/arch/local_arch.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__arch/local_arch.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__init__.py index b62a0977..fa2c37da 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/M3SNet/__init__.py @@ -8,7 +8,7 @@ ) from spandrel.util import KeyCondition, get_seq_len -from .arch.M3SNet import M3SNet +from .__arch.M3SNet import M3SNet class M3SNetArch(Architecture[M3SNet]): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/arch/MAT.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__arch/MAT.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/arch/MAT.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__arch/MAT.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/arch/utils.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__arch/utils.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/arch/utils.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__arch/utils.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__init__.py index f8ce7509..ca416fd6 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MAT/__init__.py @@ -8,7 +8,7 @@ ) from spandrel.util import KeyCondition -from .arch.MAT import MAT +from .__arch.MAT import MAT class MATArch(Architecture[MAT]): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/arch/mirnet_v2_arch.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__arch/mirnet_v2_arch.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/arch/mirnet_v2_arch.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__arch/mirnet_v2_arch.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__init__.py index fb388e97..e7ea5f42 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MIRNet2/__init__.py @@ -12,7 +12,7 @@ ) from spandrel.util import KeyCondition, get_seq_len -from .arch.mirnet_v2_arch import MIRNet_v2 as MIRNet2 +from .__arch.mirnet_v2_arch import MIRNet_v2 as MIRNet2 class MIRNet2Arch(Architecture[MIRNet2]): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/arch/MPRNet.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__arch/MPRNet.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/arch/MPRNet.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__arch/MPRNet.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__init__.py index ff4248e6..b9e01552 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/MPRNet/__init__.py @@ -10,7 +10,7 @@ ) from spandrel.util import KeyCondition, get_seq_len -from .arch.MPRNet import MPRNet +from .__arch.MPRNet import MPRNet class MPRNetArch(Architecture[MPRNet]): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/arch/restormer_arch.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__arch/restormer_arch.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/arch/restormer_arch.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__arch/restormer_arch.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__init__.py index d15cde6a..8ccf0974 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/Restormer/__init__.py @@ -10,7 +10,7 @@ ) from spandrel.util import KeyCondition, get_seq_len -from .arch.restormer_arch import Restormer +from .__arch.restormer_arch import Restormer class RestormerArch(Architecture[Restormer]): diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/arch/LICENSE b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__arch/LICENSE similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/arch/LICENSE rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__arch/LICENSE diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/arch/SRFormer.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__arch/SRFormer.py similarity index 100% rename from libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/arch/SRFormer.py rename to libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__arch/SRFormer.py diff --git a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__init__.py b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__init__.py index 7cbbe71d..2572da28 100644 --- a/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__init__.py +++ b/libs/spandrel_extra_arches/spandrel_extra_arches/architectures/SRFormer/__init__.py @@ -10,7 +10,7 @@ ) from spandrel.util import KeyCondition, get_pixelshuffle_params, get_seq_len -from .arch.SRFormer import SRFormer +from .__arch.SRFormer import SRFormer class SRFormerArch(Architecture[SRFormer]): diff --git a/pyproject.toml b/pyproject.toml index 0a60938a..fc7b8b62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ lint.ignore = [ [tool.ruff.lint.per-file-ignores] "**/__arch_helpers/**/*" = ["N", "ANN"] -"**/arch/**/*" = ["B006", "B007", "B008", "N", "ANN", "SIM102", "SIM114"] +"**/__arch/**/*" = ["B006", "B007", "B008", "N", "ANN", "SIM102", "SIM114"] "**/{tests,scripts}/**/*" = ["N802", "ANN", "T201"] [tool.pytest.ini_options]