Copy disabled (too large)
Download .txt
Showing preview only (20,037K chars total). Download the full file to get everything.
Repository: open-mmlab/mmagic
Branch: main
Commit: 0a560bba9b79
Files: 1687
Total size: 18.8 MB
Directory structure:
gitextract_ofufjmnn/
├── .circleci/
│ ├── config.yml
│ ├── docker/
│ │ └── Dockerfile
│ └── test.yml
├── .dele.yml
├── .dev_scripts/
│ ├── README.md
│ ├── create_ceph_configs.py
│ ├── doc_link_checker.py
│ ├── download_models.py
│ ├── inference_benchmark.sh
│ ├── job_watcher.py
│ ├── metric_mapping.py
│ ├── task_mapping.py
│ ├── test_benchmark.py
│ ├── test_benchmark.yml
│ ├── train_benchmark.py
│ ├── train_benchmark.yml
│ ├── update_config_readme.py
│ ├── update_model_index.py
│ ├── update_ut.py
│ └── utils/
│ ├── __init__.py
│ ├── job_util.py
│ └── modelindex.py
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE/
│ │ ├── 1-bug-report.yml
│ │ ├── 2-feature-request.yml
│ │ ├── 3-new-model.yml
│ │ ├── 4-documentation.yml
│ │ └── config.yml
│ ├── pull_request_template.md
│ └── workflows/
│ ├── lint.yml
│ ├── merge_stage_test.yml
│ ├── pr_stage_test.yml
│ ├── publish-to-pypi.yml
│ └── test_mim.yml
├── .gitignore
├── .owners.yml
├── .pre-commit-config.yaml
├── .pylintrc
├── .readthedocs.yml
├── CITATION.cff
├── LICENSE
├── MANIFEST.in
├── README.md
├── README_zh-CN.md
├── configs/
│ ├── _base_/
│ │ ├── datasets/
│ │ │ ├── basicvsr_test_config.py
│ │ │ ├── celeba.py
│ │ │ ├── cifar10_noaug.py
│ │ │ ├── cifar10_nopad.py
│ │ │ ├── comp1k.py
│ │ │ ├── deblurring-defocus_test_config.py
│ │ │ ├── deblurring-motion_test_config.py
│ │ │ ├── decompression_test_config.py
│ │ │ ├── denoising-gaussian_color_test_config.py
│ │ │ ├── denoising-gaussian_gray_test_config.py
│ │ │ ├── denoising-real_test_config.py
│ │ │ ├── deraining_test_config.py
│ │ │ ├── ffhq_flip.py
│ │ │ ├── grow_scale_imgs_ffhq_styleganv1.py
│ │ │ ├── imagenet_128.py
│ │ │ ├── imagenet_256.py
│ │ │ ├── imagenet_512.py
│ │ │ ├── imagenet_64.py
│ │ │ ├── imagenet_noaug_128.py
│ │ │ ├── liif_test_config.py
│ │ │ ├── lsun_stylegan.py
│ │ │ ├── paired_imgs_256x256_crop.py
│ │ │ ├── places.py
│ │ │ ├── sisr_x2_test_config.py
│ │ │ ├── sisr_x3_test_config.py
│ │ │ ├── sisr_x4_test_config.py
│ │ │ ├── tdan_test_config.py
│ │ │ ├── unconditional_imgs_128x128.py
│ │ │ ├── unconditional_imgs_64x64.py
│ │ │ ├── unconditional_imgs_flip_512x512.py
│ │ │ ├── unconditional_imgs_flip_lanczos_resize_256x256.py
│ │ │ └── unpaired_imgs_256x256.py
│ │ ├── default_runtime.py
│ │ ├── gen_default_runtime.py
│ │ ├── inpaint_default_runtime.py
│ │ ├── matting_default_runtime.py
│ │ ├── models/
│ │ │ ├── base_cyclegan.py
│ │ │ ├── base_deepfillv1.py
│ │ │ ├── base_deepfillv2.py
│ │ │ ├── base_edvr.py
│ │ │ ├── base_gl.py
│ │ │ ├── base_glean.py
│ │ │ ├── base_liif.py
│ │ │ ├── base_pconv.py
│ │ │ ├── base_pix2pix.py
│ │ │ ├── base_styleganv1.py
│ │ │ ├── base_styleganv2.py
│ │ │ ├── base_styleganv3.py
│ │ │ ├── base_tof.py
│ │ │ ├── biggan/
│ │ │ │ └── base_biggan_128x128.py
│ │ │ ├── dcgan/
│ │ │ │ ├── base_dcgan_128x128.py
│ │ │ │ └── base_dcgan_64x64.py
│ │ │ ├── sagan/
│ │ │ │ ├── base_sagan_128x128.py
│ │ │ │ └── base_sagan_32x32.py
│ │ │ └── sngan_proj/
│ │ │ ├── base_sngan_proj_128x128.py
│ │ │ └── base_sngan_proj_32x32.py
│ │ └── schedules/
│ │ └── .gitkeep
│ ├── animatediff/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── animatediff_Lyriel.py
│ │ ├── animatediff_MajicMix.py
│ │ ├── animatediff_RcnzCartoon.py
│ │ ├── animatediff_RealisticVision.py
│ │ ├── animatediff_RealisticVision_v2.py
│ │ ├── animatediff_ToonYou.py
│ │ └── metafile.yml
│ ├── aot_gan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── aot-gan_smpgan_4xb4_places-512x512.py
│ │ └── metafile.yml
│ ├── basicvsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── basicvsr_2xb4_reds4.py
│ │ ├── basicvsr_2xb4_vimeo90k-bd.py
│ │ ├── basicvsr_2xb4_vimeo90k-bi.py
│ │ └── metafile.yml
│ ├── basicvsr_pp/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── basicvsr-pp_c128n25_600k_ntire-decompress-track1.py
│ │ ├── basicvsr-pp_c128n25_600k_ntire-decompress-track2.py
│ │ ├── basicvsr-pp_c128n25_600k_ntire-decompress-track3.py
│ │ ├── basicvsr-pp_c128n25_600k_ntire-vsr.py
│ │ ├── basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bd.py
│ │ ├── basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bi.py
│ │ ├── basicvsr-pp_c64n7_8xb1-600k_reds4.py
│ │ └── metafile.yml
│ ├── biggan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── biggan-deep_cvt-hugging-face-rgb_imagenet1k-128x128.py
│ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-256x256.py
│ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-512x512.py
│ │ ├── biggan_2xb25-500kiters_cifar10-32x32.py
│ │ ├── biggan_ajbrock-sn_8xb32-1500kiters_imagenet1k-128x128.py
│ │ ├── biggan_cvt-BigGAN-PyTorch-rgb_imagenet1k-128x128.py
│ │ └── metafile.yml
│ ├── cain/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── cain_g1b32_1xb5_vimeo90k-triplet.py
│ │ └── metafile.yml
│ ├── controlnet/
│ │ ├── README.md
│ │ ├── controlnet-1xb1-fill50k.py
│ │ ├── controlnet-canny.py
│ │ ├── controlnet-pose.py
│ │ ├── controlnet-seg.py
│ │ └── metafile.yml
│ ├── controlnet_animation/
│ │ ├── README.md
│ │ ├── anythingv3_config.py
│ │ └── metafile.yml
│ ├── cyclegan/
│ │ ├── README.md
│ │ ├── cyclegan_lsgan-id0-resnet-in_1xb1-250kiters_summer2winter.py
│ │ ├── cyclegan_lsgan-id0-resnet-in_1xb1-270kiters_horse2zebra.py
│ │ ├── cyclegan_lsgan-id0-resnet-in_1xb1-80kiters_facades.py
│ │ ├── cyclegan_lsgan-resnet-in_1xb1-250kiters_summer2winter.py
│ │ ├── cyclegan_lsgan-resnet-in_1xb1-270kiters_horse2zebra.py
│ │ ├── cyclegan_lsgan-resnet-in_1xb1-80kiters_facades.py
│ │ └── metafile.yml
│ ├── dcgan/
│ │ ├── README.md
│ │ ├── dcgan_1xb128-300kiters_celeba-cropped-64.py
│ │ ├── dcgan_1xb128-5epoches_lsun-bedroom-64x64.py
│ │ ├── dcgan_Glr4e-4_Dlr1e-4_1xb128-5kiters_mnist-64x64.py
│ │ └── metafile.yml
│ ├── deblurganv2/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── deblurganv2_fpn-inception_1xb1_gopro.py
│ │ ├── deblurganv2_fpn-mobilenet_1xb1_gopro.py
│ │ └── metafile.yml
│ ├── deepfillv1/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── deepfillv1_4xb4_celeba-256x256.py
│ │ ├── deepfillv1_8xb2_places-256x256.py
│ │ └── metafile.yml
│ ├── deepfillv2/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── deepfillv2_8xb2_celeba-256x256.py
│ │ ├── deepfillv2_8xb2_places-256x256.py
│ │ └── metafile.yml
│ ├── dic/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── dic_gan-x8c48b6_4xb2-500k_celeba-hq.py
│ │ ├── dic_x8c48b6_4xb2-150k_celeba-hq.py
│ │ └── metafile.yml
│ ├── diffusers_pipeline/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ └── sd_xl_pipeline.py
│ ├── dim/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── dim_stage1-v16_1xb1-1000k_comp1k.py
│ │ ├── dim_stage1-v16_1xb1-1000k_comp1k_online-merge.py
│ │ ├── dim_stage2-v16-pln_1xb1-1000k_comp1k.py
│ │ ├── dim_stage3-v16-pln_1xb1-1000k_comp1k.py
│ │ └── metafile.yml
│ ├── disco_diffusion/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── disco-diffusion_adm-u-finetuned_imagenet-256x256.py
│ │ ├── disco-diffusion_adm-u-finetuned_imagenet-512x512.py
│ │ ├── disco-diffusion_portrait-generator-v001.py
│ │ ├── metafile.yml
│ │ └── tutorials.ipynb
│ ├── draggan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── stylegan2_1024x1024.py
│ │ ├── stylegan2_256x256.py
│ │ └── stylegan2_512x512.py
│ ├── dreambooth/
│ │ ├── README.md
│ │ ├── dreambooth-finetune_text_encoder.py
│ │ ├── dreambooth-lora-prior_pre.py
│ │ ├── dreambooth-lora.py
│ │ ├── dreambooth-prior_pre.py
│ │ ├── dreambooth.py
│ │ └── metafile.yml
│ ├── edsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── edsr_x2c64b16_1xb16-300k_div2k.py
│ │ ├── edsr_x3c64b16_1xb16-300k_div2k.py
│ │ ├── edsr_x4c64b16_1xb16-300k_div2k.py
│ │ └── metafile.yml
│ ├── edvr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── edvrl_c128b40_8xb8-lr2e-4-600k_reds4.py
│ │ ├── edvrl_wotsa-c128b40_8xb8-lr2e-4-600k_reds4.py
│ │ ├── edvrm_8xb4-600k_reds.py
│ │ ├── edvrm_wotsa_8xb4-600k_reds.py
│ │ └── metafile.yml
│ ├── eg3d/
│ │ ├── README.md
│ │ ├── eg3d_cvt-official-rgb_afhq-512x512.py
│ │ ├── eg3d_cvt-official-rgb_ffhq-512x512.py
│ │ ├── eg3d_cvt-official-rgb_shapenet-128x128.py
│ │ └── metafile.yml
│ ├── esrgan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── esrgan_psnr-x4c64b23g32_1xb16-1000k_div2k.py
│ │ ├── esrgan_x4c64b23g32_1xb16-400k_div2k.py
│ │ └── metafile.yml
│ ├── fastcomposer/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── fastcomposer_8xb16_FFHQ.py
│ │ └── metafile.yml
│ ├── flavr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── flavr_in4out1_8xb4_vimeo90k-septuplet.py
│ │ └── metafile.yml
│ ├── gca/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── baseline_r34_4xb10-200k_comp1k.py
│ │ ├── baseline_r34_4xb10-dimaug-200k_comp1k.py
│ │ ├── gca_r34_4xb10-200k_comp1k.py
│ │ ├── gca_r34_4xb10-dimaug-200k_comp1k.py
│ │ └── metafile.yml
│ ├── ggan/
│ │ ├── README.md
│ │ ├── ggan_dcgan-archi_lr1e-3-1xb128-12Mimgs_celeba-cropped-64x64.py
│ │ ├── ggan_dcgan-archi_lr1e-4-1xb64-10Mimgs_celeba-cropped-128x128.py
│ │ ├── ggan_lsgan-archi_lr1e-4-1xb128-20Mimgs_lsun-bedroom-64x64.py
│ │ └── metafile.yml
│ ├── glean/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── glean_in128out1024-fp16_4xb2-300k_ffhq-celeba-hq.py
│ │ ├── glean_in128out1024_4xb2-300k_ffhq-celeba-hq.py
│ │ ├── glean_x16-fp16_2xb8_ffhq.py
│ │ ├── glean_x16_2xb8_cat.py
│ │ ├── glean_x16_2xb8_ffhq.py
│ │ ├── glean_x8-fp16_2xb8_cat.py
│ │ ├── glean_x8_2xb8_cat.py
│ │ └── metafile.yml
│ ├── global_local/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── gl_8xb12_celeba-256x256.py
│ │ ├── gl_8xb12_places-256x256.py
│ │ └── metafile.yml
│ ├── guided_diffusion/
│ │ ├── README.md
│ │ ├── adm-g_ddim25_8xb32_imagenet-256x256.py
│ │ ├── adm-g_ddim25_8xb32_imagenet-512x512.py
│ │ ├── adm-g_ddim25_8xb32_imagenet-64x64.py
│ │ ├── adm_ddim250_8xb32_imagenet-256x256.py
│ │ ├── adm_ddim250_8xb32_imagenet-512x512.py
│ │ ├── adm_ddim250_8xb32_imagenet-64x64.py
│ │ └── metafile.yml
│ ├── iconvsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── iconvsr_2xb4_reds4.py
│ │ ├── iconvsr_2xb4_vimeo90k-bd.py
│ │ ├── iconvsr_2xb4_vimeo90k-bi.py
│ │ └── metafile.yml
│ ├── indexnet/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── indexnet_mobv2-dimaug_1xb16-78k_comp1k.py
│ │ ├── indexnet_mobv2_1xb16-78k_comp1k.py
│ │ └── metafile.yml
│ ├── inst_colorization/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── inst-colorizatioon_full_official_cocostuff-256x256.py
│ │ └── metafile.yml
│ ├── liif/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── liif-edsr-norm_c64b16_1xb16-1000k_div2k.py
│ │ ├── liif-rdn-norm_c64b16_1xb16-1000k_div2k.py
│ │ └── metafile.yml
│ ├── lsgan/
│ │ ├── README.md
│ │ ├── lsgan_dcgan-archi_lr1e-3-1xb128-12Mimgs_celeba-cropped-64x64.py
│ │ ├── lsgan_dcgan-archi_lr1e-4-1xb128-12Mimgs_lsun-bedroom-64x64.py
│ │ ├── lsgan_dcgan-archi_lr1e-4-1xb64-10Mimgs_celeba-cropped-128x128.py
│ │ ├── lsgan_lsgan-archi_lr1e-4-1xb64-10Mimgs_lsun-bedroom-128x128.py
│ │ └── metafile.yml
│ ├── nafnet/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── nafnet_c64eb11128mb1db1111_8xb8-lr1e-3-400k_gopro.py
│ │ └── nafnet_c64eb2248mb12db2222_8xb8-lr1e-3-400k_sidd.py
│ ├── partial_conv/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── pconv_stage1_8xb12_places-256x256.py
│ │ ├── pconv_stage1_8xb1_celeba-256x256.py
│ │ ├── pconv_stage2_4xb2_celeba-256x256.py
│ │ └── pconv_stage2_4xb2_places-256x256.py
│ ├── pggan/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── pggan_8xb4-12Mimg_celeba-hq-1024x1024.py
│ │ ├── pggan_8xb4-12Mimgs_celeba-cropped-128x128.py
│ │ └── pggan_8xb4-12Mimgs_lsun-bedroom-128x128.py
│ ├── pix2pix/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── pix2pix_vanilla-unet-bn_1xb1-220kiters_aerial2maps.py
│ │ ├── pix2pix_vanilla-unet-bn_1xb1-220kiters_maps2aerial.py
│ │ ├── pix2pix_vanilla-unet-bn_1xb1-80kiters_facades.py
│ │ └── pix2pix_vanilla-unet-bn_wo-jitter-flip-1xb4-190kiters_edges2shoes.py
│ ├── positional_encoding_in_gans/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── mspie-stylegan2-config-c_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-d_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-e_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-f_c1_8xb2-1600kiters_ffhq-256-1024.py
│ │ ├── mspie-stylegan2-config-f_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-f_c2_8xb3-1100kiters_ffhq-256-896.py
│ │ ├── mspie-stylegan2-config-g_c1_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-h_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-i_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-j_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-k_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── singan-csg_bohemian.py
│ │ ├── singan-csg_fish.py
│ │ ├── singan_interp-pad_balloons.py
│ │ ├── singan_interp-pad_disc-nobn_balloons.py
│ │ ├── singan_interp-pad_disc-nobn_fish.py
│ │ ├── singan_spe-dim4_bohemian.py
│ │ ├── singan_spe-dim4_fish.py
│ │ ├── singan_spe-dim8_bohemian.py
│ │ ├── stylegan2_c2_8xb3-1100kiters_ffhq-256x256.py
│ │ └── stylegan2_c2_8xb3-1100kiters_ffhq-512x512.py
│ ├── rdn/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── rdn_x2c64b16_1xb16-1000k_div2k.py
│ │ ├── rdn_x3c64b16_1xb16-1000k_div2k.py
│ │ └── rdn_x4c64b16_1xb16-1000k_div2k.py
│ ├── real_basicvsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── realbasicvsr_c64b20-1x30x8_8xb1-lr5e-5-150k_reds.py
│ │ └── realbasicvsr_wogan-c64b20-2x30x8_8xb2-lr1e-4-300k_reds.py
│ ├── real_esrgan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── realesrgan_c64b23g32_4xb12-lr1e-4-400k_df2k-ost.py
│ │ └── realesrnet_c64b23g32_4xb12-lr2e-4-1000k_df2k-ost.py
│ ├── restormer/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── restormer_official_dfwb-color-sigma15.py
│ │ ├── restormer_official_dfwb-color-sigma25.py
│ │ ├── restormer_official_dfwb-color-sigma50.py
│ │ ├── restormer_official_dfwb-gray-sigma15.py
│ │ ├── restormer_official_dfwb-gray-sigma25.py
│ │ ├── restormer_official_dfwb-gray-sigma50.py
│ │ ├── restormer_official_dpdd-dual.py
│ │ ├── restormer_official_dpdd-single.py
│ │ ├── restormer_official_gopro.py
│ │ ├── restormer_official_rain13k.py
│ │ └── restormer_official_sidd.py
│ ├── sagan/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── sagan_128_cvt_studioGAN.py
│ │ ├── sagan_cvt-studioGAN_cifar10-32x32.py
│ │ ├── sagan_wReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ │ ├── sagan_woReLUinplace-Glr1e-4_Dlr4e-4_noaug-ndisc1-8xb32-bigGAN-sch_imagenet1k-128x128.py
│ │ ├── sagan_woReLUinplace_Glr1e-4_Dlr4e-4_ndisc1-4xb64_imagenet1k-128x128.py
│ │ └── sagan_woReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ ├── singan/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── singan_balloons.py
│ │ ├── singan_bohemian.py
│ │ └── singan_fish.py
│ ├── sngan_proj/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── sngan-proj-cvt-studioGAN_cifar10-32x32.py
│ │ ├── sngan-proj-cvt-studioGAN_imagenet1k-128x128.py
│ │ ├── sngan-proj_wReLUinplace_Glr2e-4_Dlr5e-5_ndisc5-2xb128_imagenet1k-128x128.py
│ │ ├── sngan-proj_wReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ │ ├── sngan-proj_woReLUinplace_Glr2e-4_Dlr5e-5_ndisc5-2xb128_imagenet1k-128x128.py
│ │ └── sngan-proj_woReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ ├── srcnn/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ └── srcnn_x4k915_1xb16-1000k_div2k.py
│ ├── srgan_resnet/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── msrresnet_x4c64b16_1xb16-1000k_div2k.py
│ │ └── srgan_x4c64b16_1xb16-1000k_div2k.py
│ ├── stable_diffusion/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── stable-diffusion_ddim_denoisingunet-inpaint.py
│ │ ├── stable-diffusion_ddim_denoisingunet-tomesd_5e-1.py
│ │ └── stable-diffusion_ddim_denoisingunet.py
│ ├── stable_diffusion_xl/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ └── stable-diffusion_xl_ddim_denoisingunet.py
│ ├── styleganv1/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── styleganv1_ffhq-1024x1024_8xb4-25Mimgs.py
│ │ └── styleganv1_ffhq-256x256_8xb4-25Mimgs.py
│ ├── styleganv2/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── stylegan2_c2-PL-R1_8xb4-apex-fp16-no-scaler-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2-PL-R1_8xb4-fp16-globalG-partialD-no-scaler-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2-PL_8xb4-fp16-partial-GD-no-scaler-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_lsun-cat-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_lsun-church-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_lsun-horse-256x256.py
│ │ ├── stylegan2_c2_8xb4_ffhq-1024x1024.py
│ │ └── stylegan2_c2_8xb4_lsun-car-384x512.py
│ ├── styleganv3/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── stylegan3-r_ada-gamma3.3_8xb4-fp16_metfaces-1024x1024.py
│ │ ├── stylegan3-r_cvt-official-rgb_8xb4_ffhq-1024x1024.py
│ │ ├── stylegan3-r_cvt-official-rgb_8xb4_ffhqu-256x256.py
│ │ ├── stylegan3-r_cvt-official-rgb_8xb4x8_afhqv2-512x512.py
│ │ ├── stylegan3-t_ada-gamma6.6_8xb4-fp16_metfaces-1024x1024.py
│ │ ├── stylegan3-t_cvt-official-rgb_8xb4_afhqv2-512x512.py
│ │ ├── stylegan3-t_cvt-official-rgb_8xb4_ffhq-1024x1024.py
│ │ ├── stylegan3-t_cvt-official-rgb_8xb4_ffhqu-256x256.py
│ │ ├── stylegan3-t_gamma2.0_8xb4-fp16-noaug_ffhq-256x256.py
│ │ └── stylegan3-t_gamma32.8_8xb4-fp16-noaug_ffhq-1024x1024.py
│ ├── swinir/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── swinir_gan-x2s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_gan-x4s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_gan-x4s64w8d9e240_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_psnr-x2s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_psnr-x4s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_psnr-x4s64w8d9e240_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR10.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR20.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR30.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR40.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR10.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR20.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR30.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR40.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-colorDN15.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-colorDN25.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-colorDN50.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-grayDN15.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-grayDN25.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-grayDN50.py
│ │ ├── swinir_x2s48w8d6e180_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x2s64w8d4e60_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x2s64w8d6e180_8xb4-lr2e-4-500k_df2k.py
│ │ ├── swinir_x3s48w8d6e180_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x3s64w8d4e60_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x3s64w8d6e180_8xb4-lr2e-4-500k_df2k.py
│ │ ├── swinir_x4s48w8d6e180_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x4s64w8d4e60_8xb4-lr2e-4-500k_div2k.py
│ │ └── swinir_x4s64w8d6e180_8xb4-lr2e-4-500k_df2k.py
│ ├── tdan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── tdan_x4_8xb16-lr1e-4-400k_vimeo90k-bd.py
│ │ ├── tdan_x4_8xb16-lr1e-4-400k_vimeo90k-bi.py
│ │ ├── tdan_x4ft_8xb16-lr5e-5-400k_vimeo90k-bi.py
│ │ └── tdan_x4ft_8xb16-lr5e-5-800k_vimeo90k-bd.py
│ ├── textual_inversion/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ └── textual_inversion.py
│ ├── tof/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── tof_spynet-chair-wobn_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-kitti-wobn_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-pytoflow-wobn_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-sintel-wobn-clean_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-sintel-wobn-final_1xb1_vimeo90k-triplet.py
│ │ └── tof_x4_official_vimeo90k.py
│ ├── ttsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── ttsr-gan_x4c64b16_1xb9-500k_CUFED.py
│ │ └── ttsr-rec_x4c64b16_1xb9-200k_CUFED.py
│ ├── vico/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ └── vico.py
│ └── wgan-gp/
│ ├── README.md
│ ├── metafile.yml
│ ├── wgangp_GN-GP-50_1xb64-160kiters_lsun-bedroom-128x128.py
│ └── wgangp_GN_1xb64-160kiters_celeba-cropped-128x128.py
├── demo/
│ ├── README.md
│ ├── download_inference_resources.py
│ ├── gradio_animatediff.py
│ ├── gradio_controlnet_animation.py
│ ├── gradio_draggan.py
│ ├── gradio_fastcomposer.py
│ ├── gradio_inpainting.py
│ ├── gradio_vico.py
│ ├── mmagic_inference_demo.py
│ ├── mmagic_inference_tutorial.ipynb
│ ├── singan_demo.py
│ └── utils/
│ ├── gradio_utils.py
│ └── renderer.py
├── docker/
│ ├── Dockerfile
│ └── README.md
├── docs/
│ ├── en/
│ │ ├── .dev_scripts/
│ │ │ ├── update_dataset_zoo.py
│ │ │ └── update_model_zoo.py
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ ├── _static/
│ │ │ └── css/
│ │ │ └── readthedocs.css
│ │ ├── _templates/
│ │ │ ├── 404.html
│ │ │ └── python/
│ │ │ ├── attribute.rst
│ │ │ ├── class.rst
│ │ │ ├── data.rst
│ │ │ ├── exception.rst
│ │ │ ├── function.rst
│ │ │ ├── method.rst
│ │ │ ├── module.rst
│ │ │ ├── package.rst
│ │ │ └── property.rst
│ │ ├── advanced_guides/
│ │ │ ├── data_flow.md
│ │ │ ├── data_preprocessor.md
│ │ │ ├── evaluator.md
│ │ │ └── structures.md
│ │ ├── changelog.md
│ │ ├── community/
│ │ │ ├── contributing.md
│ │ │ └── projects.md
│ │ ├── conf.py
│ │ ├── device/
│ │ │ └── npu.md
│ │ ├── docutils.conf
│ │ ├── faq.md
│ │ ├── get_started/
│ │ │ ├── install.md
│ │ │ ├── overview.md
│ │ │ └── quick_run.md
│ │ ├── howto/
│ │ │ ├── dataset.md
│ │ │ ├── losses.md
│ │ │ ├── models.md
│ │ │ └── transforms.md
│ │ ├── index.rst
│ │ ├── make.bat
│ │ ├── migration/
│ │ │ ├── amp.md
│ │ │ ├── data.md
│ │ │ ├── distributed_train.md
│ │ │ ├── eval_test.md
│ │ │ ├── models.md
│ │ │ ├── optimizers.md
│ │ │ ├── overview.md
│ │ │ ├── runtime.md
│ │ │ ├── schedule.md
│ │ │ └── visualization.md
│ │ ├── switch_language.md
│ │ └── user_guides/
│ │ ├── config.md
│ │ ├── dataset_prepare.md
│ │ ├── deploy.md
│ │ ├── inference.md
│ │ ├── metrics.md
│ │ ├── train_test.md
│ │ ├── useful_tools.md
│ │ └── visualization.md
│ └── zh_cn/
│ ├── .dev_scripts/
│ │ ├── update_dataset_zoo.py
│ │ └── update_model_zoo.py
│ ├── .gitignore
│ ├── Makefile
│ ├── _static/
│ │ └── css/
│ │ └── readthedocs.css
│ ├── _templates/
│ │ └── 404.html
│ ├── advanced_guides/
│ │ ├── data_flow.md
│ │ ├── data_preprocessor.md
│ │ ├── evaluator.md
│ │ └── structures.md
│ ├── changelog.md
│ ├── community/
│ │ ├── contributing.md
│ │ └── projects.md
│ ├── conf.py
│ ├── device/
│ │ └── npu_zh.md
│ ├── faq.md
│ ├── get_started/
│ │ ├── install.md
│ │ ├── overview.md
│ │ └── quick_run.md
│ ├── howto/
│ │ ├── dataset.md
│ │ ├── losses.md
│ │ ├── models.md
│ │ └── transforms.md
│ ├── index.rst
│ ├── make.bat
│ ├── migration/
│ │ ├── amp.md
│ │ ├── data.md
│ │ ├── distributed_train.md
│ │ ├── eval_test.md
│ │ ├── models.md
│ │ ├── optimizers.md
│ │ ├── overview.md
│ │ ├── runtime.md
│ │ ├── schedule.md
│ │ └── visualization.md
│ ├── stat.py
│ ├── switch_language.md
│ └── user_guides/
│ ├── config.md
│ ├── dataset_prepare.md
│ ├── deploy.md
│ ├── index.rst
│ ├── inference.md
│ ├── metrics.md
│ ├── train_test.md
│ ├── useful_tools.md
│ └── visualization.md
├── mmagic/
│ ├── __init__.py
│ ├── apis/
│ │ ├── __init__.py
│ │ ├── inferencers/
│ │ │ ├── __init__.py
│ │ │ ├── base_mmagic_inferencer.py
│ │ │ ├── colorization_inferencer.py
│ │ │ ├── conditional_inferencer.py
│ │ │ ├── controlnet_animation_inferencer.py
│ │ │ ├── diffusers_pipeline_inferencer.py
│ │ │ ├── eg3d_inferencer.py
│ │ │ ├── image_super_resolution_inferencer.py
│ │ │ ├── inference_functions.py
│ │ │ ├── inpainting_inferencer.py
│ │ │ ├── matting_inferencer.py
│ │ │ ├── text2image_inferencer.py
│ │ │ ├── translation_inferencer.py
│ │ │ ├── unconditional_inferencer.py
│ │ │ ├── video_interpolation_inferencer.py
│ │ │ └── video_restoration_inferencer.py
│ │ └── mmagic_inferencer.py
│ ├── configs/
│ │ ├── _base_/
│ │ │ ├── datasets/
│ │ │ │ ├── basicvsr_test_config.py
│ │ │ │ ├── celeba.py
│ │ │ │ ├── cifar10_noaug.py
│ │ │ │ ├── cifar10_nopad.py
│ │ │ │ ├── comp1k.py
│ │ │ │ ├── deblurring-defocus_test_config.py
│ │ │ │ ├── deblurring-motion_test_config.py
│ │ │ │ ├── decompression_test_config.py
│ │ │ │ ├── denoising-gaussian_color_test_config.py
│ │ │ │ ├── denoising-gaussian_gray_test_config.py
│ │ │ │ ├── denoising-real_test_config.py
│ │ │ │ ├── deraining_test_config.py
│ │ │ │ ├── ffhq_flip.py
│ │ │ │ ├── grow_scale_imgs_ffhq_styleganv1.py
│ │ │ │ ├── imagenet_128.py
│ │ │ │ ├── imagenet_256.py
│ │ │ │ ├── imagenet_512.py
│ │ │ │ ├── imagenet_64.py
│ │ │ │ ├── imagenet_noaug_128.py
│ │ │ │ ├── liif_test_config.py
│ │ │ │ ├── lsun_stylegan.py
│ │ │ │ ├── paired_imgs_256x256_crop.py
│ │ │ │ ├── places.py
│ │ │ │ ├── sisr_x2_test_config.py
│ │ │ │ ├── sisr_x3_test_config.py
│ │ │ │ ├── sisr_x4_test_config.py
│ │ │ │ ├── tdan_test_config.py
│ │ │ │ ├── unconditional_imgs_128x128.py
│ │ │ │ ├── unconditional_imgs_64x64.py
│ │ │ │ ├── unconditional_imgs_flip_512x512.py
│ │ │ │ ├── unconditional_imgs_flip_lanczos_resize_256x256.py
│ │ │ │ └── unpaired_imgs_256x256.py
│ │ │ ├── default_runtime.py
│ │ │ ├── gen_default_runtime.py
│ │ │ ├── inpaint_default_runtime.py
│ │ │ ├── matting_default_runtime.py
│ │ │ ├── models/
│ │ │ │ ├── base_cyclegan.py
│ │ │ │ ├── base_deepfillv1.py
│ │ │ │ ├── base_deepfillv2.py
│ │ │ │ ├── base_edvr.py
│ │ │ │ ├── base_gl.py
│ │ │ │ ├── base_glean.py
│ │ │ │ ├── base_liif.py
│ │ │ │ ├── base_pconv.py
│ │ │ │ ├── base_pix2pix.py
│ │ │ │ ├── base_styleganv1.py
│ │ │ │ ├── base_styleganv2.py
│ │ │ │ ├── base_styleganv3.py
│ │ │ │ ├── base_tof.py
│ │ │ │ ├── biggan/
│ │ │ │ │ └── base_biggan_128x128.py
│ │ │ │ ├── dcgan/
│ │ │ │ │ ├── base_dcgan_128x128.py
│ │ │ │ │ └── base_dcgan_64x64.py
│ │ │ │ ├── sagan/
│ │ │ │ │ ├── base_sagan_128x128.py
│ │ │ │ │ └── base_sagan_32x32.py
│ │ │ │ └── sngan_proj/
│ │ │ │ ├── base_sngan_proj_128x128.py
│ │ │ │ └── base_sngan_proj_32x32.py
│ │ │ └── schedules/
│ │ │ └── .gitkeep
│ │ ├── biggan/
│ │ │ ├── biggan-deep_cvt-hugging-face-rgb_imagenet1k-128x128.py
│ │ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-256x256.py
│ │ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-512x512.py
│ │ │ ├── biggan_2xb25-500kiters_cifar10-32x32.py
│ │ │ ├── biggan_ajbrock-sn_8xb32-1500kiters_imagenet1k-128x128.py
│ │ │ └── biggan_cvt-BigGAN-PyTorch-rgb_imagenet1k-128x128.py
│ │ ├── dreambooth/
│ │ │ ├── dreambooth-finetune_text_encoder.py
│ │ │ ├── dreambooth-prior_pre.py
│ │ │ ├── dreambooth.py
│ │ │ ├── dreambooth_lora-prior_pre.py
│ │ │ └── dreambooth_lora.py
│ │ ├── eg3d/
│ │ │ ├── eg3d_cvt-official-rgb_afhq-512x512.py
│ │ │ ├── eg3d_cvt-official-rgb_ffhq-512x512.py
│ │ │ └── eg3d_cvt-official-rgb_shapenet-128x128.py
│ │ ├── guided_diffusion/
│ │ │ ├── adm-g_ddim25_8xb32_imagenet_256x256.py
│ │ │ ├── adm-g_ddim25_8xb32_imagenet_512x512.py
│ │ │ ├── adm-g_ddim25_8xb32_imagenet_64x64.py
│ │ │ ├── adm_ddim250_8xb32_imagenet_256x256.py
│ │ │ ├── adm_ddim250_8xb32_imagenet_512x512.py
│ │ │ └── adm_ddim250_8xb32_imagenet_64x64.py
│ │ ├── inst_colorization/
│ │ │ └── inst-colorizatioon_full_official_cocostuff-256x256.py
│ │ ├── real_basicvsr/
│ │ │ ├── realbasicvsr_c64b20_1x30x8_8xb1_lr5e_5_150k_reds.py
│ │ │ └── realbasicvsr_wogan_c64b20_2x30x8_8xb2_lr1e_4_300k_reds.py
│ │ ├── styleganv2/
│ │ │ ├── stylegan2_c2_8xb4_800kiters_ffhq_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_800kiters_lsun_cat_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_800kiters_lsun_church_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_800kiters_lsun_horse_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_ffhq_1024x1024.py
│ │ │ ├── stylegan2_c2_8xb4_lsun_car_384x512.py
│ │ │ ├── stylegan2_c2_PL_8xb4_fp16_partial_GD_no_scaler_800kiters_ffhq_256x256.py
│ │ │ ├── stylegan2_c2_PL_R1_8xb4_apex_fp16_no_scaler_800kiters_ffhq_256x256.py
│ │ │ └── stylegan2_c2_PL_R1_8xb4_fp16_globalG_partialD_no_scaler_800kiters_ffhq_256x256.py
│ │ └── styleganv3/
│ │ ├── stylegan3_r_ada_gamma33_8xb4_fp16_metfaces_1024x1024.py
│ │ ├── stylegan3_r_cvt_official_rgb_8xb4_ffhq_1024x1024.py
│ │ ├── stylegan3_r_cvt_official_rgb_8xb4_ffhqu_256x256.py
│ │ ├── stylegan3_r_cvt_official_rgb_8xb4x8_afhqv2_512x512.py
│ │ ├── stylegan3_t_ada_gamma66_8xb4_fp16_metfaces_1024x1024.py
│ │ ├── stylegan3_t_cvt_official_rgb_8xb4_afhqv2_512x512.py
│ │ ├── stylegan3_t_cvt_official_rgb_8xb4_ffhq_1024x1024.py
│ │ ├── stylegan3_t_cvt_official_rgb_8xb4_ffhqu_256x256.py
│ │ ├── stylegan3_t_gamma20_8xb4_fp16_noaug_ffhq_256x256.py
│ │ └── stylegan3_t_gamma328_8xb4_fp16_noaug_ffhq_1024x1024.py
│ ├── datasets/
│ │ ├── __init__.py
│ │ ├── basic_conditional_dataset.py
│ │ ├── basic_frames_dataset.py
│ │ ├── basic_image_dataset.py
│ │ ├── categories.py
│ │ ├── cifar10_dataset.py
│ │ ├── comp1k_dataset.py
│ │ ├── controlnet_dataset.py
│ │ ├── data_utils.py
│ │ ├── dreambooth_dataset.py
│ │ ├── grow_scale_image_dataset.py
│ │ ├── imagenet_dataset.py
│ │ ├── mscoco_dataset.py
│ │ ├── paired_image_dataset.py
│ │ ├── singan_dataset.py
│ │ ├── textual_inversion_dataset.py
│ │ ├── transforms/
│ │ │ ├── __init__.py
│ │ │ ├── albu_function.py
│ │ │ ├── albumentations.py
│ │ │ ├── alpha.py
│ │ │ ├── aug_frames.py
│ │ │ ├── aug_pixel.py
│ │ │ ├── aug_shape.py
│ │ │ ├── blur_kernels.py
│ │ │ ├── crop.py
│ │ │ ├── fgbg.py
│ │ │ ├── formatting.py
│ │ │ ├── generate_assistant.py
│ │ │ ├── generate_frame_indices.py
│ │ │ ├── get_masked_image.py
│ │ │ ├── loading.py
│ │ │ ├── matlab_like_resize.py
│ │ │ ├── normalization.py
│ │ │ ├── random_degradations.py
│ │ │ ├── random_down_sampling.py
│ │ │ ├── trimap.py
│ │ │ └── values.py
│ │ └── unpaired_image_dataset.py
│ ├── engine/
│ │ ├── __init__.py
│ │ ├── hooks/
│ │ │ ├── __init__.py
│ │ │ ├── ema.py
│ │ │ ├── iter_time_hook.py
│ │ │ ├── pggan_fetch_data_hook.py
│ │ │ ├── pickle_data_hook.py
│ │ │ ├── reduce_lr_scheduler_hook.py
│ │ │ └── visualization_hook.py
│ │ ├── optimizers/
│ │ │ ├── __init__.py
│ │ │ ├── multi_optimizer_constructor.py
│ │ │ ├── pggan_optimizer_constructor.py
│ │ │ └── singan_optimizer_constructor.py
│ │ ├── runner/
│ │ │ ├── __init__.py
│ │ │ ├── log_processor.py
│ │ │ ├── loop_utils.py
│ │ │ └── multi_loops.py
│ │ └── schedulers/
│ │ ├── __init__.py
│ │ ├── linear_lr_scheduler_with_interval.py
│ │ └── reduce_lr_scheduler.py
│ ├── evaluation/
│ │ ├── __init__.py
│ │ ├── evaluator.py
│ │ ├── functional/
│ │ │ ├── __init__.py
│ │ │ ├── fid_inception.py
│ │ │ ├── gaussian_funcs.py
│ │ │ └── inception_utils.py
│ │ └── metrics/
│ │ ├── __init__.py
│ │ ├── base_gen_metric.py
│ │ ├── base_sample_wise_metric.py
│ │ ├── connectivity_error.py
│ │ ├── equivariance.py
│ │ ├── fid.py
│ │ ├── gradient_error.py
│ │ ├── inception_score.py
│ │ ├── mae.py
│ │ ├── matting_mse.py
│ │ ├── metrics_utils.py
│ │ ├── ms_ssim.py
│ │ ├── mse.py
│ │ ├── niqe.py
│ │ ├── niqe_pris_params.npz
│ │ ├── ppl.py
│ │ ├── precision_and_recall.py
│ │ ├── psnr.py
│ │ ├── sad.py
│ │ ├── snr.py
│ │ ├── ssim.py
│ │ └── swd.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── archs/
│ │ │ ├── __init__.py
│ │ │ ├── all_gather_layer.py
│ │ │ ├── aspp.py
│ │ │ ├── attention_injection.py
│ │ │ ├── conv.py
│ │ │ ├── downsample.py
│ │ │ ├── ensemble.py
│ │ │ ├── gated_conv_module.py
│ │ │ ├── img_normalize.py
│ │ │ ├── linear_module.py
│ │ │ ├── lora.py
│ │ │ ├── multi_layer_disc.py
│ │ │ ├── patch_disc.py
│ │ │ ├── resnet.py
│ │ │ ├── separable_conv_module.py
│ │ │ ├── simple_encoder_decoder.py
│ │ │ ├── smpatch_disc.py
│ │ │ ├── sr_backbone.py
│ │ │ ├── tokenizer.py
│ │ │ ├── upsample.py
│ │ │ ├── vgg.py
│ │ │ └── wrapper.py
│ │ ├── base_models/
│ │ │ ├── __init__.py
│ │ │ ├── average_model.py
│ │ │ ├── base_conditional_gan.py
│ │ │ ├── base_edit_model.py
│ │ │ ├── base_gan.py
│ │ │ ├── base_mattor.py
│ │ │ ├── base_translation_model.py
│ │ │ ├── basic_interpolator.py
│ │ │ ├── one_stage.py
│ │ │ └── two_stage.py
│ │ ├── data_preprocessors/
│ │ │ ├── __init__.py
│ │ │ ├── data_preprocessor.py
│ │ │ └── mattor_preprocessor.py
│ │ ├── diffusion_schedulers/
│ │ │ ├── __init__.py
│ │ │ ├── ddim_scheduler.py
│ │ │ └── ddpm_scheduler.py
│ │ ├── editors/
│ │ │ ├── __init__.py
│ │ │ ├── animatediff/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── animatediff.py
│ │ │ │ ├── animatediff_utils.py
│ │ │ │ ├── attention_3d.py
│ │ │ │ ├── motion_module.py
│ │ │ │ ├── resnet_3d.py
│ │ │ │ ├── unet_3d.py
│ │ │ │ └── unet_block.py
│ │ │ ├── aotgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── aot_decoder.py
│ │ │ │ ├── aot_encoder.py
│ │ │ │ ├── aot_encoder_decoder.py
│ │ │ │ ├── aot_inpaintor.py
│ │ │ │ └── aot_neck.py
│ │ │ ├── arcface/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── arcface_modules.py
│ │ │ │ ├── id_loss.py
│ │ │ │ └── model_irse.py
│ │ │ ├── basicvsr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── basicvsr.py
│ │ │ │ └── basicvsr_net.py
│ │ │ ├── basicvsr_plusplus_net/
│ │ │ │ ├── __init__.py
│ │ │ │ └── basicvsr_plusplus_net.py
│ │ │ ├── biggan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── biggan.py
│ │ │ │ ├── biggan_deep_discriminator.py
│ │ │ │ ├── biggan_deep_generator.py
│ │ │ │ ├── biggan_discriminator.py
│ │ │ │ ├── biggan_generator.py
│ │ │ │ ├── biggan_modules.py
│ │ │ │ └── biggan_snmodule.py
│ │ │ ├── cain/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── cain.py
│ │ │ │ └── cain_net.py
│ │ │ ├── controlnet/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── controlnet.py
│ │ │ │ └── controlnet_utils.py
│ │ │ ├── cyclegan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── cyclegan.py
│ │ │ │ ├── cyclegan_generator.py
│ │ │ │ └── cyclegan_modules.py
│ │ │ ├── dcgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── dcgan.py
│ │ │ │ ├── dcgan_discriminator.py
│ │ │ │ └── dcgan_generator.py
│ │ │ ├── ddpm/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── attention.py
│ │ │ │ ├── denoising_unet.py
│ │ │ │ ├── embeddings.py
│ │ │ │ ├── res_blocks.py
│ │ │ │ └── unet_blocks.py
│ │ │ ├── deblurganv2/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── deblurganv2.py
│ │ │ │ ├── deblurganv2_discriminator.py
│ │ │ │ ├── deblurganv2_generator.py
│ │ │ │ └── deblurganv2_util.py
│ │ │ ├── deepfillv1/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── contextual_attention.py
│ │ │ │ ├── contextual_attention_neck.py
│ │ │ │ ├── deepfill_decoder.py
│ │ │ │ ├── deepfill_disc.py
│ │ │ │ ├── deepfill_encoder.py
│ │ │ │ ├── deepfill_refiner.py
│ │ │ │ └── deepfillv1.py
│ │ │ ├── deepfillv2/
│ │ │ │ ├── __init__.py
│ │ │ │ └── two_stage_encoder_decoder.py
│ │ │ ├── dic/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── dic.py
│ │ │ │ ├── dic_net.py
│ │ │ │ ├── feedback_hour_glass.py
│ │ │ │ └── light_cnn.py
│ │ │ ├── dim/
│ │ │ │ ├── __init__.py
│ │ │ │ └── dim.py
│ │ │ ├── disco_diffusion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── clip_wrapper.py
│ │ │ │ ├── disco.py
│ │ │ │ ├── guider.py
│ │ │ │ └── secondary_model.py
│ │ │ ├── dreambooth/
│ │ │ │ ├── __init__.py
│ │ │ │ └── dreambooth.py
│ │ │ ├── duf/
│ │ │ │ ├── __init__.py
│ │ │ │ └── duf.py
│ │ │ ├── edsr/
│ │ │ │ ├── __init__.py
│ │ │ │ └── edsr_net.py
│ │ │ ├── edvr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── edvr.py
│ │ │ │ └── edvr_net.py
│ │ │ ├── eg3d/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── camera.py
│ │ │ │ ├── dual_discriminator.py
│ │ │ │ ├── eg3d.py
│ │ │ │ ├── eg3d_generator.py
│ │ │ │ ├── eg3d_modules.py
│ │ │ │ ├── eg3d_utils.py
│ │ │ │ ├── ray_sampler.py
│ │ │ │ └── renderer.py
│ │ │ ├── esrgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── esrgan.py
│ │ │ │ └── rrdb_net.py
│ │ │ ├── fastcomposer/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── fastcomposer.py
│ │ │ │ └── fastcomposer_util.py
│ │ │ ├── fba/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── fba_decoder.py
│ │ │ │ └── fba_encoder.py
│ │ │ ├── flavr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── flavr.py
│ │ │ │ └── flavr_net.py
│ │ │ ├── gca/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── gca.py
│ │ │ │ ├── gca_module.py
│ │ │ │ ├── resgca_dec.py
│ │ │ │ └── resgca_enc.py
│ │ │ ├── ggan/
│ │ │ │ ├── __init__.py
│ │ │ │ └── ggan.py
│ │ │ ├── glean/
│ │ │ │ ├── __init__.py
│ │ │ │ └── glean_styleganv2.py
│ │ │ ├── global_local/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── gl_decoder.py
│ │ │ │ ├── gl_dilation.py
│ │ │ │ ├── gl_disc.py
│ │ │ │ ├── gl_encoder.py
│ │ │ │ ├── gl_encoder_decoder.py
│ │ │ │ └── gl_inpaintor.py
│ │ │ ├── guided_diffusion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── adm.py
│ │ │ │ └── classifier.py
│ │ │ ├── iconvsr/
│ │ │ │ ├── __init__.py
│ │ │ │ └── iconvsr_net.py
│ │ │ ├── indexnet/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── indexnet.py
│ │ │ │ ├── indexnet_decoder.py
│ │ │ │ └── indexnet_encoder.py
│ │ │ ├── inst_colorization/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── color_utils.py
│ │ │ │ ├── colorization_net.py
│ │ │ │ ├── fusion_net.py
│ │ │ │ ├── inst_colorization.py
│ │ │ │ └── weight_layer.py
│ │ │ ├── liif/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── liif.py
│ │ │ │ ├── liif_net.py
│ │ │ │ └── mlp_refiner.py
│ │ │ ├── lsgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── lsgan.py
│ │ │ │ ├── lsgan_discriminator.py
│ │ │ │ └── lsgan_generator.py
│ │ │ ├── mspie/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── mspie_stylegan2.py
│ │ │ │ ├── mspie_stylegan2_discriminator.py
│ │ │ │ ├── mspie_stylegan2_generator.py
│ │ │ │ ├── mspie_stylegan2_modules.py
│ │ │ │ ├── pe_singan.py
│ │ │ │ ├── pe_singan_generator.py
│ │ │ │ └── positional_encoding.py
│ │ │ ├── nafnet/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── naf_avgpool2d.py
│ │ │ │ ├── naf_layerNorm2d.py
│ │ │ │ ├── nafbaseline_net.py
│ │ │ │ └── nafnet_net.py
│ │ │ ├── pconv/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── mask_conv_module.py
│ │ │ │ ├── partial_conv.py
│ │ │ │ ├── pconv_decoder.py
│ │ │ │ ├── pconv_encoder.py
│ │ │ │ ├── pconv_encoder_decoder.py
│ │ │ │ └── pconv_inpaintor.py
│ │ │ ├── pggan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── pggan.py
│ │ │ │ ├── pggan_discriminator.py
│ │ │ │ ├── pggan_generator.py
│ │ │ │ └── pggan_modules.py
│ │ │ ├── pix2pix/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── pix2pix.py
│ │ │ │ ├── pix2pix_generator.py
│ │ │ │ └── pix2pix_modules.py
│ │ │ ├── plain/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── plain_decoder.py
│ │ │ │ └── plain_refiner.py
│ │ │ ├── rdn/
│ │ │ │ ├── __init__.py
│ │ │ │ └── rdn_net.py
│ │ │ ├── real_basicvsr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── real_basicvsr.py
│ │ │ │ └── real_basicvsr_net.py
│ │ │ ├── real_esrgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── real_esrgan.py
│ │ │ │ └── unet_disc.py
│ │ │ ├── restormer/
│ │ │ │ ├── __init__.py
│ │ │ │ └── restormer_net.py
│ │ │ ├── sagan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── sagan.py
│ │ │ │ ├── sagan_discriminator.py
│ │ │ │ ├── sagan_generator.py
│ │ │ │ └── sagan_modules.py
│ │ │ ├── singan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── singan.py
│ │ │ │ ├── singan_discriminator.py
│ │ │ │ ├── singan_generator.py
│ │ │ │ └── singan_modules.py
│ │ │ ├── srcnn/
│ │ │ │ ├── __init__.py
│ │ │ │ └── srcnn_net.py
│ │ │ ├── srgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── modified_vgg.py
│ │ │ │ ├── sr_resnet.py
│ │ │ │ └── srgan.py
│ │ │ ├── stable_diffusion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── clip_wrapper.py
│ │ │ │ ├── stable_diffusion.py
│ │ │ │ ├── stable_diffusion_inpaint.py
│ │ │ │ └── vae.py
│ │ │ ├── stable_diffusion_xl/
│ │ │ │ ├── __init__.py
│ │ │ │ └── stable_diffusion_xl.py
│ │ │ ├── stylegan1/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── stylegan1.py
│ │ │ │ ├── stylegan1_discriminator.py
│ │ │ │ ├── stylegan1_generator.py
│ │ │ │ ├── stylegan1_modules.py
│ │ │ │ └── stylegan_utils.py
│ │ │ ├── stylegan2/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ada/
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── augment.py
│ │ │ │ │ ├── grid_sample_gradfix.py
│ │ │ │ │ ├── misc.py
│ │ │ │ │ └── upfirdn2d.py
│ │ │ │ ├── stylegan2.py
│ │ │ │ ├── stylegan2_discriminator.py
│ │ │ │ ├── stylegan2_generator.py
│ │ │ │ └── stylegan2_modules.py
│ │ │ ├── stylegan3/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── stylegan3.py
│ │ │ │ ├── stylegan3_generator.py
│ │ │ │ ├── stylegan3_modules.py
│ │ │ │ └── stylegan3_utils.py
│ │ │ ├── swinir/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── swinir_modules.py
│ │ │ │ ├── swinir_net.py
│ │ │ │ ├── swinir_rstb.py
│ │ │ │ └── swinir_utils.py
│ │ │ ├── tdan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── tdan.py
│ │ │ │ └── tdan_net.py
│ │ │ ├── textual_inversion/
│ │ │ │ ├── __init__.py
│ │ │ │ └── textual_inversion.py
│ │ │ ├── tof/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── tof_vfi_net.py
│ │ │ │ └── tof_vsr_net.py
│ │ │ ├── ttsr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── lte.py
│ │ │ │ ├── search_transformer.py
│ │ │ │ ├── ttsr.py
│ │ │ │ ├── ttsr_disc.py
│ │ │ │ └── ttsr_net.py
│ │ │ ├── vico/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── vico.py
│ │ │ │ └── vico_utils.py
│ │ │ └── wgan_gp/
│ │ │ ├── __init__.py
│ │ │ ├── wgan_discriminator.py
│ │ │ ├── wgan_generator.py
│ │ │ ├── wgan_gp.py
│ │ │ └── wgan_gp_module.py
│ │ ├── losses/
│ │ │ ├── __init__.py
│ │ │ ├── adv_loss.py
│ │ │ ├── clip_loss.py
│ │ │ ├── composition_loss.py
│ │ │ ├── face_id_loss.py
│ │ │ ├── feature_loss.py
│ │ │ ├── gan_loss.py
│ │ │ ├── gradient_loss.py
│ │ │ ├── loss_comps/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── clip_loss_comps.py
│ │ │ │ ├── disc_auxiliary_loss_comps.py
│ │ │ │ ├── face_id_loss_comps.py
│ │ │ │ ├── gan_loss_comps.py
│ │ │ │ └── gen_auxiliary_loss_comps.py
│ │ │ ├── loss_wrapper.py
│ │ │ ├── perceptual_loss.py
│ │ │ └── pixelwise_loss.py
│ │ └── utils/
│ │ ├── __init__.py
│ │ ├── bbox_utils.py
│ │ ├── diffusion_utils.py
│ │ ├── flow_warp.py
│ │ ├── model_utils.py
│ │ ├── sampling_utils.py
│ │ ├── tensor_utils.py
│ │ └── tome_utils.py
│ ├── registry.py
│ ├── structures/
│ │ ├── __init__.py
│ │ └── data_sample.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── cli.py
│ │ ├── collect_env.py
│ │ ├── img_utils.py
│ │ ├── io_utils.py
│ │ ├── logger.py
│ │ ├── sampler.py
│ │ ├── setup_env.py
│ │ ├── trans_utils.py
│ │ └── typing.py
│ ├── version.py
│ └── visualization/
│ ├── __init__.py
│ ├── concat_visualizer.py
│ ├── vis_backend.py
│ └── visualizer.py
├── model-index.yml
├── projects/
│ ├── README.md
│ ├── animated_drawings/
│ │ ├── README.md
│ │ ├── bvh/
│ │ │ └── zombie.bvh
│ │ ├── characters/
│ │ │ └── slamdunk/
│ │ │ └── char_cfg.yaml
│ │ ├── configs/
│ │ │ ├── motion/
│ │ │ │ └── zombie.yaml
│ │ │ ├── mvc/
│ │ │ │ └── slamdunk.yaml
│ │ │ └── retarget/
│ │ │ └── fair1_spf.yaml
│ │ └── tools/
│ │ ├── generate_character.py
│ │ └── generate_video.py
│ ├── example_project/
│ │ ├── README.md
│ │ ├── configs/
│ │ │ └── examplenet_8xb32_in1k.py
│ │ └── models/
│ │ ├── __init__.py
│ │ └── example_net.py
│ ├── flow_style_vton/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── configs/
│ │ │ └── flow_style_vton_PFAFN_epoch_101.py
│ │ ├── inference.py
│ │ ├── models/
│ │ │ ├── __init__.py
│ │ │ ├── afwm.py
│ │ │ ├── flow_style_vton_model.py
│ │ │ └── generator.py
│ │ ├── test_pairs.txt
│ │ └── vton_dataset.py
│ ├── glide/
│ │ ├── configs/
│ │ │ ├── README.md
│ │ │ ├── glide_ddim-classifier-free_laion-64-256.py
│ │ │ └── glide_ddim-classifier-free_laion-64x64.py
│ │ └── models/
│ │ ├── __init__.py
│ │ ├── glide.py
│ │ ├── glide_modules.py
│ │ ├── glide_tokenizer/
│ │ │ ├── __init__.py
│ │ │ ├── bpe.py
│ │ │ └── simple_tokenizer.py
│ │ └── text2im_unet.py
│ ├── magicmaker/
│ │ └── index.html
│ ├── powerpaint/
│ │ ├── README.md
│ │ ├── gradio_PowerPaint.py
│ │ ├── pipeline/
│ │ │ ├── pipeline_PowerPaint.py
│ │ │ └── pipeline_PowerPaint_ControlNet.py
│ │ ├── requirements.txt
│ │ └── utils/
│ │ └── utils.py
│ └── prompt_to_prompt/
│ ├── README.md
│ ├── inversions/
│ │ ├── __init__.py
│ │ ├── ddim_inversion.py
│ │ └── null_text_inversion.py
│ ├── models/
│ │ ├── ptp.py
│ │ ├── ptp_utils.py
│ │ └── seq_aligner.py
│ └── visualize.ipynb
├── requirements/
│ ├── docs.txt
│ ├── mminstall.txt
│ ├── optional.txt
│ ├── readthedocs.txt
│ ├── runtime.txt
│ └── tests.txt
├── requirements.txt
├── setup.cfg
├── setup.py
├── tests/
│ ├── configs/
│ │ ├── aot_test.py
│ │ ├── deepfillv1_test.py
│ │ ├── diffuser_wrapper_cfg/
│ │ │ └── config.json
│ │ ├── gl_test.py
│ │ ├── one_stage_gl.py
│ │ ├── pconv_test.py
│ │ └── two_stage_test.py
│ ├── data/
│ │ ├── coco/
│ │ │ └── annotations/
│ │ │ ├── captions_train2014.json
│ │ │ └── captions_val2014.json
│ │ ├── controlnet/
│ │ │ └── prompt.json
│ │ ├── dataset/
│ │ │ ├── anno.json
│ │ │ ├── anno.txt
│ │ │ ├── c/
│ │ │ │ └── c.not_support_type
│ │ │ ├── classes.txt
│ │ │ └── wrong.yml
│ │ ├── frames/
│ │ │ ├── ann1.txt
│ │ │ ├── ann2.txt
│ │ │ └── ann3.txt
│ │ ├── image/
│ │ │ └── train.txt
│ │ ├── inpainting/
│ │ │ ├── mask_list.txt
│ │ │ └── mask_list_single_ch.txt
│ │ ├── lq.lmdb/
│ │ │ ├── data.mdb
│ │ │ ├── lock.mdb
│ │ │ └── meta_info.txt
│ │ ├── matting_dataset/
│ │ │ ├── ann.json
│ │ │ └── ann_old.json
│ │ └── textual_inversion/
│ │ └── imagenet_templates_small.txt
│ ├── test_apis/
│ │ ├── test_inferencers/
│ │ │ ├── test_base_mmagic_inferencer.py
│ │ │ ├── test_colorization_inferencer.py
│ │ │ ├── test_conditional_inferencer.py
│ │ │ ├── test_diffusers_pipeline_inferencer.py
│ │ │ ├── test_eg3d_inferencer.py
│ │ │ ├── test_image_super_resolution_inferencer.py
│ │ │ ├── test_inference_functions.py
│ │ │ ├── test_inpainting_inferencer.py
│ │ │ ├── test_matting_inferencer.py
│ │ │ ├── test_mmedit_inferencer.py
│ │ │ ├── test_text2image_inferencers.py
│ │ │ ├── test_translation_inferencer.py
│ │ │ ├── test_unconditional_inferencer.py
│ │ │ ├── test_video_interpolation_inferencer.py
│ │ │ └── test_video_restoration_inferencer.py
│ │ └── test_mmagic_inferencer.py
│ ├── test_datasets/
│ │ ├── test_basic_conditional_dataset.py
│ │ ├── test_basic_frames_dataset.py
│ │ ├── test_basic_image_dataset.py
│ │ ├── test_categories.py
│ │ ├── test_cifar10_dataset.py
│ │ ├── test_comp1k_dataset.py
│ │ ├── test_controlnet_dataset.py
│ │ ├── test_data_utils.py
│ │ ├── test_dreambooth_dataset.py
│ │ ├── test_grow_scale_image_dataset.py
│ │ ├── test_imagenet_dataset.py
│ │ ├── test_mscoco_dataset.py
│ │ ├── test_paired_image_dataset.py
│ │ ├── test_singan_dataset.py
│ │ ├── test_textual_inversion_dataset.py
│ │ ├── test_transforms/
│ │ │ ├── test_albumentations.py
│ │ │ ├── test_alpha.py
│ │ │ ├── test_aug_frames.py
│ │ │ ├── test_aug_pixel.py
│ │ │ ├── test_aug_shape.py
│ │ │ ├── test_blur_kernels.py
│ │ │ ├── test_crop.py
│ │ │ ├── test_fgbg.py
│ │ │ ├── test_formatting.py
│ │ │ ├── test_generate_assistant.py
│ │ │ ├── test_generate_frame_indices.py
│ │ │ ├── test_get_masked_image.py
│ │ │ ├── test_loading.py
│ │ │ ├── test_matlab_like_resize.py
│ │ │ ├── test_normalization.py
│ │ │ ├── test_random_degradations.py
│ │ │ ├── test_random_down_sampling.py
│ │ │ ├── test_trimap.py
│ │ │ └── test_values.py
│ │ └── test_unpaired_image_dataset.py
│ ├── test_engine/
│ │ ├── test_hooks/
│ │ │ ├── test_ema.py
│ │ │ ├── test_iter_time_hook.py
│ │ │ ├── test_pggan_fetch_data_hook.py
│ │ │ ├── test_pickle_data_hook.py
│ │ │ ├── test_reduce_lr_scheduler_hook.py
│ │ │ └── test_visualization_hook.py
│ │ ├── test_optimizers/
│ │ │ ├── test_multi_optimizer_constructor.py
│ │ │ ├── test_pggan_optimizer_constructor.py
│ │ │ └── test_singan_optimizer_constructor.py
│ │ ├── test_runner/
│ │ │ ├── test_log_processor.py
│ │ │ ├── test_loop_utils.py
│ │ │ └── test_multi_loops.py
│ │ └── test_schedulers/
│ │ ├── test_linear_lr_scheduler_with_interval.py
│ │ └── test_reduce_lr_scheduler.py
│ ├── test_evaluation/
│ │ ├── test_evaluator.py
│ │ ├── test_functional/
│ │ │ ├── test_fid_inception.py
│ │ │ ├── test_gaussian_funcs.py
│ │ │ └── test_inception_utils.py
│ │ └── test_metrics/
│ │ ├── test_base_gen_metric.py
│ │ ├── test_base_sample_wise_metric.py
│ │ ├── test_connectivity_error.py
│ │ ├── test_equivariance.py
│ │ ├── test_fid.py
│ │ ├── test_gradient_error.py
│ │ ├── test_inception_score.py
│ │ ├── test_mae.py
│ │ ├── test_matting_mse.py
│ │ ├── test_metrics_utils.py
│ │ ├── test_ms_ssim.py
│ │ ├── test_mse.py
│ │ ├── test_niqe.py
│ │ ├── test_ppl.py
│ │ ├── test_precision_and_recall.py
│ │ ├── test_psnr.py
│ │ ├── test_sad.py
│ │ ├── test_snr.py
│ │ ├── test_ssim.py
│ │ └── test_swd.py
│ ├── test_models/
│ │ ├── test_archs/
│ │ │ ├── test_aspp.py
│ │ │ ├── test_conv.py
│ │ │ ├── test_downsample.py
│ │ │ ├── test_ensemble.py
│ │ │ ├── test_gated_conv_module.py
│ │ │ ├── test_img_normalize.py
│ │ │ ├── test_linear_module.py
│ │ │ ├── test_lora.py
│ │ │ ├── test_multi_layer_disc.py
│ │ │ ├── test_patch_disc.py
│ │ │ ├── test_resnet.py
│ │ │ ├── test_separable_conv_module.py
│ │ │ ├── test_simple_encoder_decoder.py
│ │ │ ├── test_smpatch_disc.py
│ │ │ ├── test_sr_backbone.py
│ │ │ ├── test_tokenizer.py
│ │ │ ├── test_upsample.py
│ │ │ ├── test_vgg.py
│ │ │ └── test_wrapper.py
│ │ ├── test_base_models/
│ │ │ ├── test_average_model.py
│ │ │ ├── test_base_conditional_gan.py
│ │ │ ├── test_base_edit_model.py
│ │ │ ├── test_base_gan.py
│ │ │ ├── test_base_mattor.py
│ │ │ ├── test_base_translation_model.py
│ │ │ ├── test_basic_interpolator.py
│ │ │ ├── test_one_stage.py
│ │ │ └── test_two_stage.py
│ │ ├── test_data_preprocessors/
│ │ │ ├── test_data_preprocessor.py
│ │ │ └── test_mattor_preprocessor.py
│ │ ├── test_diffusion_schedulers/
│ │ │ ├── test_ddim_scheduler.py
│ │ │ └── test_init.py
│ │ ├── test_editors/
│ │ │ ├── test_animatediff/
│ │ │ │ ├── test_animatediff.py
│ │ │ │ ├── test_attention3d.py
│ │ │ │ ├── test_motion_module.py
│ │ │ │ ├── test_res_blocks3d.py
│ │ │ │ ├── test_unet3d.py
│ │ │ │ └── test_unet_blocks3d.py
│ │ │ ├── test_aotgan/
│ │ │ │ ├── test_aot_decoder.py
│ │ │ │ ├── test_aot_encoder.py
│ │ │ │ ├── test_aot_encoder_decoder.py
│ │ │ │ ├── test_aot_inpaintor.py
│ │ │ │ └── test_aot_neck.py
│ │ │ ├── test_arcface/
│ │ │ │ ├── test_arcface_modules.py
│ │ │ │ ├── test_id_loss.py
│ │ │ │ └── test_model_irse.py
│ │ │ ├── test_basicvsr/
│ │ │ │ ├── test_basicvsr.py
│ │ │ │ └── test_basicvsr_net.py
│ │ │ ├── test_basicvsr_plusplus_net/
│ │ │ │ └── test_basicvsr_plusplus_net.py
│ │ │ ├── test_biggan/
│ │ │ │ ├── test_biggan.py
│ │ │ │ ├── test_biggan_deep_discriminator.py
│ │ │ │ ├── test_biggan_deep_generator.py
│ │ │ │ ├── test_biggan_discriminator.py
│ │ │ │ ├── test_biggan_generator.py
│ │ │ │ ├── test_biggan_modules.py
│ │ │ │ └── test_biggan_snmodule.py
│ │ │ ├── test_cain/
│ │ │ │ ├── test_cain.py
│ │ │ │ └── test_cain_net.py
│ │ │ ├── test_controlnet/
│ │ │ │ ├── test_controlnet.py
│ │ │ │ └── test_controlnet_utils.py
│ │ │ ├── test_cyclegan/
│ │ │ │ ├── test_cyclegan.py
│ │ │ │ ├── test_cyclegan_generator.py
│ │ │ │ └── test_cyclegan_modules.py
│ │ │ ├── test_dcgan/
│ │ │ │ ├── test_dcgan.py
│ │ │ │ ├── test_dcgan_discriminator.py
│ │ │ │ └── test_dcgan_generator.py
│ │ │ ├── test_ddpm/
│ │ │ │ ├── test_attention.py
│ │ │ │ ├── test_ddpm_scheduler.py
│ │ │ │ ├── test_denoising_unet.py
│ │ │ │ ├── test_embeddings.py
│ │ │ │ ├── test_res_blocks.py
│ │ │ │ └── test_unet_blocks.py
│ │ │ ├── test_deblurganv2/
│ │ │ │ ├── test_deblurganv2.py
│ │ │ │ ├── test_deblurganv2_discriminator.py
│ │ │ │ └── test_deblurganv2_generator.py
│ │ │ ├── test_deepfillv1/
│ │ │ │ ├── test_contextual_attention.py
│ │ │ │ ├── test_contextual_attention_neck.py
│ │ │ │ ├── test_deepfill_decoder.py
│ │ │ │ ├── test_deepfill_disc.py
│ │ │ │ ├── test_deepfill_encoder.py
│ │ │ │ ├── test_deepfill_refiner.py
│ │ │ │ └── test_deepfillv1.py
│ │ │ ├── test_deepfillv2/
│ │ │ │ └── test_two_stage_encoder_decoder.py
│ │ │ ├── test_dic/
│ │ │ │ ├── test_dic.py
│ │ │ │ ├── test_dic_net.py
│ │ │ │ ├── test_feedback_hour_glass.py
│ │ │ │ └── test_light_cnn.py
│ │ │ ├── test_dim/
│ │ │ │ └── test_dim.py
│ │ │ ├── test_disco_diffusion/
│ │ │ │ ├── test_disco_diffusion.py
│ │ │ │ └── test_disco_diffusion_clip_wrapper.py
│ │ │ ├── test_dreambooth/
│ │ │ │ └── test_dreambooth.py
│ │ │ ├── test_duf/
│ │ │ │ └── test_duf.py
│ │ │ ├── test_edsr/
│ │ │ │ └── test_edsr_net.py
│ │ │ ├── test_edvr/
│ │ │ │ ├── test_edvr.py
│ │ │ │ └── test_edvr_net.py
│ │ │ ├── test_eg3d/
│ │ │ │ ├── test_camera.py
│ │ │ │ ├── test_dual_discriminator.py
│ │ │ │ ├── test_eg3d.py
│ │ │ │ ├── test_eg3d_generator.py
│ │ │ │ ├── test_eg3d_modules.py
│ │ │ │ ├── test_eg3d_utils.py
│ │ │ │ ├── test_ray_sampler.py
│ │ │ │ └── test_renderer.py
│ │ │ ├── test_esrgan/
│ │ │ │ ├── test_esrgan.py
│ │ │ │ └── test_rrdb_net.py
│ │ │ ├── test_fastcomposer/
│ │ │ │ └── test_fastcomposer.py
│ │ │ ├── test_fba/
│ │ │ │ ├── test_fba_decoder.py
│ │ │ │ └── test_fba_encoder.py
│ │ │ ├── test_flavr/
│ │ │ │ ├── test_flavr.py
│ │ │ │ └── test_flavr_net.py
│ │ │ ├── test_gca/
│ │ │ │ ├── test_gca.py
│ │ │ │ ├── test_gca_module.py
│ │ │ │ ├── test_resgca_dec.py
│ │ │ │ └── test_resgca_enc.py
│ │ │ ├── test_ggan/
│ │ │ │ └── test_ggan.py
│ │ │ ├── test_glean/
│ │ │ │ └── test_glean_styleganv2.py
│ │ │ ├── test_glide/
│ │ │ │ └── test_glide.py
│ │ │ ├── test_global_local/
│ │ │ │ ├── test_gl_decoder.py
│ │ │ │ ├── test_gl_dilation.py
│ │ │ │ ├── test_gl_disc.py
│ │ │ │ ├── test_gl_encoder.py
│ │ │ │ ├── test_gl_encoder_decoder.py
│ │ │ │ └── test_gl_inpaintor.py
│ │ │ ├── test_guided_diffusion/
│ │ │ │ └── test_adm.py
│ │ │ ├── test_iconvsr/
│ │ │ │ └── test_iconvsr_net.py
│ │ │ ├── test_indexnet/
│ │ │ │ ├── test_indexnet.py
│ │ │ │ ├── test_indexnet_decoder.py
│ │ │ │ └── test_indexnet_encoder.py
│ │ │ ├── test_inst_colorization/
│ │ │ │ ├── test_color_utils.py
│ │ │ │ ├── test_colorization_net.py
│ │ │ │ ├── test_fusion_net.py
│ │ │ │ ├── test_inst_colorization.py
│ │ │ │ └── test_weight_layer.py
│ │ │ ├── test_liif/
│ │ │ │ ├── test_liif.py
│ │ │ │ ├── test_liif_net.py
│ │ │ │ └── test_mlp_refiner.py
│ │ │ ├── test_lsgan/
│ │ │ │ ├── test_lsgan.py
│ │ │ │ ├── test_lsgan_discriminator.py
│ │ │ │ └── test_lsgan_generator.py
│ │ │ ├── test_mspie/
│ │ │ │ ├── test_mspie_stylegan2.py
│ │ │ │ ├── test_mspie_stylegan2_discriminator.py
│ │ │ │ ├── test_mspie_stylegan2_generator.py
│ │ │ │ ├── test_mspie_stylegan2_modules.py
│ │ │ │ ├── test_pe_singan.py
│ │ │ │ ├── test_pe_singan_generator.py
│ │ │ │ └── test_positional_encoding.py
│ │ │ ├── test_nafnet/
│ │ │ │ ├── test_naf_avgpool2d.py
│ │ │ │ ├── test_naf_layernorm2d.py
│ │ │ │ ├── test_nafbaseline.py
│ │ │ │ └── test_nafnet.py
│ │ │ ├── test_pconv/
│ │ │ │ ├── test_mask_conv_module.py
│ │ │ │ ├── test_partial_conv.py
│ │ │ │ ├── test_pconv_decoder.py
│ │ │ │ ├── test_pconv_encoder.py
│ │ │ │ ├── test_pconv_encoder_decoder.py
│ │ │ │ └── test_pconv_inpaintor.py
│ │ │ ├── test_pggan/
│ │ │ │ ├── test_pggan.py
│ │ │ │ ├── test_pggan_discriminator.py
│ │ │ │ ├── test_pggan_generator.py
│ │ │ │ └── test_pggan_modules.py
│ │ │ ├── test_pix2pix/
│ │ │ │ ├── test_pix2pix.py
│ │ │ │ ├── test_pix2pix_generator.py
│ │ │ │ └── test_pix2pix_modules.py
│ │ │ ├── test_plain/
│ │ │ │ ├── test_plain_decoder.py
│ │ │ │ └── test_plain_refiner.py
│ │ │ ├── test_rdn/
│ │ │ │ └── test_rdn_net.py
│ │ │ ├── test_real_basicvsr/
│ │ │ │ ├── test_real_basicvsr.py
│ │ │ │ └── test_real_basicvsr_net.py
│ │ │ ├── test_real_esrgan/
│ │ │ │ ├── test_real_esrgan.py
│ │ │ │ └── test_unet_disc.py
│ │ │ ├── test_restormer/
│ │ │ │ └── test_restormer_net.py
│ │ │ ├── test_sagan/
│ │ │ │ ├── test_sagan.py
│ │ │ │ ├── test_sagan_discriminator.py
│ │ │ │ ├── test_sagan_generator.py
│ │ │ │ └── test_sagan_modules.py
│ │ │ ├── test_singan/
│ │ │ │ ├── test_singan.py
│ │ │ │ ├── test_singan_discriminator.py
│ │ │ │ ├── test_singan_generator.py
│ │ │ │ └── test_singan_modules.py
│ │ │ ├── test_srcnn/
│ │ │ │ └── test_srcnn_net.py
│ │ │ ├── test_srgan/
│ │ │ │ ├── test_modified_vgg.py
│ │ │ │ ├── test_sr_resnet.py
│ │ │ │ └── test_srgan.py
│ │ │ ├── test_stable_diffusion/
│ │ │ │ ├── test_clip_wrapper.py
│ │ │ │ ├── test_stable_diffusion.py
│ │ │ │ ├── test_stable_diffusion_inpaint.py
│ │ │ │ ├── test_stable_diffusion_tomesd.py
│ │ │ │ └── test_vae.py
│ │ │ ├── test_stable_diffusion_xl/
│ │ │ │ └── test_stable_diffusion_xl.py
│ │ │ ├── test_stylegan1/
│ │ │ │ ├── test_stylegan1.py
│ │ │ │ ├── test_stylegan1_discriminator.py
│ │ │ │ ├── test_stylegan1_generator.py
│ │ │ │ ├── test_stylegan1_modules.py
│ │ │ │ └── test_stylegan_utils.py
│ │ │ ├── test_stylegan2/
│ │ │ │ ├── test_ada/
│ │ │ │ │ └── test_augment.py
│ │ │ │ ├── test_stylegan2.py
│ │ │ │ ├── test_stylegan2_discriminator.py
│ │ │ │ ├── test_stylegan2_generator.py
│ │ │ │ └── test_stylegan2_modules.py
│ │ │ ├── test_stylegan3/
│ │ │ │ ├── test_stylegan3.py
│ │ │ │ ├── test_stylegan3_generator.py
│ │ │ │ ├── test_stylegan3_modules.py
│ │ │ │ └── test_stylegan3_utils.py
│ │ │ ├── test_swinir/
│ │ │ │ ├── test_swinir_modules.py
│ │ │ │ ├── test_swinir_net.py
│ │ │ │ ├── test_swinir_rstb.py
│ │ │ │ └── test_swinir_utils.py
│ │ │ ├── test_tdan/
│ │ │ │ ├── test_tdan.py
│ │ │ │ └── test_tdan_net.py
│ │ │ ├── test_tof/
│ │ │ │ ├── test_tof_vfi_net.py
│ │ │ │ └── test_tof_vsr_net.py
│ │ │ ├── test_ttsr/
│ │ │ │ ├── test_lte.py
│ │ │ │ ├── test_search_transformer.py
│ │ │ │ ├── test_ttsr.py
│ │ │ │ ├── test_ttsr_disc.py
│ │ │ │ └── test_ttsr_net.py
│ │ │ ├── test_vico/
│ │ │ │ ├── test_vico.py
│ │ │ │ └── test_vico_utils.py
│ │ │ └── test_wgan_gp/
│ │ │ ├── test_wgan_discriminator.py
│ │ │ ├── test_wgan_generator.py
│ │ │ ├── test_wgan_gp.py
│ │ │ └── test_wgan_gp_module.py
│ │ ├── test_losses/
│ │ │ ├── test_clip_loss.py
│ │ │ ├── test_composition_loss.py
│ │ │ ├── test_face_id_loss.py
│ │ │ ├── test_feature_loss.py
│ │ │ ├── test_gan_loss.py
│ │ │ ├── test_gradient_loss.py
│ │ │ ├── test_loss_comps/
│ │ │ │ ├── test_clip_loss_comps.py
│ │ │ │ ├── test_disc_auxiliary_loss_comps.py
│ │ │ │ ├── test_face_id_loss_comps.py
│ │ │ │ ├── test_gan_loss_comps.py
│ │ │ │ └── test_gen_auxiliary_loss_comps.py
│ │ │ ├── test_loss_wrapper.py
│ │ │ ├── test_perceptual_loss.py
│ │ │ └── test_pixelwise_loss.py
│ │ └── test_utils/
│ │ ├── test_bbox_utils.py
│ │ ├── test_flow_warp.py
│ │ ├── test_model_utils.py
│ │ ├── test_sampling_utils.py
│ │ └── test_tensor_utils.py
│ ├── test_structures/
│ │ └── test_data_sample.py
│ ├── test_utils/
│ │ ├── test_cli.py
│ │ ├── test_img_utils.py
│ │ ├── test_io_utils.py
│ │ ├── test_logger.py
│ │ ├── test_sampler.py
│ │ ├── test_setup_env.py
│ │ └── test_trans_utils.py
│ └── test_visualization/
│ ├── test_concat_visualizer.py
│ ├── test_vis_backend.py
│ └── test_visualizer.py
└── tools/
├── analysis_tools/
│ ├── get_flops.py
│ └── print_config.py
├── cpu_train.sh
├── dataset_converters/
│ ├── bgm/
│ │ └── preprocess_bgm_dataset.py
│ ├── celeba-hq/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── classic5/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── comp1k/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── check_extended_fg.py
│ │ ├── evaluate_comp1k.py
│ │ ├── extend_fg.py
│ │ ├── filter_comp1k_anno.py
│ │ └── preprocess_comp1k_dataset.py
│ ├── denoising/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── deraining/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── df2k_ost/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_df2k_ost_dataset.py
│ ├── div2k/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_div2k_dataset.py
│ ├── dpdd/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── glean/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── preprocess_cat_test_dataset.py
│ │ ├── preprocess_cat_train_dataset.py
│ │ └── preprocess_ffhq_celebahq_dataset.py
│ ├── gopro/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── hide/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── live1/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── ntire21_decompression/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── paired-pix2pix/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── paris-street-view/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── places365/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── realblur/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── realsrset/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── reds/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── crop_sub_images.py
│ │ └── preprocess_reds_dataset.py
│ ├── sidd/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_sidd_test_dataset.py
│ ├── spmcs/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── udm10/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── unconditional_gans/
│ │ └── README.md
│ ├── unpaired-cyclegan/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── vid4/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_vid4_dataset.py
│ ├── videolq/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── vimeo90k/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_vimeo90k_dataset.py
│ └── vimeo90k-triplet/
│ ├── README.md
│ └── README_zh-CN.md
├── dist_test.sh
├── dist_train.sh
├── gui/
│ ├── README.md
│ ├── component.py
│ ├── gui.py
│ ├── page_general.py
│ ├── page_sr.py
│ └── utils.py
├── model_converters/
│ └── publish_model.py
├── slurm_test.sh
├── slurm_train.sh
├── test.py
└── train.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .circleci/config.yml
================================================
version: 2.1
# this allows you to use CircleCI's dynamic configuration feature
setup: true
# the path-filtering orb is required to continue a pipeline based on
# the path of an updated fileset
orbs:
path-filtering: circleci/path-filtering@0.1.2
workflows:
# the always-run workflow is always triggered, regardless of the pipeline parameters.
always-run:
jobs:
# the path-filtering/filter job determines which pipeline
# parameters to update.
- path-filtering/filter:
name: check-updated-files
# 3-column, whitespace-delimited mapping. One mapping per
# line:
# <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter>
mapping: |
configs/.* lint_only true
docs/.* lint_only true
.dev_scripts/.* lint_only true
.github/.* lint_only true
demo/.* lint_only true
projects/.* lint_only true
mmagic/.* lint_only false
requirements/.* lint_only false
tests/.* lint_only false
.circleci/.* lint_only false
tools/.* lint_only true
base-revision: main
# this is the path of the configuration we should trigger once
# path filtering and pipeline parameter value updates are
# complete. In this case, we are using the parent dynamic
# configuration itself.
config-path: .circleci/test.yml
================================================
FILE: .circleci/docker/Dockerfile
================================================
ARG PYTORCH="1.8.1"
ARG CUDA="10.2"
ARG CUDNN="7"
FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
# To fix GPG key error when running apt-get update
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
RUN apt-get update && apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx git
================================================
FILE: .circleci/test.yml
================================================
version: 2.1
# the default pipeline parameters, which will be updated according to
# the results of the path-filtering orb
parameters:
lint_only:
type: boolean
default: true
jobs:
lint:
docker:
- image: cimg/python:3.7.4
steps:
- checkout
- run:
name: Install pre-commit hook
command: |
pip install pre-commit
pre-commit install
- run:
name: Linting
command: pre-commit run --all-files
- run:
name: Check docstring coverage
command: |
pip install interrogate
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 90 mmagic
build_cpu:
parameters:
# The python version must match available image tags in
# https://circleci.com/developer/images/image/cimg/python
python:
type: string
torch:
type: string
torchvision:
type: string
docker:
- image: cimg/python:<< parameters.python >>
resource_class: large
steps:
- checkout
- run:
name: Install Libraries
command: |
sudo apt-get update
sudo apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx libjpeg-dev zlib1g-dev libtinfo-dev libncurses5
- run:
name: Configure Python & pip
command: |
pip install --upgrade pip
pip install wheel
- run:
name: Install PyTorch
command: |
python -V
pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
- run:
name: Install mmagic dependencies
command: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0'
pip install -r requirements/tests.txt
- run:
name: Build and install
command: |
pip install -e .
- run:
name: Run unittests
command: |
coverage run --branch --source mmagic -m pytest tests/
coverage xml
coverage report -m
build_cuda:
parameters:
torch:
type: string
cuda:
type: enum
enum: ["10.1", "10.2", "11.1"]
cudnn:
type: integer
default: 7
machine:
image: ubuntu-2004-cuda-11.4:202110-01
# docker_layer_caching: true
resource_class: gpu.nvidia.small
steps:
- checkout
- run:
# Cloning repos in VM since Docker doesn't have access to the private key
name: Clone Repos
command: |
git clone -b main --depth 1 https://github.com/open-mmlab/mmengine.git /home/circleci/mmengine
- run:
name: Build Docker image
command: |
docker build .circleci/docker -t mmagic:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
docker run --gpus all -t -d -v /home/circleci/project:/mmagic -v /home/circleci/mmengine:/mmengine -v /home/circleci/mmdetection:/mmdetection -w /mmagic --name mmagic mmagic:gpu
- run:
name: Install mmagic dependencies
command: |
docker exec mmagic pip install -e /mmengine
docker exec mmagic pip install -U openmim
docker exec mmagic mim install 'mmcv >= 2.0.0'
docker exec mmagic pip install -r requirements/tests.txt
- run:
name: Build and install
command: |
docker exec mmagic pip install -e .
- run:
name: Run unittests
command: |
docker exec mmagic pytest tests/
workflows:
pr_stage_lint:
when: << pipeline.parameters.lint_only >>
jobs:
- lint:
name: lint
filters:
branches:
ignore:
- dev-1.x
- main
pr_stage_test:
when:
not:
<< pipeline.parameters.lint_only >>
jobs:
- lint:
name: lint
filters:
branches:
ignore:
- dev-1.x
- main
- build_cpu:
name: minimum_version_cpu
torch: 1.10.0
torchvision: 0.11.0
python: 3.8.15
requires:
- lint
- build_cpu:
name: maximum_version_cpu
torch: 1.13.0
torchvision: 0.14.0
python: 3.8.15
requires:
- minimum_version_cpu
# - hold:
# type: approval
# requires:
# - maximum_version_cpu
# - build_cuda:
# name: mainstream_version_gpu
# torch: 1.8.1
# # Use double quotation mark to explicitly specify its type
# # as string instead of number
# cuda: "10.2"
# requires:
# - hold
merge_stage_test:
when:
not:
<< pipeline.parameters.lint_only >>
jobs:
- build_cuda:
name: minimum_version_gpu
torch: 1.8.1
# Use double quotation mark to explicitly specify its type
# as string instead of number
cuda: "10.2"
filters:
branches:
only:
- dev-1.x
================================================
FILE: .dele.yml
================================================
dele_rules:
issue:
create:
- name: "english needs"
conditions:
- "issue.title ~= ANSI"
actions:
- comment:
message: "@{{ issue.author.name }}, english-please."
- name: "add assignee"
conditions:
- "issue.assignees.count == 0"
actions:
- assign_with_owners
- name: "set stale"
conditions:
- "issue.status.inactive_time >= 30d"
actions:
- label:
add: ["stale"]
- comment:
message: "This issue will be closed in 5 days because it has been open 30 days with no activity, comment it or remove stale label to avoid it."
pull_request:
create:
- name: "add size label"
conditions:
- "pr.labels ~= size/*"
actions:
- label:
add: ["size"]
- name: "welcome new contributor"
conditions:
- "pr.author.login ~= first_pr"
actions:
- comment:
message: "Welcome @{{ pr.author.login }}! Thanks for your contribution to {{ pr.org }}/{{ .pr.repo }} 🎉"
================================================
FILE: .dev_scripts/README.md
================================================
# Scripts for developing MMagic
- [1. Check UT](#1-check-ut)
- [2. Test all the models](#2-test-all-the-models)
- [3. Train all the models](#3-train-all-the-models)
- [3.1 Train for debugging](#31-train-for-debugging)
- [3.2 Train for FP32](#32-train-for-fp32)
- [3.3 Train for FP16](#33-train-for-fp16)
- [4. Monitor your training](#4-monitor-your-training)
- [5. Train with a list of models](#5-train-with-a-list-of-models)
- [6. Train with skipping a list of models](#6-train-with-skipping-a-list-of-models)
- [7. Train failed or canceled jobs](#7-train-failed-or-canceled-jobs)
- [8. Deterministic training](#8-deterministic-training)
- [9. Automatically check links](#9-automatically-check-links)
- [10. Calculate flops](#10-calculate-flops)
- [11. Update model idnex](#11-update-model-index)
## 1. Check UT
Please check your UT by the following scripts:
```python
cd mmagic/
python .dev_script/update_ut.py
```
Then, you will find some redundant UT, missing UT and blank UT.
Please create UTs according to your package code implementation.
## 2. Test all the models
Please follow these steps to test all the models in MMagic:
First, you will need download all the pre-trained checkpoints by:
```shell
python .dev_scripts/download_models.py
```
Then, you can start testing all the benchmarks by:
```shell
python .dev_scripts/test_benchmark.py
```
## 3. Train all the models
### 3.1 Train for debugging
In order to test all the pipelines of training, visualization, etc., you may want to set the total iterations of all the models as less steps (e.g., 100 steps) for quick evaluation. You can use the following steps:
First, since our datasets are stored in ceph, you need to create ceph configs.
```shell
# create configs
python .dev_scripts/create_ceph_configs.py \
--target-dir configs_ceph_debug \
--gpus-per-job 2 \
--iters 100 \
--save-dir-prefix work_dirs/benchmark_debug \
--work-dir-prefix work_dirs/benchmark_debug
```
If you only want to update a specific config file, you can specify it by `--test-file configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py`.
Here, `--target-dir` denotes the path of new created configs, `--gpus-per-job` denotes the numbers of gpus used for each job, `--iters` denotes the total iterations of each model, `--save-dir-prefix` and `--work-dir-prefix` denote the working directory, where you can find the working logging.
Then, you will need to submit all the jobs by running `train_benchmark.py`.
```shell
python .dev_scripts/train_benchmark.py mm_lol \
--config-dir configs_ceph_debug \
--run \
--gpus-per-job 2 \
--job-name debug \
--work-dir work_dirs/benchmark_debug \
--resume \
--quotatype=auto
```
Here, you will specify the configs files used for training by `--config-dir`, submit all the jobs to run by set `--run`. You can set the prefix name of the submitted jobs by `--job-name`, specify the working directory by `--work-dir`. We suggest using `--resume` to enable auto resume during training and `--quotatype=auto` to fully exploit all the computing resources.
### 3.2 Train for FP32
If you want to train all the models with FP32 (i.e, regular settings as the same with `configs/`),
you can follow these steps:
```shell
# create configs for fp32
python .dev_scripts/create_ceph_configs.py \
--target-dir configs_ceph_fp32 \
--gpus-per-job 4 \
--save-dir-prefix work_dirs/benchmark_fp32 \
--work-dir-prefix work_dirs/benchmark_fp32 \
```
Then, submit the jobs to run by slurm:
```shell
python .dev_scripts/train_benchmark.py mm_lol \
--config-dir configs_ceph_fp32 \
--run \
--resume \
--gpus-per-job 4 \
--job-name fp32 \
--work-dir work_dirs/benchmark_fp32 \
--quotatype=auto
```
### 3.3 Train for FP16
You will also need to train the models with AMP (i.e., FP16), you can use the following steps to achieve this:
```shell
python .dev_scripts/create_ceph_configs.py \
--target-dir configs_ceph_amp \
--gpus-per-job 4 \
--save-dir-prefix work_dirs/benchmark_amp \
--work-dir-prefix work_dirs/benchmark_amp
```
Then, submit the jobs to run:
```shell
python .dev_scripts/train_benchmark.py mm_lol \
--config-dir configs_ceph_amp \
--run \
--resume \
--gpus-per-job 4 \
--amp \
--job-name amp \
--work-dir work_dirs/benchmark_amp \
--quotatype=auto
```
## 4. Monitor your training
After you submitting jobs following [3-Train-all-the-models](#3-train-all-the-models), you will find a `xxx.log` file.
This log file list all the job name of job id you have submitted. With this log file, you can monitor your training by running `.dev_scripts/job_watcher.py`.
For example, you can run
```shell
python .dev_scripts/job_watcher.py --work-dir work_dirs/benchmark_fp32/ --log 20220923-140317.log
```
Then, you will find `20220923-140317.csv`, which reports the status and recent log of each job.
## 5. Train with a list of models
If you only need to run some of the models, you can list all the models' name in a file, and specify the models when using `train_benchmark.py`.
For example,
```shell
python .dev_scripts/train_benchmark.py mm_lol \
--config-dir configs_ceph_fp32 \
--run \
--resume \
--gpus-per-job 4 \
--job-name fp32 \
--work-dir work_dirs/benchmark_fp32 \
--quotatype=auto \
--rerun \
--rerun-list 20220923-140317.log \
```
Specifically, you need to enable `--rerun`, and specify the list of models to rerun by `--rerun-list`
## 6. Train with skipping a list of models
If you want to train all the models while skipping some models, you can also list all the models' name in a file, and specify the models when running `train_benchmark.py`.
For example,
```shell
python .dev_scripts/train_benchmark.py mm_lol \
--config-dir configs_ceph_fp32 \
--run \
--resume \
--gpus-per-job 4 \
--job-name fp32 \
--work-dir work_dirs/benchmark_fp32 \
--quotatype=auto \
--skip \
--skip-list 20220923-140317.log \
```
Specifically, you need to enable `--skip`, and specify the list of models to skip by `--skip-list`
## 7. Train failed or canceled jobs
If you want to rerun failed or canceled jobs in the last run, you can combine `--rerun` flag with `--rerun-failure` and `--rerun-cancel` flags.
For example, the log file of the last run is `train-20221009-211904.log`, and now you want to rerun the failed jobs. You can use the following command:
```bash
python .dev_scripts/train_benchmark.py mm_lol \
--job-name RERUN \
--rerun train-20221009-211904.log \
--rerun-fail \
--run
```
We can combine `--rerun-fail` and `--rerun-cancel` with flag `---models` to rerun a **subset** of failed or canceled model.
```bash
python .dev_scripts/train_benchmark.py mm_lol \
--job-name RERUN \
--rerun train-20221009-211904.log \
--rerun-fail \
--models sagan \ # only rerun 'sagan' models in all failed tasks
--run
```
Specifically, `--rerun-fail` and `--rerun-cancel` can be used together to rerun both failed and cancaled jobs.
## 8. `deterministic` training
Set `torch.backends.cudnn.deterministic = True` and `torch.backends.cudnn.benchmark = False` can remove randomness operation in Pytorch training. You can add `--deterministic` flag when start your benchmark training to remove the influence of randomness operation.
```shell
python .dev_scripts/train_benchmark.py mm_lol --job-name xzn --models pix2pix --cpus-per-job 16 --run --deterministic
```
## 9. Automatically check links
Use the following script to check whether the links in documentations are valid:
```shell
python .dev_scripts/doc_link_checker.py --target docs/zh_cn
python .dev_scripts/doc_link_checker.py --target README_zh-CN.md
python .dev_scripts/doc_link_checker.py --target docs/en
python .dev_scripts/doc_link_checker.py --target README.md
```
You can specify the `--target` by a file or a directory.
**Notes:** DO NOT use it in CI, because requiring too many http requirements by CI will cause 503 and CI will propabaly fail.
## 10. Calculate flops
To summarize the flops of different models, you can run the following commands:
```bash
python .dev_scripts/benchmark_valid_flop.py --flops --flops-str
```
## 11. Update model index
To update model-index according to `README.md`, please run the following commands,
```bash
python .dev_scripts/update_model_index.py
```
================================================
FILE: .dev_scripts/create_ceph_configs.py
================================================
import glob
import os.path as osp
import shutil
from argparse import ArgumentParser
from copy import deepcopy
from mmengine import Config
from tqdm import tqdm
def update_intervals(config, args):
if args.iters is None:
return config
# 1. change max-iters and val-interval
if 'train_cfg' in config and config['train_cfg']:
config['train_cfg'] = dict(
type='IterBasedTrainLoop',
max_iters=args.iters,
val_interval=args.iters // 5)
# 2. change logging interval
if 'default_hooks' in config and config['default_hooks']:
config['default_hooks']['logger'] = dict(
type='LoggerHook', interval=args.iters // 10)
config['default_hooks']['checkpoint'] = dict(
type='CheckpointHook', interval=args.iters // 15)
return config
def convert_data_config(data_cfg):
ceph_dataroot_prefix_temp = 'openmmlab:s3://openmmlab/datasets/{}/'
local_dataroot_prefix = ['data', './data']
# val_dataloader may None
if data_cfg is None:
return
data_cfg_updated = deepcopy(data_cfg)
dataset: dict = data_cfg['dataset']
dataset_type: str = dataset['type']
if dataset_type in ['ImageNet', 'CIFAR10']:
repo_name = 'classification'
else:
repo_name = 'editing'
ceph_dataroot_prefix = ceph_dataroot_prefix_temp.format(repo_name)
if 'data_root' in dataset:
data_root: str = dataset['data_root']
for dataroot_prefix in local_dataroot_prefix:
if data_root.startswith(dataroot_prefix):
# avoid cvt './data/imagenet' ->
# openmmlab:s3://openmmlab/datasets/classification//imagenet
if data_root.startswith(dataroot_prefix + '/'):
dataroot_prefix = dataroot_prefix + '/'
data_root = data_root.replace(dataroot_prefix,
ceph_dataroot_prefix)
# add '/' at the end
if not data_root.endswith('/'):
data_root = data_root + '/'
dataset['data_root'] = data_root
elif 'data_roots' in dataset:
# specific for pggan dataset, which need a dict of data_roots
data_roots: dict = dataset['data_roots']
for k, data_root in data_roots.items():
for dataroot_prefix in local_dataroot_prefix:
if data_root.startswith(dataroot_prefix):
# avoid cvt './data/imagenet' ->
# openmmlab:s3://openmmlab/datasets/classification//imagenet
if data_root.startswith(dataroot_prefix + '/'):
dataroot_prefix = dataroot_prefix + '/'
data_root = data_root.replace(dataroot_prefix,
ceph_dataroot_prefix)
# add '/' at the end
if not data_root.endswith('/'):
data_root = data_root + '/'
data_roots[k] = data_root
dataset['data_roots'] = data_roots
else:
raise KeyError
if hasattr(dataset, 'pipeline'):
pipelines = dataset['pipeline']
for pipeline in pipelines:
type_ = pipeline['type']
# only change mmcv(mmcls)'s loading config
if type_ == 'mmcls.LoadImageFromFile':
pipeline['file_client_args'] = dict(backend='petrel')
elif type_ == 'LoadMask':
if 'mask_list_file' in pipeline['mask_config']:
local_mask_path = pipeline['mask_config']['mask_list_file']
for dataroot_prefix in local_dataroot_prefix:
if local_mask_path.startswith(dataroot_prefix + '/'):
dataroot_prefix = dataroot_prefix + '/'
local_mask_path = local_mask_path.replace(
dataroot_prefix, ceph_dataroot_prefix)
pipeline['mask_config']['mask_list_file'] = local_mask_path
pipeline['mask_config']['prefix'] = osp.dirname(
local_mask_path)
pipeline['mask_config']['io_backend'] = 'petrel'
pipeline['mask_config']['file_client_kwargs'] = dict(
backend='petrel')
elif type_ == 'RandomLoadResizeBg':
bg_dir_path = pipeline['bg_dir']
for dataroot_prefix in local_dataroot_prefix:
if bg_dir_path.startswith(dataroot_prefix + '/'):
dataroot_prefix = dataroot_prefix + '/'
bg_dir_path = bg_dir_path.replace(dataroot_prefix,
ceph_dataroot_prefix)
bg_dir_path = bg_dir_path.replace(repo_name, 'detection')
pipeline['bg_dir'] = bg_dir_path
elif type_ == 'CompositeFg':
fg_dir_path = pipeline['fg_dirs']
for i, fg in enumerate(fg_dir_path):
for dataroot_prefix in local_dataroot_prefix:
if fg.startswith(dataroot_prefix + '/'):
dataroot_prefix = dataroot_prefix + '/'
fg = fg.replace(dataroot_prefix, ceph_dataroot_prefix)
pipeline['fg_dirs'][i] = fg
alpha_dir_path = pipeline['alpha_dirs']
for i, alpha_dir in enumerate(alpha_dir_path):
for dataroot_prefix in local_dataroot_prefix:
if alpha_dir.startswith(dataroot_prefix + '/'):
dataroot_prefix = dataroot_prefix + '/'
alpha_dir = alpha_dir.replace(dataroot_prefix,
ceph_dataroot_prefix)
pipeline['alpha_dirs'][i] = alpha_dir
data_cfg_updated['dataset'] = dataset
return data_cfg_updated
def update_ceph_config(filename, args, dry_run=False):
if filename.startswith(osp.join(args.target_dir, '_base_')):
# Skip base configs
return None
if args.ceph_path is not None:
if args.ceph_path.endswith('/'):
args.ceph_path = args.ceph_path[:-1]
work_dir = f'{args.ceph_path}/{args.work_dir_prefix}'
save_dir = f'{args.ceph_path}/{args.save_dir_prefix}'
if not work_dir.endswith('/'):
work_dir = work_dir + '/'
if not save_dir.endswith('/'):
save_dir = save_dir + '/'
else:
# disable save local results to ceph
work_dir = args.work_dir_prefix
save_dir = args.save_dir_prefix
try:
config = Config.fromfile(filename)
# 0. update intervals
config = update_intervals(config, args)
# 1. change dataloader
dataloader_prefix = [
f'{p}_dataloader' for p in ['train', 'val', 'test']
]
for prefix in dataloader_prefix:
if not hasattr(config, prefix):
continue
data_cfg = config[prefix]
if not isinstance(data_cfg, list):
data_cfg_list = [data_cfg]
data_cfg_is_list = False
else:
data_cfg_list = data_cfg
data_cfg_is_list = True
data_cfg_updated_list = [
convert_data_config(cfg) for cfg in data_cfg_list
]
if data_cfg_is_list:
config[prefix] = data_cfg_updated_list
else:
config[prefix] = data_cfg_updated_list[0]
# 2. change visualizer
if hasattr(config, 'vis_backends'):
# TODO: support upload to ceph
# for vis_cfg in config['vis_backends']:
# if vis_cfg['type'] == 'VisBackend':
# vis_cfg['ceph_path'] = work_dir
# add pavi config
if args.add_pavi:
_, project, name = filename.split('/')
name = name[:-2]
# check if pavi config is inheritance from _base_
find_inherit = False
for vis_cfg in config['vis_backends']:
if vis_cfg['type'] == 'PaviVisBackend':
vis_cfg['exp_name'] = name
vis_cfg['project'] = project
find_inherit = True
break
if not find_inherit:
pavi_cfg = dict(
type='PaviVisBackend', exp_name=name, project=project)
config['vis_backends'].append(pavi_cfg)
# add wandb config
if args.add_wandb:
_, project, name = filename.split('/')
name = name[:-2]
# check if wandb config is inheritance from _base_
find_inherit = False
for vis_cfg in config['vis_backends']:
if vis_cfg['type'] == 'WandbVisBackend':
vis_cfg['name'] = name # name of config
vis_cfg['project'] = project # name of model
find_inherit = True
break
if not find_inherit:
pavi_cfg = dict(
type='WandbVisBackend',
init_kwargs=dict(name=name, project=project))
config['vis_backends'].append(pavi_cfg)
# add tensorboard config
if args.add_tensorboard:
find_inherit = False
for vis_cfg in config['vis_backends']:
if vis_cfg['type'] == 'TensorboardVisBackend':
find_inherit = True
break
if not find_inherit:
tensorboard_cfg = dict(type='TensorboardVisBackend')
config['vis_backends'].append(tensorboard_cfg)
config['visualizer']['vis_backends'] = config['vis_backends']
# 3. change logger hook and checkpoint hook
if hasattr(config, 'default_hooks'):
# file_client_args = dict(backend='petrel')
for name, hooks in config['default_hooks'].items():
if name == 'logger':
hooks['out_dir'] = save_dir
# hooks['file_client_args'] = file_client_args
elif name == 'checkpoint':
hooks['out_dir'] = save_dir
# hooks['file_client_args'] = file_client_args
# 4. save
config.dump(config.filename)
return True
except Exception as e: # noqa
print(e)
return False
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--ceph-path', type=str, default=None)
parser.add_argument('--gpus-per-job', type=int, default=None)
parser.add_argument(
'--save-dir-prefix',
type=str,
default='work_dirs',
help='Default prefix of the work dirs in the bucket')
parser.add_argument(
'--work-dir-prefix',
type=str,
default='work_dirs',
help='Default prefix of the work dirs in the bucket')
parser.add_argument(
'--target-dir', type=str, default='configs_ceph', help='configs path')
parser.add_argument(
'--iters', type=int, default=None, help='set intervals')
parser.add_argument(
'--test-file', type=str, default=None, help='Dry-run on a test file.')
parser.add_argument(
'--add-pavi', action='store_true', help='Add pavi config or not.')
parser.add_argument(
'--add-wandb', action='store_true', help='Add wandb config or not.')
parser.add_argument(
'--add-tensorboard',
action='store_true',
help='Add Tensorboard config or not.')
args = parser.parse_args()
if args.test_file is None:
print('Copying config files to "config_ceph" ...')
shutil.copytree('configs', args.target_dir, dirs_exist_ok=True)
print('Updating ceph configuration ...')
files = glob.glob(
osp.join(args.target_dir, '**', '*.py'), recursive=True)
pbars = tqdm(files)
res = []
for f in pbars:
pbars.set_description(f'Processing {f}')
res.append(update_ceph_config(f, args))
count_skip = res.count(None)
count_done = res.count(True)
count_fail = res.count(False)
fail_list = [fn for status, fn in zip(res, files) if status is False]
skip_list = [fn for status, fn in zip(res, files) if status is None]
print(f'Successfully update {count_done} configs.')
print(f'Skip {count_skip} configs.')
if count_skip > 0:
print(skip_list)
print(f'Fail {count_fail} configs.')
if count_fail > 0:
print(fail_list)
else:
shutil.copy(args.test_file,
args.test_file.replace('configs', args.target_dir))
update_ceph_config(
args.test_file.replace('configs', args.target_dir),
args,
dry_run=True)
================================================
FILE: .dev_scripts/doc_link_checker.py
================================================
# Copyright (c) MegFlow. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
# /bin/python3
import argparse
import os
import re
import requests
from tqdm import tqdm
def make_parser():
parser = argparse.ArgumentParser('Doc link checker')
parser.add_argument(
'--target',
default='./docs',
type=str,
help='the directory or file to check')
parser.add_argument(
'--ignore', type=str, nargs='+', default=[], help='input image size')
return parser
pattern = re.compile(r'\[.*?\]\(.*?\)')
def analyze_doc(home, path):
problem_list = []
code_block = 0
with open(path) as f:
lines = f.readlines()
for line in lines:
line = line.strip()
if line.startswith('```'):
code_block = 1 - code_block
if code_block > 0:
continue
if '[' in line and ']' in line and '(' in line and ')' in line:
all = pattern.findall(line)
for item in all:
# skip ![]()
if item.find('[') == item.find(']') - 1:
continue
# process the case [text()]()
offset = item.find('](')
if offset == -1:
continue
item = item[offset:]
start = item.find('(')
end = item.find(')')
ref = item[start + 1:end]
if ref.startswith('http'):
if ref.startswith(
'https://download.openmmlab.com/'
) or ref.startswith('http://download.openmmlab.com/'):
resp = requests.head(ref)
if resp.status_code == 200:
continue
else:
problem_list.append(ref)
else:
continue
if ref.startswith('#'):
continue
if ref == '<>':
continue
if '.md#' in ref:
ref = ref[:ref.find('#')]
if ref.startswith('/'):
fullpath = os.path.join(
os.path.dirname(__file__), '../', ref[1:])
else:
fullpath = os.path.join(home, ref)
if not os.path.exists(fullpath):
problem_list.append(ref)
else:
continue
if len(problem_list) > 0:
print(f'{path}:')
for item in problem_list:
print(f'\t {item}')
print('\n')
raise Exception('found link error')
def traverse(args):
target = args.target
if os.path.isfile(target):
analyze_doc(os.path.dirname(target), target)
return
target_files = list(os.walk(target))
target_files.sort()
for home, dirs, files in tqdm(target_files):
if home in args.ignore:
continue
for filename in files:
if filename.endswith('.md'):
path = os.path.join(home, filename)
if os.path.islink(path) is False:
analyze_doc(home, path)
if __name__ == '__main__':
args = make_parser().parse_args()
traverse(args)
================================================
FILE: .dev_scripts/download_models.py
================================================
#!/usr/bin/env python
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import platform
import posixpath as osp # Even on windows, use posixpath
import re
import subprocess
from collections import OrderedDict
from importlib.machinery import SourceFileLoader
from pathlib import Path
from modelindex import load
MMagic_ROOT = Path(__file__).absolute().parent.parent
DOWNLOAD_DIR = osp.join(MMagic_ROOT, 'work_dirs', 'download')
IS_WINDOWS = (platform.system() == 'Windows')
def additional_download(args):
"""Download additional weights file used in this repo, such as VGG."""
url_path = [
'https://www.adrianbulat.com/downloads/python-fan/2DFAN4-cd938726ad.zip', # noqa
'https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth',
'https://download.pytorch.org/models/vgg19-dcbb9e9d.pth'
]
checkpoint_root = args.checkpoint_root
if not checkpoint_root:
checkpoint_root = DOWNLOAD_DIR
for url in url_path:
path = osp.join(checkpoint_root, 'hub', 'checkpoints',
osp.basename(url))
print()
print(f'download {path} from {url}')
if IS_WINDOWS:
if args.dry_run:
print(f'Call \'wget.download({url}, {path})\'')
else:
import wget
wget.download(url, path)
else:
if args.dry_run:
print(f'wget --no-check-certificate -N {url} {path}')
else:
os.system(f'wget --no-check-certificate -N {url} {path}')
def parse_args():
parser = argparse.ArgumentParser(description='Download the checkpoints')
parser.add_argument('--checkpoint-root', help='Checkpoint file root path.')
parser.add_argument(
'--models', nargs='+', type=str, help='Specify model names to run.')
parser.add_argument(
'--force',
action='store_true',
help='Whether force re-download the checkpoints.')
parser.add_argument(
'--model-list', type=str, help='Path of algorithm list to download')
parser.add_argument(
'--dry-run',
action='store_true',
help='Only show download command but not run')
args = parser.parse_args()
return args
def download(args):
model_index_file = MMagic_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
http_prefix_short = 'https://download.openmmlab.com/mmediting/'
# load model list
if args.model_list:
file_list_path = args.model_list
file_list = SourceFileLoader('model_list',
file_list_path).load_module().model_list
else:
file_list = None
if args.models:
patterns = [re.compile(pattern) for pattern in args.models]
filter_models = {}
for k, v in models.items():
if any([re.match(pattern, k) for pattern in patterns]):
filter_models[k] = v
if len(filter_models) == 0:
print('No model found, please specify models in:')
print('\n'.join(models.keys()))
return
models = filter_models
checkpoint_root = args.checkpoint_root
if not checkpoint_root:
checkpoint_root = DOWNLOAD_DIR
for model_info in models.values():
if file_list is not None and model_info.name not in file_list:
continue
model_weight_url = model_info.weights
if model_weight_url.startswith(http_prefix_short):
model_name = model_weight_url[len(http_prefix_short):]
elif model_weight_url == '':
print(f'{model_info.Name} weight is missing')
return None
else:
raise ValueError(f'Unknown url prefix. \'{model_weight_url}\'')
model_name_split = model_name.split('/')
if len(model_name_split) == 3: # 'TASK/METHOD/MODEL.pth'
# remove task name
model_name = osp.join(*model_name_split[1:-1])
else:
model_name = osp.join(*model_name_split[:-1])
ckpt_name = model_weight_url.split('/')[-1]
download_path = osp.join(checkpoint_root, model_name, ckpt_name)
download_root = osp.join(checkpoint_root, model_name)
if osp.exists(download_path):
print(f'Already exists {download_path}')
# do not delete when dry-run is true
if args.force and not args.dry_run:
print(f'Delete {download_path} to force re-download.')
os.system(f'rm -rf {download_path}')
else:
continue
try:
cmd_str_list = [
'wget', '-q', '--show-progress', '-p', download_root,
model_weight_url
]
if args.dry_run:
print(' '.join(cmd_str_list))
else:
subprocess.run(cmd_str_list, check=True)
except Exception:
# for older version of wget
cmd_str_list = ['wget', '-P', download_root, model_weight_url]
if args.dry_run:
print(' '.join(cmd_str_list))
else:
subprocess.run(cmd_str_list, check=True)
if __name__ == '__main__':
args = parse_args()
download(args)
additional_download(args)
================================================
FILE: .dev_scripts/inference_benchmark.sh
================================================
python demo/download_inference_resources.py
# Text-to-Image
python demo/mmagic_inference_demo.py \
--model-name stable_diffusion \
--text "A panda is having dinner at KFC" \
--result-out-dir demo_text2image_stable_diffusion_res.png
python demo/mmagic_inference_demo.py \
--model-name controlnet \
--model-setting 1 \
--text "Room with blue walls and a yellow ceiling." \
--control 'https://user-images.githubusercontent.com/28132635/230297033-4f5c32df-365c-4cf4-8e4f-1b76a4cbb0b7.png' \
--result-out-dir demo_text2image_controlnet_canny_res.png
python demo/mmagic_inference_demo.py \
--model-name controlnet \
--model-setting 2 \
--text "masterpiece, best quality, sky, black hair, skirt, sailor collar, looking at viewer, short hair, building, bangs, neckerchief, long sleeves, cloudy sky, power lines, shirt, cityscape, pleated skirt, scenery, blunt bangs, city, night, black sailor collar, closed mouth" \
--control 'https://user-images.githubusercontent.com/28132635/230380893-2eae68af-d610-4f7f-aa68-c2f22c2abf7e.png' \
--result-out-dir demo_text2image_controlnet_pose_res.png
python demo/mmagic_inference_demo.py \
--model-name controlnet \
--model-setting 3 \
--text "black house, blue sky" \
--control 'https://github-production-user-asset-6210df.s3.amazonaws.com/49083766/243599897-553a4c46-c61d-46df-b820-59a49aaf6678.png' \
--result-out-dir demo_text2image_controlnet_seg_res.png
# Conditional GANs
python demo/mmagic_inference_demo.py \
--model-name biggan \
--model-setting 3 \
--label 1 \
--result-out-dir demo_conditional_biggan_res.jpg
# Unconditional GANs
python demo/mmagic_inference_demo.py \
--model-name styleganv1 \
--result-out-dir demo_unconditional_styleganv1_res.jpg
# Image Translation
python demo/mmagic_inference_demo.py \
--model-name pix2pix \
--img ./resources/input/translation/gt_mask_0.png \
--result-out-dir ./resources/output/translation/demo_translation_pix2pix_res.png
# Inpainting
python demo/mmagic_inference_demo.py \
--model-name deepfillv2 \
--img ./resources/input/inpainting/celeba_test.png \
--mask ./resources/input/inpainting/bbox_mask.png \
--result-out-dir ./resources/output/inpainting/demo_inpainting_deepfillv2_res.
# Matting
python demo/mmagic_inference_demo.py \
--model-name aot_gan \
--img ./resources/input/matting/GT05.jpg \
--trimap ./resources/input/matting/GT05_trimap.jpg \
--result-out-dir ./resources/output/matting/demo_matting_gca_res.png
# Image Restoration
python demo/mmagic_inference_demo.py \
--model-name nafnet \
--img ./resources/input/restoration/0901x2.png \
--result-out-dir ./resources/output/restoration/demo_restoration_nafnet_res.png
# Image Super-resolution
python demo/mmagic_inference_demo.py \
--model-name esrgan \
--img ./resources/input/restoration/0901x2.png \
--result-out-dir ./resources/output/restoration/demo_restoration_esrgan_res.png
python demo/mmagic_inference_demo.py \
--model-name ttsr \
--img ./resources/input/restoration/000001.png \
--ref ./resources/input/restoration/000001.png \
--result-out-dir ./resources/output/restoration/demo_restoration_ttsr_res.png
# Video Super-Resolution
python demo/mmagic_inference_demo.py \
--model-name basicvsr \
--video ./resources/input/video_restoration/QUuC4vJs_000084_000094_400x320.mp4 \
--result-out-dir ./resources/output/video_restoration/demo_video_restoration_basicvsr_res.mp4
python demo/mmagic_inference_demo.py \
--model-name edvr \
--extra-parameters window_size=5 \
--video ./resources/input/video_restoration/QUuC4vJs_000084_000094_400x320.mp4 \
--result-out-dir ./resources/output/video_restoration/demo_video_restoration_edvr_res.mp4
python demo/mmagic_inference_demo.py \
--model-name tdan \
--model-setting 2 \
--extra-parameters window_size=5 \
--video ./resources/input/video_restoration/QUuC4vJs_000084_000094_400x320.mp4 \
--result-out-dir ./resources/output/video_restoration/demo_video_restoration_tdan_res.mp4
# Video interpolation
python demo/mmagic_inference_demo.py \
--model-name flavr \
--video ./resources/input/video_interpolation/b-3LLDhc4EU_000000_000010.mp4 \
--result-out-dir ./resources/output/video_interpolation/demo_video_interpolation_flavr_res.mp4
# Image Colorization
python demo/mmagic_inference_demo.py \
--model-name inst_colorization \
--img https://github-production-user-asset-6210df.s3.amazonaws.com/49083766/245713512-de973677-2be8-4915-911f-fab90bb17c40.jpg \
--result-out-dir demo_colorization_res.png
# 3D-aware Generation
python demo/mmagic_inference_demo.py \
--model-name eg3d \
--result-out-dir ./resources/output/eg3d-output
================================================
FILE: .dev_scripts/job_watcher.py
================================================
import os
import os.path as osp
import time
from argparse import ArgumentParser
from functools import partial
from prettytable import PrettyTable
from pygments import formatters, highlight, lexers
from pygments.util import ClassNotFound
from simple_term_menu import TerminalMenu
CACHE_DIR = osp.join(osp.abspath('~'), '.task_watcher')
def show_job_out(name, root, job_name_list):
if name == 'Show Status':
return show_job_status(root, job_name_list)
job_id, job_name = name.split(' @ ')
job_out_path = osp.join(root, job_name, f'job.{job_id.strip()}.out')
try:
with open(job_out_path, 'r') as file:
out_content = file.read()
except Exception:
out_content = f'{job_out_path} not find.'
out_content = out_content.split('\n')[-20:]
out_content = '\n'.join(out_content)
try:
lexer = lexers.get_lexer_for_filename(
job_out_path, stripnl=False, stripall=False)
except ClassNotFound:
lexer = lexers.get_lexer_by_name('text', stripnl=False, stripall=False)
formatter = formatters.TerminalFormatter(bg='dark') # dark or light
highlighted_file_content = highlight(out_content, lexer, formatter)
return highlighted_file_content
def show_job_status(root, job_name_list, csv_path=None):
"""Show job status and dump to csv.
Args:
root (_type_): _description_
job_name_list (_type_): _description_
Returns:
_type_: _description_
"""
table = PrettyTable(title='Job Status')
table.field_names = ['Name', 'ID', 'Status', 'Output']
swatch_tmp = 'swatch examine {}'
if csv_path is None:
csv_path = 'status.cvs'
for info in job_name_list:
id_, name = info.split(' @ ')
name = name.split('\n')[0].strip()
proc = os.popen(swatch_tmp.format(id_))
stdout = proc.read().strip().split('\n')
job_info = [s for s in stdout[2].split(' ') if s]
status = job_info[5]
job_out_path = osp.join(root, name, f'job.{id_.strip()}.out')
if osp.exists(job_out_path):
with open(job_out_path, 'r') as file:
out_content = file.read()
out_content = out_content.split('\n')
if len(out_content) > 10:
out_content = out_content[-7:-1]
out_content = '\n'.join(out_content)
else:
out_content = 'No output currently.'
table.add_row([name, id_, status, out_content])
with open(csv_path, 'w') as file:
file.write(table.get_csv_string())
print(f'save job status to {csv_path}')
return table.get_string()
def save_for_resume(root, job_name_list):
"""Save job name and job ID for resume.
Args:
root (_type_): _description_
job_name_list (_type_): _description_
"""
timestamp = time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time()))
os.makedirs(CACHE_DIR, exist_ok=True)
with open(osp.join(CACHE_DIR, timestamp), 'w') as file:
file.write(f'{root}\n')
file.writelines([n + '\n' for n in job_name_list])
with open(osp.join(CACHE_DIR, 'latest'), 'w') as file:
file.write(f'{root}\n')
file.writelines([n + '\n' for n in job_name_list])
def resume_from_file(file_path):
"""Resume TUI from file.
Args:
file_path (_type_): _description_
"""
with open((file_path), 'r') as file:
resume_info = file.readlines()
resume_info = [info.strip() for info in resume_info]
root = resume_info[0]
job_name_list = resume_info[1:]
show_tui(root, job_name_list)
def start_from_proc(root, proc):
"""Start TUI from proc.
Args:
root (_type_): _description_
proc (_type_): _description_
"""
std_out = proc.read().strip()
std_out_list = std_out.split('\n')
num_tasks = len(std_out_list) // 3
job_name_list = []
for idx in range(num_tasks):
config = std_out_list[3 * idx].strip(' ')
job_name = config.split('/')[-1].split('.')[0].strip(' ')
job_id = std_out_list[3 * idx + 2].split(' ')[-1]
job_name_list.append(f'{job_id} @ {job_name}')
return job_name_list
# save_for_resume(root, job_name_list)
# show_tui(root, job_name_list)
def show_tui(root, job_name_list):
"""Start a interactivate task watcher.
Args:
root (str): root for benchmark
job_name_list (list[str]): List of 'JOBID @ JOBNAME'
"""
show_func = partial(show_job_out, root=root, job_name_list=job_name_list)
terminal_menu = TerminalMenu(
job_name_list + ['Show Status'],
preview_command=show_func,
preview_size=0.75)
terminal_menu.show()
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--list', type=str, default=None)
parser.add_argument('--resume', default='latest')
parser.add_argument(
'--work-dir', type=str, default='work_dirs/benchmark_amp')
parser.add_argument(
'--type',
type=str,
default='failed',
choices=['running', 'success', 'queue', 'failed', 'all'],
)
args = parser.parse_args()
if args.list is not None:
f = open(args.list, 'r')
job_name_list = f.readlines()
csv_path = osp.basename(args.list).replace('.log', '.csv')
plain_txt = show_job_status(args.work_dir, job_name_list, csv_path)
with open('status.log', 'w') as f:
f.write(plain_txt)
print('save status to status.log')
else:
if args.resume.upper() == 'LATEST':
resume_from_file(osp.join(CACHE_DIR, 'latest'))
else:
resume_from_file(args.resume)
================================================
FILE: .dev_scripts/metric_mapping.py
================================================
# key-in-metafile: key-in-results.pkl
METRICS_MAPPING = {
'FID': {
'keys': ['FID-Full-50k/fid'],
'tolerance': 0.5,
'rule': 'less'
},
'PSNR': {
'keys': ['PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'SSIM': {
'keys': ['MattingSSIM', 'SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'l1 error': {
'keys': ['MAE'],
'tolerance': 0.1,
'rule': 'less'
},
'CONN': {
'keys': ['ConnectivityError'],
'tolerance': 0.1,
'rule': 'less'
},
'GRAD': {
'keys': ['GradientError'],
'tolerance': 0.1,
'rule': 'less'
},
'MSE': {
'keys': ['MSE', 'MattingMSE'],
'tolerance': 0.1,
'rule': 'less'
},
'SAD': {
'keys': ['SAD'],
'tolerance': 0.1,
'rule': 'less'
},
'NIQE (Y)': {
'keys': ['NIQE'],
'tolerance': 0.1,
'rule': 'less'
},
# verbose metric mapping for VSR
'REDS4 (BIx4) PSNR (RGB)': {
'keys': ['REDS4-BIx4-RGB/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vimeo-90K-T (BIx4) PSNR (Y)': {
'keys': ['Vimeo-90K-T-BIx4-Y/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vimeo-90K-T (BDx4) PSNR (Y)': {
'keys': ['Vimeo-90K-T-BDx4-Y/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'UDM10 (BDx4) PSNR (Y)': {
'keys': ['UDM10-BDx4-Y/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vid4 (BDx4) PSNR (Y)': {
'keys': ['VID4-BDx4-Y/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vid4 (BIx4) PSNR (Y)': {
'keys': ['VID4-BIx4-Y/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'SPMCS-30 (BDx4) PSNR (Y)': {
'keys': ['SPMCS-BDx4-Y/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'SPMCS-30 (BIx4) PSNR (Y)': {
'keys': ['SPMCS-BIx4-Y/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'REDS4 (BIx4) SSIM (RGB)': {
'keys': ['REDS4-BIx4-RGB/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vimeo-90K-T (BIx4) SSIM (Y)': {
'keys': ['Vimeo-90K-T-BIx4-Y/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vimeo-90K-T (BDx4) SSIM (Y)': {
'keys': ['Vimeo-90K-T-BDx4-Y/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'UDM10 (BDx4) SSIM (Y)': {
'keys': ['UDM10-BDx4-Y/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vid4 (BDx4) SSIM (Y)': {
'keys': ['VID4-BDx4-Y/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'Vid4 (BIx4) SSIM (Y)': {
'keys': ['VID4-BIx4-Y/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'SPMCS-30 (BDx4) SSIM (Y)': {
'keys': ['SPMCS-BDx4-Y/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'SPMCS-30 (BIx4) SSIM (Y)': {
'keys': ['SPMCS-BIx4-Y/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'Set5 SSIM': {
'keys': ['Set5/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'Set5 PSNR': {
'keys': ['Set5/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'Set14 SSIM': {
'keys': ['Set14/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'Set14 PSNR': {
'keys': ['Set14/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
'DIV2K SSIM': {
'keys': ['DIV2K/SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'DIV2K PSNR': {
'keys': ['DIV2K/PSNR'],
'tolerance': 0.1,
'rule': 'larger'
},
}
# add LIIF metrics
liif_metrics = {}
for dataset in ['Set5', 'Set14', 'DIV2K']:
for metric, tolerance in zip(['PSNR', 'SSIM'], [0.1, 0.1]):
for scale in [2, 3, 4, 6, 18, 30]:
liif_metrics[f'{dataset}x{scale} {metric}'] = {
'keys': [f'{dataset}x{scale}/{metric}'],
'tolerance': 0.1,
'rule': 'larger'
}
METRICS_MAPPING.update(liif_metrics)
def filter_metric(metric_mapping, summary_data):
used_metric = dict()
for metric, metric_info in metric_mapping.items():
for data_dict in summary_data.values():
if metric in data_dict:
used_metric[metric] = metric_info
break
return used_metric
================================================
FILE: .dev_scripts/task_mapping.py
================================================
TASK_MAPPING = {
'Inpainting': [
'aot-gan',
'deepfillv1',
'deepfillv2',
'global_local',
'partial_conv',
],
'Matting': [
'dim',
'gca',
'indexnet',
],
'Restoreration': [
'srcnn',
'srresnet_srgan',
'edsr',
'esrgan',
'rdn',
'dic',
'ttsr',
'glean',
],
'LIIF': ['liif'],
'Video_restoration': [
'edvr',
'tof',
'tdan',
'basicvsr',
'basicvsr_plusplus',
'iconvsr',
'real_basicvsr',
],
'Video_interpolation': [
'cain',
'flavr',
'tof',
]
}
================================================
FILE: .dev_scripts/test_benchmark.py
================================================
import argparse
import os
import os.path as osp
import pickle
import re
from collections import OrderedDict, defaultdict
from datetime import datetime
from importlib.machinery import SourceFileLoader
from pathlib import Path
from job_watcher import start_from_proc
from metric_mapping import METRICS_MAPPING, filter_metric
from modelindex.load_model_index import load
from rich.console import Console
from rich.syntax import Syntax
from rich.table import Table
from task_mapping import TASK_MAPPING
console = Console()
MMagic_ROOT = Path(__file__).absolute().parents[1]
def parse_args():
parser = argparse.ArgumentParser(
description="Test all models' accuracy in model-index.yml")
parser.add_argument(
'partition', type=str, help='Cluster partition to use.')
parser.add_argument('checkpoint_root', help='Checkpoint file root path.')
parser.add_argument(
'--job-name', type=str, default=' ', help='Slurm job name prefix')
parser.add_argument('--port', type=int, default=29666, help='dist port')
parser.add_argument(
'--use-ceph-config',
action='store_true',
default=False,
help='Use ceph configs or not.')
parser.add_argument(
'--models', nargs='+', type=str, help='Specify model names to run.')
parser.add_argument(
'--work-dir',
default='work_dirs/benchmark_test',
help='the dir to save metric')
parser.add_argument(
'--run', action='store_true', help='run script directly')
parser.add_argument(
'--local',
action='store_true',
help='run at local instead of cluster.')
parser.add_argument(
'--mail', type=str, help='Mail address to watch test status.')
parser.add_argument(
'--mail-type',
nargs='+',
default=['BEGIN'],
choices=['NONE', 'BEGIN', 'END', 'FAIL', 'REQUEUE', 'ALL'],
help='Mail address to watch test status.')
parser.add_argument(
'--quotatype',
default=None,
choices=['reserved', 'auto', 'spot'],
help='Quota type, only available for phoenix-slurm>=0.2')
parser.add_argument(
'--summary',
action='store_true',
help='Summarize benchmark test results.')
parser.add_argument(
'--by-task',
action='store_true',
help='Summairze benchmark results by task.')
parser.add_argument('--save', action='store_true', help='Save the summary')
group_parser = parser.add_mutually_exclusive_group()
group_parser.add_argument(
'--P0', action='store_true', help='Whether test model in P0 list')
group_parser.add_argument(
'--model-list',
type=str,
default='',
help='Path of algorithm list to load')
args = parser.parse_args()
return args
def create_test_job_batch(commands, model_info, args, port, script_name):
config_http_prefix_blob = ('https://github.com/open-mmlab/mmagic/'
'blob/main/')
config_http_prefix_tree = ('https://github.com/open-mmlab/mmagic/'
'tree/main/')
fname = model_info.name
config = model_info.config
if config.startswith('http'):
config = config.replace(config_http_prefix_blob, './')
config = config.replace(config_http_prefix_tree, './')
if args.use_ceph_config:
config = config.replace('configs', 'configs_ceph')
config = Path(config)
assert config.exists(), f'{fname}: {config} not found.'
http_prefix_short = 'https://download.openmmlab.com/mmediting/'
model_weight_url = model_info.weights
if model_weight_url.startswith(http_prefix_short):
model_name = model_weight_url[len(http_prefix_short):]
elif model_weight_url == '':
print(f'{fname} weight is missing')
return None
else:
raise ValueError(f'Unknown url prefix. \'{model_weight_url}\'')
model_name_split = model_name.split('/')
if len(model_name_split) == 3: # 'TASK/METHOD/MODEL.pth'
# remove task name
model_name = osp.join(*model_name_split[1:])
else:
model_name = osp.join(*model_name_split)
if 's3://' in args.checkpoint_root:
from mmengine.fileio import FileClient
from petrel_client.common.exception import AccessDeniedError
file_client = FileClient.infer_client(uri=args.checkpoint_root)
checkpoint = file_client.join_path(args.checkpoint_root, model_name)
try:
exists = file_client.exists(checkpoint)
except AccessDeniedError:
exists = False
else:
checkpoint_root = Path(args.checkpoint_root)
checkpoint = checkpoint_root / model_name
exists = checkpoint.exists()
if not exists:
print(f'WARNING: {fname}: {checkpoint} not found.')
return None
job_name = f'{args.job_name}_{fname}'.strip('_')
work_dir = Path(args.work_dir) / fname
work_dir.mkdir(parents=True, exist_ok=True)
result_file = work_dir / 'result.pkl'
if args.mail is not None and 'NONE' not in args.mail_type:
mail_cfg = (f'#SBATCH --mail {args.mail}\n'
f'#SBATCH --mail-type {args.mail_type}\n')
else:
mail_cfg = ''
if args.quotatype is not None:
quota_cfg = f'#SBATCH --quotatype {args.quotatype}\n'
else:
quota_cfg = ''
launcher = 'none' if args.local else 'slurm'
runner = 'python' if args.local else 'srun python'
# NOTE: set gpus as 2
job_script = (f'#!/bin/bash\n'
f'#SBATCH --output {work_dir}/job.%j.out\n'
f'#SBATCH --partition={args.partition}\n'
f'#SBATCH --job-name {job_name}\n'
f'#SBATCH --gres=gpu:2\n'
f'{mail_cfg}{quota_cfg}'
f'#SBATCH --ntasks-per-node=2\n'
f'#SBATCH --ntasks=2\n'
f'#SBATCH --cpus-per-task=16\n\n'
f'export MASTER_PORT={port}\n'
f'export CUBLAS_WORKSPACE_CONFIG=:4096:8\n'
f'{runner} -u {script_name} {config} {checkpoint} '
f'--work-dir={work_dir} '
f'--out={result_file} '
f'--launcher={launcher}\n')
with open(work_dir / 'job.sh', 'w') as f:
f.write(job_script)
commands.append(f'echo "{config}"')
commands.append(f'echo "{work_dir}"')
if args.local:
commands.append(f'bash {work_dir}/job.sh')
else:
commands.append(f'sbatch {work_dir}/job.sh')
return work_dir / 'job.sh'
def test(args):
# parse model-index.yml
model_index_file = MMagic_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
script_name = osp.join('tools', 'test.py')
port = args.port
commands = []
if args.models:
patterns = [re.compile(pattern) for pattern in args.models]
filter_models = {}
for k, v in models.items():
if any([re.match(pattern, k) for pattern in patterns]):
filter_models[k] = v
if len(filter_models) == 0:
print('No model found, please specify models in:')
print('\n'.join(models.keys()))
return
models = filter_models
# load model list
if args.P0:
file_list = osp.join(osp.dirname(__file__), 'p0_test_list.py')
elif args.model_list:
file_list = args.model_list
else:
file_list = None
if file_list:
test_list = SourceFileLoader('model_list',
file_list).load_module().model_list
else:
test_list = None
preview_script = ''
for model_info in models.values():
if model_info.results is None:
continue
if test_list is not None and model_info.name not in test_list:
continue
script_path = create_test_job_batch(commands, model_info, args, port,
script_name)
preview_script = script_path or preview_script
port += 1
command_str = '\n'.join(commands)
preview = Table()
preview.add_column(str(preview_script))
preview.add_column('Shell command preview')
preview.add_row(
Syntax.from_path(
preview_script,
background_color='default',
line_numbers=True,
word_wrap=True),
Syntax(
command_str,
'bash',
background_color='default',
line_numbers=True,
word_wrap=True))
console.print(preview)
if args.run:
proc = os.popen(command_str)
job_name_list = start_from_proc(args.work_dir, proc)
history_log = datetime.now().strftime('test-%Y%m%d-%H%M%S') + '.log'
with open(history_log, 'w') as fp:
fp.write(args.work_dir + '\n')
for job in job_name_list:
fp.write(job + '\n')
cache_path = osp.expanduser(osp.join('~', '.task_watcher'))
# print(cache_path)
os.makedirs(cache_path, exist_ok=True)
with open(osp.join(cache_path, 'latest.log'), 'w') as fp:
fp.write(args.work_dir + '\n')
for job in job_name_list:
fp.write(job + '\n')
print(f'Have saved job submission history in {history_log}')
else:
console.print('Please set "--run" to start the job')
def show_summary(summary_data,
models_map,
work_dir,
name='test_benchmark_summary',
save=False):
# table = Table(title='Test Benchmark Regression Summary')
table_title = name.replace('_', ' ')
table_title = table_title.capitalize()
table = Table(title=table_title)
table.add_column('Model')
md_header = ['Model']
used_metrics = filter_metric(METRICS_MAPPING, summary_data)
for metric in used_metrics:
table.add_column(f'{metric} (expect)')
table.add_column(f'{metric}')
md_header.append(f'{metric} (expect)')
md_header.append(f'{metric}')
table.add_column('Date')
md_header.append('Config')
def set_color(value, expect, tolerance, rule):
if value > expect + tolerance:
return 'green' if rule == 'larger' else 'red'
elif value < expect - tolerance:
return 'red' if rule == 'larger' else 'green'
else:
return 'white'
md_rows = ['| ' + ' | '.join(md_header) + ' |\n']
md_rows.append('|:' + ':|:'.join(['---'] * len(md_header)) + ':|\n')
for model_name, summary in summary_data.items():
row = [model_name]
md_row = [model_name]
for metric_key in used_metrics:
if metric_key in summary:
metric = summary[metric_key]
expect = round(metric['expect'], 2)
result = round(metric['result'], 2)
tolerance = metric['tolerance']
rule = metric['rule']
color = set_color(result, expect, tolerance, rule)
row.append(f'{expect:.2f}')
row.append(f'[{color}]{result:.2f}[/{color}]')
md_row.append(f'{expect:.4f}')
md_row.append(f'{result:.4f}')
else:
row.extend([''] * 2)
md_row.extend([''] * 2)
if 'date' in summary:
row.append(summary['date'])
md_row.append(summary['date'])
else:
row.append('')
md_row.append('')
table.add_row(*row)
# add config to row
model_info = models_map[model_name]
md_row.append(model_info.config)
md_rows.append('| ' + ' | '.join(md_row) + ' |\n')
console.print(table)
if save:
summary_path = work_dir / f'{name}.md'
with open(summary_path, 'w') as file:
file.write('# Test Benchmark Regression Summary\n')
file.writelines(md_rows)
def summary(args):
model_index_file = MMagic_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
work_dir = Path(args.work_dir)
if args.models:
patterns = [re.compile(pattern) for pattern in args.models]
filter_models = {}
for k, v in models.items():
if any([re.match(pattern, k) for pattern in patterns]):
filter_models[k] = v
if len(filter_models) == 0:
print('No model found, please specify models in:')
print('\n'.join(models.keys()))
return
models = filter_models
summary_data = {}
task_summary_data = defaultdict(dict)
for model_name, model_info in models.items():
if model_info.results is None:
continue
# Skip if not found result file.
result_file = work_dir / model_name / 'result.pkl'
if not result_file.exists():
summary_data[model_name] = {}
continue
with open(result_file, 'rb') as file:
results = pickle.load(file)
date = datetime.fromtimestamp(result_file.lstat().st_mtime)
expect_metrics = model_info.results[0].metrics
# extract metrics
summary = {'date': date.strftime('%Y-%m-%d')}
for key_yml, value_yml in METRICS_MAPPING.items():
key_results = value_yml['keys']
tolerance = value_yml['tolerance']
rule = value_yml['rule']
for key_result in key_results:
if key_yml in expect_metrics and key_result in results:
expect_result = float(expect_metrics[key_yml])
result = float(results[key_result])
summary[key_yml] = dict(
expect=expect_result,
result=result,
tolerance=tolerance,
rule=rule)
summary_data[model_name] = summary
in_collection = model_info.data['In Collection']
for task, collection_list in TASK_MAPPING.items():
if in_collection.upper() in [c.upper() for c in collection_list]:
task_summary_data[task][model_name] = summary
break
if args.by_task:
for task_name, data in task_summary_data.items():
show_summary(
data, models, work_dir, f'{task_name}_summary', save=args.save)
show_summary(summary_data, models, work_dir, save=args.save)
def main():
args = parse_args()
if args.summary:
summary(args)
else:
test(args)
if __name__ == '__main__':
main()
================================================
FILE: .dev_scripts/test_benchmark.yml
================================================
cases:
- name: controlnet-1xb1-fill50k
params:
config: configs/controlnet/controlnet-1xb1-fill50k.py
cpus_per_node: 16
gpus: 1
gpus_per_node: 1
- name: dreambooth
params:
config: configs/dreambooth/dreambooth.py
cpus_per_node: 16
gpus: 1
gpus_per_node: 1
- name: basicvsr-pp_c64n7_8xb1-600k_reds4
params:
checkpoint: basicvsr_plusplus_c64n7_8x1_600k_reds4_20210217-db622b2f.pth
checkpoint_url: https://download.openmmlab.com/mmediting/restorers/basicvsr_plusplus/basicvsr_plusplus_c64n7_8x1_600k_reds4_20210217-db622b2f.pth
config: configs/basicvsr_pp/basicvsr-pp_c64n7_8xb1-600k_reds4.py
cpus_per_node: 16
gpus: 4
gpus_per_node: 4
results:
dataset: REDS4(BIx4)
eval:
- PSNR
- SSIM
metrics:
PSNR (RGB): 32.3855
SSIM (RGB): 0.9069
- name: realbasicvsr_c64b20_1x30x8_lr5e-5_150k_reds
params:
checkpoint: realbasicvsr_c64b20_1x30x8_lr5e-5_150k_reds_20211104-52f77c2c.pth
checkpoint_url: https://download.openmmlab.com/mmediting/restorers/real_basicvsr/realbasicvsr_c64b20_1x30x8_lr5e-5_150k_reds_20211104-52f77c2c.pth
config: configs/real_basicvsr/realbasicvsr_c64b20-1x30x8_8xb1-lr5e-5-150k_reds.py
cpus_per_node: 16
gpus: 8
gpus_per_node: 8
results:
dataset: REDS
eval:
- NIQE
metrics:
NIQE (Y): 3.7662
- name: stylegan2_c2_8xb4-800kiters_ffhq-256x256
params:
checkpoint: stylegan2_c2_ffhq_256_b4x8_20210407_160709-7890ae1f.pth
checkpoint_url: https://download.openmmlab.com/mmediting/stylegan2/stylegan2_c2_ffhq_256_b4x8_20210407_160709-7890ae1f.pth
config: configs/styleganv2/stylegan2_c2-PL_8xb4-fp16-partial-GD-no-scaler-800kiters_ffhq-256x256.py
cpus_per_node: 4
gpus: 8
gpus_per_node: 8
results:
dataset: FFHQ256
metrics:
FID-50k: 3.992
- name: deepfillv2_8xb2_celeba-256x256
params:
checkpoint: deepfillv2_256x256_8x2_celeba_20200619-c96e5f12.pth
checkpoint_url: https://download.openmmlab.com/mmediting/inpainting/deepfillv2/deepfillv2_256x256_8x2_celeba_20200619-c96e5f12.pth
config: configs/deepfillv2/deepfillv2_8xb2_celeba-256x256.py
cpus_per_node: 16
gpus: 8
gpus_per_node: 8
results:
dataset: CelebA-val
metrics:
PSNR: 25.721
SSIM: 0.871
l1 error: 5.411
- name: realesrnet_c64b23g32_12x4_lr2e-4_1000k_df2k_ost
params:
checkpoint: realesrnet_c64b23g32_12x4_lr2e-4_1000k_df2k_ost_20210816-4ae3b5a4.pth
checkpoint_url: https://download.openmmlab.com/mmediting/restorers/real_esrgan/realesrnet_c64b23g32_12x4_lr2e-4_1000k_df2k_ost_20210816-4ae3b5a4.pth
config: configs/real_esrgan/realesrnet_c64b23g32_4xb12-lr2e-4-1000k_df2k-ost.py
cpus_per_node: 16
gpus: 8
gpus_per_node: 8
results:
dataset: df2k_ost
metrics:
PSNR: 28.0297
SSIM: 0.8236
cluster_num: '2'
default_floating_range: 1.0
model_floating_ranges: {}
partition: mm_lol
repo: mmagic
branch: test
task_type: test
third_part_libs: []
================================================
FILE: .dev_scripts/train_benchmark.py
================================================
import argparse
import os
import os.path as osp
import pickle
import re
from collections import OrderedDict
from datetime import datetime
from pathlib import Path
from job_watcher import start_from_proc
from modelindex.load_model_index import load
from rich.console import Console
from rich.syntax import Syntax
from rich.table import Table
from tqdm import tqdm
from utils import filter_jobs, parse_job_list_from_file
console = Console()
MMAGIC_ROOT = Path(__file__).absolute().parents[1]
# key-in-metafile: key-in-results.pkl
METRICS_MAP = {
'SWD': {
'keys': ['SWD/avg'],
'tolerance': 0.1,
'rule': 'less'
},
'MS-SSIM': {
'keys': ['MS-SSIM'],
'tolerance': 0.1,
'rule': 'larger'
},
'FID': {
'keys': ['FID-Full-50k/fid'],
'tolerance': 0.1,
'rule': 'less'
},
'FID50k': {
'keys': ['FID-Full-50k/fid'],
'tolerance': 0.1,
'rule': 'less'
},
'IS': {
'keys': ['IS-50k/is'],
'tolerance': 0.1,
'rule': 'larger'
},
'IS50k': {
'keys': ['IS-50k/is'],
'tolerance': 0.1,
'rule': 'larger'
},
'Precision50k': {
'keys': ['PR-50K/precision'],
'tolerance': 0.1,
'rule': 'large'
},
'Recall50k': {
'keys': ['PR-50K/recall'],
'tolerance': 0.1,
'rule': 'large'
},
'Precision10k': {
'keys': ['PR-10K/precision'],
'tolerance': 0.1,
'rule': 'large'
},
'Recall10k': {
'keys': ['PR-10K/recall'],
'tolerance': 0.1,
'rule': 'large'
},
# 'PPL': {}, # TODO: no ppl in metafiles?
'EQ-R': {
'keys': ['EQ/eqr'],
'tolerance': 0.1,
'rule': 'larger'
},
'EQ-T': {
'keys': ['EQ/eqt_int'],
'tolerance': 0.1,
'rule': 'larger'
},
}
def parse_args():
parser = argparse.ArgumentParser(
description="Train models' accuracy in model-index.yml")
parser.add_argument(
'partition', type=str, help='Cluster partition to use.')
parser.add_argument('--skip', type=str, default=None)
parser.add_argument('--skip-list', default=None)
parser.add_argument('--rerun', type=str, default=None)
parser.add_argument(
'--rerun-fail', action='store_true', help='only rerun failed tasks')
parser.add_argument(
'--rerun-cancel', action='store_true', help='only rerun cancel tasks')
parser.add_argument('--rerun-list', default=None)
parser.add_argument('--gpus-per-job', type=int, default=None)
parser.add_argument('--cpus-per-job', type=int, default=16)
parser.add_argument(
'--amp', action='store_true', help='Whether to use amp.')
parser.add_argument(
'--resume', action='store_true', help='Whether to resume checkpoint.')
parser.add_argument(
'--job-name', type=str, default=' ', help='Slurm job name prefix')
parser.add_argument('--port', type=int, default=29666, help='dist port')
parser.add_argument(
'--config-dir',
type=str,
default='configs_ceph',
help='Use ceph configs or not.')
parser.add_argument(
'--models', nargs='+', type=str, help='Specify model names to run.')
parser.add_argument(
'--work-dir',
default='work_dirs/benchmark_train',
help='the dir to save metric')
parser.add_argument(
'--deterministic',
action='store_true',
help='Whether set `deterministic` during training.')
parser.add_argument(
'--run', action='store_true', help='run script directly')
parser.add_argument(
'--local',
action='store_true',
help='run at local instead of cluster.')
parser.add_argument(
'--mail', type=str, help='Mail address to watch train status.')
parser.add_argument(
'--mail-type',
nargs='+',
default=['BEGIN'],
choices=['NONE', 'BEGIN', 'END', 'FAIL', 'REQUEUE', 'ALL'],
help='Mail address to watch train status.')
parser.add_argument(
'--quotatype',
default=None,
choices=['reserved', 'auto', 'spot'],
help='Quota type, only available for phoenix-slurm>=0.2')
parser.add_argument(
'--summary',
action='store_true',
help='Summarize benchmark train results.')
parser.add_argument('--save', action='store_true', help='Save the summary')
args = parser.parse_args()
if args.skip is not None:
with open(args.skip, 'r') as fp:
skip_list = fp.readlines()
skip_list = [j.split('\n')[0] for j in skip_list]
args.skip_list = skip_list
print('skip_list: ', args.skip_list)
elif args.rerun is not None:
job_id_list_full, job_name_list_full = parse_job_list_from_file(
args.rerun)
filter_target = []
if args.rerun_fail:
filter_target += ['FAILED']
if args.rerun_cancel:
filter_target += ['CANCELLED']
_, job_name_list = filter_jobs(
job_id_list_full,
job_name_list_full,
filter_target,
show_table=True,
table_name='Rerun List')
args.rerun_list = job_name_list
return args
def create_train_job_batch(commands, model_info, args, port, script_name):
config_http_prefix_blob = ('https://github.com/open-mmlab/mmagic/'
'blob/main/')
config_http_prefix_tree = ('https://github.com/open-mmlab/mmagic/'
'tree/main/')
fname = model_info.name
config = model_info.config
if config.startswith('http'):
config = config.replace(config_http_prefix_blob, './')
config = config.replace(config_http_prefix_tree, './')
config = config.replace('configs', args.config_dir)
config = Path(config)
assert config.exists(), f'{fname}: {config} not found.'
try:
n_gpus = int(model_info.metadata.data['GPUs'].split()[0])
except Exception:
if 'official' in model_info.config:
return None
else:
pattern = r'\d+xb\d+'
parse_res = re.search(pattern, config.name)
if not parse_res:
# defaults to use 1 gpu
n_gpus = 1
else:
n_gpus = int(parse_res.group().split('x')[0])
if args.gpus_per_job is not None:
n_gpus = min(args.gpus_per_job, n_gpus)
job_name = f'{args.job_name}_{fname}'
if (args.skip_list is not None) and model_info.name in args.skip_list:
return None
if (args.rerun_list is not None) and (model_info.name
not in args.rerun_list):
return None
work_dir = Path(args.work_dir) / fname
work_dir.mkdir(parents=True, exist_ok=True)
if args.mail is not None and 'NONE' not in args.mail_type:
mail_cfg = (f'#SBATCH --mail {args.mail}\n'
f'#SBATCH --mail-type {args.mail_type}\n')
else:
mail_cfg = ''
if args.quotatype is not None:
quota_cfg = f'#SBATCH --quotatype {args.quotatype}\n'
else:
quota_cfg = ''
launcher = 'none' if args.local or n_gpus == 0 else 'slurm'
runner = 'python' if args.local else 'srun python'
job_script = (f'#!/bin/bash\n'
f'#SBATCH --output {work_dir}/job.%j.out\n'
f'#SBATCH --partition={args.partition}\n'
f'#SBATCH --job-name {job_name}\n'
f'{mail_cfg}{quota_cfg}')
if n_gpus > 0:
job_script += (f'#SBATCH --gres=gpu:{n_gpus}\n'
f'#SBATCH --ntasks-per-node={min(n_gpus, 8)}\n'
f'#SBATCH --ntasks={n_gpus}\n'
f'#SBATCH --cpus-per-task={args.cpus_per_job}\n\n')
else:
job_script += '\n\n' + 'export CUDA_VISIBLE_DEVICES=-1\n'
if args.deterministic:
job_script += 'export CUBLAS_WORKSPACE_CONFIG=:4096:8\n'
job_script += (f'export MASTER_PORT={port}\n'
f'{runner} -u {script_name} {config} '
f'--work-dir={work_dir} '
f'--launcher={launcher}')
if args.resume:
job_script += ' --resume '
if args.amp:
job_script += ' --amp '
if args.deterministic:
job_script += ' --cfg-options randomness.deterministic=True'
job_script += '\n'
with open(work_dir / 'job.sh', 'w') as f:
f.write(job_script)
commands.append(f'echo "{config}"')
commands.append(f'echo "{work_dir}"')
if args.local:
commands.append(f'bash {work_dir}/job.sh')
else:
commands.append(f'sbatch {work_dir}/job.sh')
return work_dir / 'job.sh'
def train(args):
# parse model-index.yml
model_index_file = MMAGIC_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
script_name = osp.join('tools', 'train.py')
port = args.port
commands = []
if args.models:
patterns = [re.compile(pattern) for pattern in args.models]
filter_models = {}
for k, v in models.items():
if any([re.match(pattern, k) for pattern in patterns]):
filter_models[k] = v
if len(filter_models) == 0:
print('No model found, please specify models in:')
print('\n'.join(models.keys()))
return
models = filter_models
preview_script = ''
pbar = tqdm(models.values())
for model_info in pbar:
if model_info.results is None:
continue
model_name = model_info.name
pbar.set_description(model_name)
if 'cvt' in model_name:
print(f'Skip converted config: {model_name} ({model_info.config})')
continue
script_path = create_train_job_batch(commands, model_info, args, port,
script_name)
if script_path is not None:
preview_script = script_path or preview_script
port += 1
command_str = '\n'.join(commands)
preview = Table()
preview.add_column(str(preview_script))
preview.add_column('Shell command preview')
preview.add_row(
Syntax.from_path(
preview_script,
background_color='default',
line_numbers=True,
word_wrap=True),
Syntax(
command_str,
'bash',
background_color='default',
line_numbers=True,
word_wrap=True))
console.print(preview)
if args.run:
proc = os.popen(command_str)
job_name_list = start_from_proc(args.work_dir, proc)
history_log = datetime.now().strftime('train-%Y%m%d-%H%M%S') + '.log'
with open(history_log, 'w') as fp:
for job in job_name_list:
fp.write(job + '\n')
fp.close()
print(f'Have saved job submission history in {history_log}')
else:
console.print('Please set "--run" to start the job')
def show_summary(summary_data, models_map, work_dir, save=False):
table = Table(title='Train Benchmark Regression Summary')
table.add_column('Model')
md_header = ['Model']
for metric in METRICS_MAP:
table.add_column(f'{metric} (expect)')
table.add_column(f'{metric}')
md_header.append(f'{metric} (expect)')
md_header.append(f'{metric}')
table.add_column('Date')
md_header.append('Config')
def set_color(value, expect, tolerance, rule):
if value > expect + tolerance:
return 'green' if rule == 'larger' else 'red'
elif value < expect - tolerance:
return 'red' if rule == 'larger' else 'green'
else:
return 'white'
md_rows = ['| ' + ' | '.join(md_header) + ' |\n']
md_rows.append('|:' + ':|:'.join(['---'] * len(md_header)) + ':|\n')
for model_name, summary in summary_data.items():
row = [model_name]
md_row = [model_name]
for metric_key in METRICS_MAP:
if metric_key in summary:
metric = summary[metric_key]
expect = round(metric['expect'], 2)
result = round(metric['result'], 2)
tolerance = metric['tolerance']
rule = metric['rule']
color = set_color(result, expect, tolerance, rule)
row.append(f'{expect:.2f}')
row.append(f'[{color}]{result:.2f}[/{color}]')
md_row.append(f'{expect:.2f}')
md_row.append(f'{result:.2f}')
else:
row.extend([''] * 2)
md_row.extend([''] * 2)
if 'date' in summary:
row.append(summary['date'])
md_row.append(summary['date'])
else:
row.append('')
md_row.append('')
table.add_row(*row)
# add config to row
model_info = models_map[model_name]
md_row.append(model_info.config)
md_rows.append('| ' + ' | '.join(md_row) + ' |\n')
console.print(table)
if save:
summary_path = work_dir / 'train_benchmark_summary.md'
with open(summary_path, 'w') as file:
file.write('# Train Benchmark Regression Summary\n')
file.writelines(md_rows)
def summary(args):
model_index_file = MMAGIC_ROOT / 'model-index.yml'
model_index = load(str(model_index_file))
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})
work_dir = Path(args.work_dir)
if args.models:
patterns = [re.compile(pattern) for pattern in args.models]
filter_models = {}
for k, v in models.items():
if any([re.match(pattern, k) for pattern in patterns]):
filter_models[k] = v
if len(filter_models) == 0:
print('No model found, please specify models in:')
print('\n'.join(models.keys()))
return
models = filter_models
summary_data = {}
for model_name, model_info in models.items():
if model_info.results is None:
continue
# Skip if not found result file.
result_file = work_dir / model_name / 'result.pkl'
if not result_file.exists():
summary_data[model_name] = {}
continue
with open(result_file, 'rb') as file:
results = pickle.load(file)
date = datetime.fromtimestamp(result_file.lstat().st_mtime)
expect_metrics = model_info.results[0].metrics
# extract metrics
summary = {'date': date.strftime('%Y-%m-%d')}
for key_yml, key_tolerance in METRICS_MAP.items():
key_results = key_tolerance['keys']
tolerance = key_tolerance['tolerance']
rule = key_tolerance['rule']
for key_result in key_results:
if key_yml in expect_metrics and key_result in results:
expect_result = float(expect_metrics[key_yml])
result = float(results[key_result])
summary[key_yml] = dict(
expect=expect_result,
result=result,
tolerance=tolerance,
rule=rule)
summary_data[model_name] = summary
show_summary(summary_data, models, work_dir, args.save)
# if args.save:
# save_summary(summary_data, models, work_dir)
def main():
args = parse_args()
if args.summary:
summary(args)
else:
train(args)
if __name__ == '__main__':
main()
================================================
FILE: .dev_scripts/train_benchmark.yml
================================================
cases:
- name: controlnet-1xb1-fill50k
params:
config: configs/controlnet/controlnet-1xb1-fill50k.py
cpus_per_node: 16
gpus: 1
gpus_per_node: 1
- name: dreambooth
params:
config: configs/dreambooth/dreambooth.py
cpus_per_node: 16
gpus: 1
gpus_per_node: 1
- name: basicvsr-pp_c64n7_8xb1-600k_reds4
params:
checkpoint: basicvsr_plusplus_c64n7_8x1_600k_reds4_20210217-db622b2f.pth
checkpoint_url: https://download.openmmlab.com/mmediting/restorers/basicvsr_plusplus/basicvsr_plusplus_c64n7_8x1_600k_reds4_20210217-db622b2f.pth
config: configs/basicvsr_pp/basicvsr-pp_c64n7_8xb1-600k_reds4.py
cpus_per_node: 16
gpus: 4
gpus_per_node: 4
results:
dataset: REDS4(BIx4)
eval:
- PSNR
- SSIM
metrics:
PSNR (RGB): 32.3855
SSIM (RGB): 0.9069
- name: realbasicvsr_c64b20_1x30x8_lr5e-5_150k_reds
params:
checkpoint: realbasicvsr_c64b20_1x30x8_lr5e-5_150k_reds_20211104-52f77c2c.pth
checkpoint_url: https://download.openmmlab.com/mmediting/restorers/real_basicvsr/realbasicvsr_c64b20_1x30x8_lr5e-5_150k_reds_20211104-52f77c2c.pth
config: configs/real_basicvsr/realbasicvsr_c64b20-1x30x8_8xb1-lr5e-5-150k_reds.py
cpus_per_node: 16
gpus: 8
gpus_per_node: 8
results:
dataset: REDS
eval:
- NIQE
metrics:
NIQE (Y): 3.7662
- name: stylegan2_c2_8xb4-800kiters_ffhq-256x256
params:
checkpoint: stylegan2_c2_ffhq_256_b4x8_20210407_160709-7890ae1f.pth
checkpoint_url: https://download.openmmlab.com/mmediting/stylegan2/stylegan2_c2_ffhq_256_b4x8_20210407_160709-7890ae1f.pth
config: configs/styleganv2/stylegan2_c2-PL_8xb4-fp16-partial-GD-no-scaler-800kiters_ffhq-256x256.py
cpus_per_node: 4
gpus: 8
gpus_per_node: 8
results:
dataset: FFHQ256
metrics:
FID-50k: 3.992
- name: deepfillv2_8xb2_celeba-256x256
params:
checkpoint: deepfillv2_256x256_8x2_celeba_20200619-c96e5f12.pth
checkpoint_url: https://download.openmmlab.com/mmediting/inpainting/deepfillv2/deepfillv2_256x256_8x2_celeba_20200619-c96e5f12.pth
config: configs/deepfillv2/deepfillv2_8xb2_celeba-256x256.py
cpus_per_node: 16
gpus: 8
gpus_per_node: 8
results:
dataset: CelebA-val
metrics:
PSNR: 25.721
SSIM: 0.871
l1 error: 5.411
- name: realesrnet_c64b23g32_12x4_lr2e-4_1000k_df2k_ost
params:
checkpoint: realesrnet_c64b23g32_12x4_lr2e-4_1000k_df2k_ost_20210816-4ae3b5a4.pth
checkpoint_url: https://download.openmmlab.com/mmediting/restorers/real_esrgan/realesrnet_c64b23g32_12x4_lr2e-4_1000k_df2k_ost_20210816-4ae3b5a4.pth
config: configs/real_esrgan/realesrnet_c64b23g32_4xb12-lr2e-4-1000k_df2k-ost.py
cpus_per_node: 16
gpus: 8
gpus_per_node: 8
results:
dataset: df2k_ost
metrics:
PSNR: 28.0297
SSIM: 0.8236
cluster_num: '2'
default_floating_range: 1.0
model_floating_ranges: {}
partition: mm_lol
repo: mmagic
branch: test
task_type: train
third_part_libs: []
================================================
FILE: .dev_scripts/update_config_readme.py
================================================
#!/usr/bin/env python
# Copyright (c) OpenMMLab. All rights reserved.
# This tool is used to update README.md and README_zh-CN.md in configs
import glob
import os
import posixpath as osp # Even on windows, use posixpath
import re
import sys
MMagic_ROOT = osp.dirname(osp.dirname(osp.dirname(__file__)))
def update_md(md_file):
"""Update README.md and README_zh-CN.md.
Args:
md_file (str): Path to .md file.
Returns:
Bool: If the target README.md file is different from the original.
"""
# See https://github.com/open-mmlab/mmagic/pull/798 for these comments
# unique_dict = generate_unique_name(md_file)
md_file = md_file.replace(os.sep, '/')
config_dir, _ = osp.split(md_file)
files = os.listdir(config_dir)
config_files = [file for file in files if file.endswith('.py')]
for readme in ['README.md', 'README_zh-CN.md']:
readme = osp.join(config_dir, readme)
changed = False
with open(readme, 'r', encoding='utf-8') as f:
data = f.read()
for config in config_files:
_, ext = osp.splitext(config)
if ext != '.py':
continue
re_config = config.replace('.', '\\.')
re_config = config.replace('-', '\\-')
re_result = re.search(rf'\]\(/(.*?)/{re_config}', data)
if re_result is None:
print(f'Warning: No {config} in {readme}')
continue
old_dir = re_result.groups()[0]
if old_dir != config_dir:
data = data.replace(old_dir, config_dir)
print(f'from {old_dir} to {config_dir}')
changed = True
if changed:
with open(readme, 'w', encoding='utf-8') as f:
f.write(data)
return False
if __name__ == '__main__':
if len(sys.argv) <= 1:
configs_root = osp.join(MMagic_ROOT, 'configs')
file_list = glob.glob(
osp.join(configs_root, '**', '*README.md'), recursive=True)
file_list.sort()
else:
file_list = [
fn for fn in sys.argv[1:] if osp.basename(fn) == 'README.md'
]
if not file_list:
sys.exit(0)
file_modified = False
for fn in file_list:
print(f'process {fn}')
file_modified |= update_md(fn)
sys.exit(1 if file_modified else 0)
================================================
FILE: .dev_scripts/update_model_index.py
================================================
#!/usr/bin/env python
# Copyright (c) OpenMMLab. All rights reserved.
"""This tool is used to update model-index.yml which is required by MIM, and
will be automatically called as a pre-commit hook. The updating will be
triggered if any change of model information (.md files in configs/) has been
detected before a commit.
The design of the metafile follows /wikcnz2ksDIyZiFM8iAMUoTmNHg.
It is forbidden to set value as `NULL`, `None` or empty list and str.
`Collection`: indicates a algorithm (which may
contains multiple configs), e.g. Mask R-CNN
- `Name` (str): required
- `README` (str): optional
- `Paper` (dict): optional
- `URL` (str): required
- `Title` (str): required
- `Task` (List[str]): optional
- `Year` (int): optional
- `Metadata` (dict): optional
- `Architecture` (List[str]): optional
- `Training Data` (Union[str, List[str]]): optional
- `Epochs` (int): optional
- `Batch Size` (int): optional
- `Training Techniques` (List[str]): optional
- `Training Resources` (str): optional
- `FLOPs` (Union[int, float]): optional
- `Parameters` (int): optional
- `Training Time` (Union[int, float]): optional
- `Train time (s/iter)` (Union[int, float]): optional
- `Training Memory (GB)` (float): optional
- `Weights` (Union[str, List[str]]): optional
`Model`: indicates a specific config
- `Name` (str): required, globally unique
- `In Collection` (str): required
- `Config` (str): required
- `Results` (List[dict]): required
- `Task` (str): required
- `Dataset` (str): required
- `Metrics` (dict): required
- `Weights` (str): optional
- `Metadata` (dict): optional
- `Architecture` (List[str]): optional
- `Training Resources` (str): optional
- `Training Data` (Union[str, List[str]]): optional
- `Epochs` (int): optional
- `Batch Size` (int): optional
- `Training Techniques` (List[str]): optional
- `FLOPs` (Union[int, float]): optional
- `Parameters` (int): optional
- `Training Time` (Union[int, float]): optional
- `Train time (s/iter)` (Union[int, float]): optional
- `Training Memory (GB)` (float): optional
- `inference time (ms/im)` (List[dict]): optional
- `value` (float): required
- `hardware` (str): required
- `backend` (str): required
- `batch size` (str): required
- `mode` (str): required, e.g., FP32, FP16, INT8, etc.
- `resolution` (Tuple(int, int)): required
- `Training Log` (str): optional
- `README` (str): optional
- `Paper` (dict): optional
- `URL` (str): required
- `Title` (str): required
- `Converted From` (dict): optional
- `Weights` (str): required
- `Code` (str): required
- `Code` (dict): optional
- `URL` (str): required
- `Version` (str): required
- `Image` (str): optional
The README.md file in MMagic follows following convention,
- `Model`: [name_in_the_paper](path_to_config)
- `Download`: [model](url_to_pre_trained_weights) | [log](url_to_log)
"""
import glob
import posixpath as osp # Even on windows, use posixpath
import re
import sys
import tqdm
from modelindex.models.Collection import Collection
from modelindex.models.Metadata import Metadata
from modelindex.models.Model import Model
from modelindex.models.Result import Result
from utils import (collate_metrics, dump_yaml_and_check_difference,
found_table, modelindex_to_dict)
MMagic_ROOT = osp.dirname(osp.dirname(__file__))
KEYWORDS = [
'Model',
'Dataset',
'Download',
]
def parse_md(md_file):
"""Parse .md file and convert it to a .yml file which can be used for MIM.
Args:
md_file (str): Path to .md file.
Returns:
Bool: If the target YAML file is different from the original.
"""
readme = osp.relpath(md_file, MMagic_ROOT)
readme = readme.replace('\\', '/') # for windows
collection = Collection()
collection_meta = Metadata()
# force utf-8 instead of system defined
with open(md_file, 'r', encoding='utf-8') as md:
lines = md.readlines()
# parse information for collection
name = lines[0][2:]
name, year = name.split('(', 1)
year = int(re.sub('[^0-9]', '', year))
collection_name = name.strip()
task_line = lines[4]
model_task = task_line.strip().split(':')[-1].strip()
model_task_list = model_task.lower().split(', ')
collection.name = collection_name
collection.readme = readme
collection.data['Year'] = year
collection.data['Task'] = model_task_list
collection_meta.architecture = [collection_name]
i = 0
model_list = {}
while i < len(lines):
# parse reference
if lines[i].startswith('> ['):
title, url = re.match(r'> \[(.*)]\((.*)\)', lines[i]).groups()
collection.paper = dict(URL=url, Title=title)
i += 1
# parse table
elif found_table(lines, i):
cols = [col.strip() for col in lines[i].split('|')][1:-1]
# check required field for Model
try:
model_idx = cols.index('Model')
dataset_idx = cols.index('Dataset')
download_idx = cols.index('Download')
used_metrics = collate_metrics(cols)
if 'Task' in cols:
task_idx = cols.index('Task')
else:
task_idx = None
except Exception:
raise ValueError(
f'required fields: Model, Dataset, Download '
f'are not included in line {i+1} of {md_file}')
j = i + 2
# parse table for valid fields
while j < len(lines) and lines[j][0] == '|':
line = lines[j].split('|')[1:-1]
# name, in_collection, config of Model
assert line[model_idx].find(
'](') >= 0, f'invalid {model_idx} in {line} for {md_file}.'
left = line[model_idx].index('](') + 2
right = line[model_idx].index(')', left)
config = line[model_idx][left:right].strip('./')
model_name = osp.splitext(osp.basename(config))[0]
if model_name in model_list:
model = model_list[model_name]
else:
model = Model(
name=model_name,
in_collection=collection_name,
config=osp.join(
osp.dirname(md_file), model_name + '.py'))
model_list[model_name] = model
# find results in each row
dataset = line[dataset_idx].replace(' ', '')
metrics = {}
for metric_name, idx in used_metrics.items():
value = line[idx]
value = value.replace('*', '')
if '/' not in value:
try:
value = value.split('(')[0]
metrics[metric_name] = float(value)
except ValueError:
value = value.replace(' ', '')
else:
try:
PSNR, SSIM = [float(d) for d in value.split('/')]
metrics[metric_name] = dict(PSNR=PSNR, SSIM=SSIM)
except ValueError:
pass
task = model_task if task_idx is None else line[
task_idx].strip()
assert ',' not in task, (
f'Find "," in "task" field of "{md_file}" (line {j}). '
'Please check your readme carefully.')
assert task.lower() in model_task_list, (
f'Task "{task}" not in "{model_task_list}" in "{md_file}" '
f'(line {j}). Please check your readme carefully.')
result = Result(task=task, dataset=dataset, metrics=metrics)
if model.results is None:
model.results = result
else:
model.results.data.append(result)
# check weights
if line[download_idx].find('](') >= 0:
if line[download_idx].find('model](') >= 0:
left = line[download_idx].index('model](') + 7
else:
left = line[download_idx].index('ckpt](') + 6
right = line[download_idx].index(')', left)
model.weights = line[download_idx][left:right]
j += 1
i = j
else:
i += 1
collection = modelindex_to_dict(collection)
models = [modelindex_to_dict(m) for n, m in model_list.items()]
assert len(models) > 0, f"'no model is found in {md_file}'"
result = {'Collections': [collection], 'Models': models}
yml_file = md_file.replace('README.md', 'metafile.yml')
is_different = dump_yaml_and_check_difference(result, yml_file)
return is_different
def update_model_index():
"""Update model-index.yml according to model .md files.
Returns:
Bool: If the updated model-index.yml is different from the original.
"""
configs_dir = osp.join(MMagic_ROOT, 'configs')
yml_files = glob.glob(osp.join(configs_dir, '**', '*.yml'), recursive=True)
yml_files.sort()
model_index = {
'Import': [
osp.relpath(yml_file, MMagic_ROOT).replace(
'\\', '/') # force using / as path separators
for yml_file in yml_files
]
}
model_index_file = osp.join(MMagic_ROOT, 'model-index.yml')
is_different = dump_yaml_and_check_difference(model_index,
model_index_file)
return is_different
if __name__ == '__main__':
if len(sys.argv) <= 1:
configs_root = osp.join(MMagic_ROOT, 'configs')
file_list = glob.glob(
osp.join(configs_root, '**', '*README.md'), recursive=True)
file_list.sort()
else:
file_list = [
fn for fn in sys.argv[1:] if osp.basename(fn) == 'README.md'
]
if not file_list:
sys.exit(0)
file_modified = False
file_list = file_list
pbar = tqdm.tqdm(range(len(file_list)), initial=0, dynamic_ncols=True)
for fn in file_list:
file_modified |= parse_md(fn)
pbar.update(1)
pbar.set_description(f'processing {fn}')
file_modified |= update_model_index()
sys.exit(1 if file_modified else 0)
================================================
FILE: .dev_scripts/update_ut.py
================================================
import os
import os.path as osp
from argparse import ArgumentParser
from fnmatch import fnmatch
from glob import glob
from tqdm import tqdm
parser = ArgumentParser()
parser.add_argument('--src', type=str, default='mmagic')
parser.add_argument('--dst', type=str, default='tests')
parser.add_argument(
'--exclude',
nargs='+',
default=[
'mmagic/.mim', 'mmagic/registry.py', 'mmagic/version.py',
'__pycache__', '__init__', '**/__init__.py', '**/stylegan3_ops/*',
'**/conv2d_gradfix.py', '**/grid_sample_gradfix.py', '**/misc.py',
'**/upfirdn2d.py', '**/all_gather_layer.py', '**/typing.py'
])
args = parser.parse_args()
def check_exclude(fn):
for pattern in args.exclude:
if fnmatch(fn, pattern):
return True
return False
def update_ut():
target_ut = []
missing_ut = []
blank_ut = []
file_list = glob('mmagic/**/*.py', recursive=True)
for f in tqdm(file_list):
if check_exclude(f):
continue
if osp.splitext(osp.basename(f))[0] != '__init__':
dirname = osp.dirname(f)
dirname = dirname.replace('__', '')
dirname = dirname.replace('mmagic', 'tests')
dirname = dirname.replace('/', '/test_')
os.makedirs(dirname, exist_ok=True)
basename = osp.basename(f)
basename = 'test_' + basename
dst_path = osp.join(dirname, basename)
target_ut.append(dst_path)
if not osp.exists(dst_path):
missing_ut.append(dst_path)
fp = open(dst_path, 'a')
fp.close()
else:
text_lines = open(dst_path, 'r').readlines()
if len(text_lines) <= 3:
blank_ut.append(dst_path)
existing_ut = glob('tests/test_*/**/*.py', recursive=True)
additional_ut = list(set(existing_ut) - set(target_ut))
if len(additional_ut) > 0:
print('Additional UT:')
for f in additional_ut:
print(f)
if len(missing_ut) > 0:
print('Missing UT:')
for f in missing_ut:
print(f)
if len(blank_ut) > 0:
print('Blank UT:')
for f in blank_ut:
print(f)
if __name__ == '__main__':
update_ut()
================================================
FILE: .dev_scripts/utils/__init__.py
================================================
from .job_util import (filter_jobs, get_info_from_id, parse_job_list,
parse_job_list_from_file)
from .modelindex import (collate_metrics, dump_yaml_and_check_difference,
found_table, modelindex_to_dict)
__all__ = [
'modelindex_to_dict', 'found_table', 'dump_yaml_and_check_difference',
'collate_metrics', 'parse_job_list', 'parse_job_list_from_file',
'get_info_from_id', 'filter_jobs'
]
================================================
FILE: .dev_scripts/utils/job_util.py
================================================
import os
import os.path as osp
from typing import Tuple
from rich import print as pprint
from rich.table import Table
def parse_job_list(job_list) -> Tuple[list, list]:
"""Parse task name and job id from list. All elements in `job_list` must.
be formatted as `JOBID @ JOBNAME`.
Args:
job_list (list[str]): Job list.
Returns:
Tuple[list, list]: Job ID list and Job name list.
"""
assert all([
' @ ' in job for job in job_list
]), ('Each line of job list must be formatted like \'JOBID @ JOBNAME\'.')
job_id_list, job_name_list = [], []
for job_info in job_list:
job_id, job_name = job_info.split(' @ ')
job_id_list.append(job_id)
job_name_list.append(job_name)
return job_id_list, job_name_list
def parse_job_list_from_file(job_list_file: str) -> Tuple[list, list]:
"""Parse job list from file and return a tuple contains list of job id and
job name.
Args:
job_list_file (str): The path to the file list.
Returns:
Tuple[list, list]: A tuple contains list of job id and job name.
"""
if not osp.exists(job_list_file):
return False
with open(job_list_file, 'r') as file:
job_list = [job.strip() for job in file.readlines()]
return parse_job_list(job_list)
def get_info_from_id(job_id: str) -> dict:
"""Get the basic information of a job id with `swatch examine` command.
Args:
job_id (str): The ID of the job.
Returns:
dict: A dict contains information of the corresponding job id.
"""
# NOTE: do not have exception handling here
info_stream = os.popen(f'swatch examine {job_id}')
info_str = [line.strip() for line in info_stream.readlines()]
status_info = info_str[2].split()
try:
status_dict = {
'JobID': status_info[0],
'JobName': status_info[1],
'Partition': status_info[2],
'NNodes': status_info[3],
'AllocCPUS': status_info[4],
'State': status_info[5]
}
except Exception:
print(job_id)
print(info_str)
return status_dict
def filter_jobs(job_id_list: list,
job_name_list: list,
select: list = ['FAILED'],
show_table: bool = False,
table_name: str = 'Filter Results') -> Tuple[list, list]:
"""Filter the job which status not belong to :attr:`select`.
Args:
job_id_list (list): The list of job ids.
job_name_list (list): The list of job names.
select (list, optional): Which kind of jobs will be selected.
Defaults to ['FAILED'].
show_table (bool, optional): Whether display the filter result in a
table. Defaults to False.
table_name (str, optional): The name of the table. Defaults to
'Filter Results'.
Returns:
Tuple[list]: A tuple contains selected job ids and job names.
"""
# if ignore is not passed, return the original id list and name list
if not select:
return job_id_list, job_name_list
filtered_id_list, filtered_name_list = [], []
job_info_list = []
for id_, name_ in zip(job_id_list, job_name_list):
info = get_info_from_id(id_)
job_info_list.append(info)
if info['State'] in select:
filtered_id_list.append(id_)
filtered_name_list.append(name_)
if show_table:
filter_table = Table(title=table_name)
for field in ['Name', 'ID', 'State', 'Is Selected']:
filter_table.add_column(field)
for id_, name_, info_ in zip(job_id_list, job_name_list,
job_info_list):
selected = '[green]True' \
if info_['State'] in select else '[red]False'
filter_table.add_row(name_, id_, info_['State'], selected)
pprint(filter_table)
return filtered_id_list, filtered_name_list
================================================
FILE: .dev_scripts/utils/modelindex.py
================================================
import os.path as osp
import mmengine
from modelindex.models.Collection import Collection
from modelindex.models.Model import Model
def dump_yaml_and_check_difference(obj, file):
"""Dump object to a yaml file, and check if the file content is different
from the original.
Args:
obj (any): The python object to be dumped.
file (str): YAML filename to dump the object to.
Returns:
Bool: If the target YAML file is different from the original.
"""
str_dump = mmengine.dump(
obj, None, file_format='yaml', sort_keys=True,
line_break='\n') # force use LF
if osp.isfile(file):
file_exists = True
# print(f' exist {file}')
with open(file, 'r', encoding='utf-8') as f:
str_orig = f.read()
else:
file_exists = False
str_orig = None
if file_exists and str_orig == str_dump:
is_different = False
else:
is_different = True
print(f' update {file}')
with open(file, 'w', encoding='utf-8') as f:
f.write(str_dump)
return is_different
def collate_metrics(keys):
"""Collect metrics from the first row of the table.
Args:
keys (List): Elements in the first row of the table.
Returns:
dict: A dict of metrics.
"""
used_metrics = dict()
for idx, key in enumerate(keys):
if key in ['Model', 'Dataset', 'Training Resources', 'Download']:
continue
used_metrics[key] = idx
return used_metrics
def found_table(lines, i):
if i + 1 >= len(lines):
return False
if i - 2 < 0 or 'SKIP THIS TABLE' in lines[i - 2]:
return False
if lines[i][0] != '|':
return False
for c in ['| :', '|:', '|-']:
if c in lines[i + 1]:
return True
return False
def modelindex_to_dict(model):
if isinstance(model, Collection):
result = model.data
if model.metadata is not None:
result['Metadata'] = model.metadata.data
elif isinstance(model, Model):
result = model.data
if model.metadata is not None:
result['Metadata'] = model.metadata.data
if model.results is not None:
results_list = []
for r in model.results:
results_list.append(r.data)
result['Results'] = results_list
return result
================================================
FILE: .github/CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at chenkaidev@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
[homepage]: https://www.contributor-covenant.org
================================================
FILE: .github/CONTRIBUTING.md
================================================
# Contributing to MMagic
All kinds of contributions are welcome, including but not limited to the following.
- Fix typo or bugs
- Add documentation or translate the documentation into other languages
- Add new features and components
## Workflow
1. fork and pull the latest MMagic repository (MMagic)
2. checkout a new branch (do not use master branch for PRs)
3. commit your changes
4. create a PR
```{note}
If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first.
```
## Code style
### Python
We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style.
We use the following tools for linting and formatting:
- [flake8](https://github.com/PyCQA/flake8): A wrapper around some linter tools.
- [isort](https://github.com/timothycrosley/isort): A Python utility to sort imports.
- [yapf](https://github.com/google/yapf): A formatter for Python files.
- [codespell](https://github.com/codespell-project/codespell): A Python utility to fix common misspellings in text files.
- [mdformat](https://github.com/executablebooks/mdformat): Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files.
- [docformatter](https://github.com/myint/docformatter): A formatter to format docstring.
Style configurations can be found in [setup.cfg](/setup.cfg).
We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`, `markdown files`,
fixes `end-of-files`, `double-quoted-strings`, `python-encoding-pragma`, `mixed-line-ending`, sorts `requirments.txt` automatically on every commit.
The config for a pre-commit hook is stored in [.pre-commit-config](/.pre-commit-config.yaml).
After you clone the repository, you will need to install initialize pre-commit hook.
```shell
pip install -U pre-commit
```
From the repository folder
```shell
pre-commit install
```
After this on every commit check code linters and formatter will be enforced.
```{important}
Before you create a PR, make sure that your code lints and is formatted by yapf.
```
### C++ and CUDA
We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
================================================
FILE: .github/ISSUE_TEMPLATE/1-bug-report.yml
================================================
name: "🐞 Bug report"
description: "Create a report to help us reproduce and fix the bug"
labels: "kind/bug,status/unconfirmed"
title: "[Bug] "
body:
- type: markdown
attributes:
value: |
If you have already identified the reason, we strongly appreciate you creating a new PR to fix it [here](https://github.com/open-mmlab/mmagic/pulls)!
If this issue is about installing MMCV, please file an issue at [MMCV](https://github.com/open-mmlab/mmcv/issues/new/choose).
If you need our help, please fill in as much of the following form as you're able to.
**The less clear the description, the longer it will take to solve it.**
- type: checkboxes
attributes:
label: Prerequisite
description: Please check the following items before creating a new issue.
options:
- label: I have searched [Issues](https://github.com/open-mmlab/mmagic/issues) and [Discussions](https://github.com/open-mmlab/mmagic/discussions) but cannot get the expected help.
required: true
- label: I have read the [FAQ documentation](https://mmagic.readthedocs.io/en/latest/faq.html) but cannot get the expected help.
required: true
- label: The bug has not been fixed in the [latest version (main)](https://github.com/open-mmlab/mmagic) or [latest version (0.x)](https://github.com/open-mmlab/mmagic/tree/0.x).
required: true
- type: dropdown
id: task
attributes:
label: Task
description: The problem arises when
options:
- I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
- I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.
validations:
required: true
- type: dropdown
id: branch
attributes:
label: Branch
description: The problem arises when I'm working on
options:
- main branch https://github.com/open-mmlab/mmagic
- 0.x branch https://github.com/open-mmlab/mmagic/tree/0.x
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
Please run `python mmagic/utils/collect_env.py` to collect necessary environment information and copy-paste it here.
You may add additional information that may be helpful for locating the problem, such as
- How you installed PyTorch \[e.g., pip, conda, source\]
- Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)
validations:
required: true
- type: textarea
attributes:
label: Reproduces the problem - code sample
description: |
Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet.
placeholder: |
```python
# Sample code to reproduce the problem
```
validations:
required: true
- type: textarea
attributes:
label: Reproduces the problem - command or script
description: |
What command or script did you run?
placeholder: |
```shell
The command or script you run.
```
validations:
required: true
- type: textarea
attributes:
label: Reproduces the problem - error message
description: |
Please provide the error message or logs you got, with the full traceback.
placeholder: |
```
The error message or logs you got, with the full traceback.
```
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: Tell us anything else you think we should know.
placeholder: |
1. What's your expected result?
2. What dataset did you use?
3. What do you think might be the reason?
================================================
FILE: .github/ISSUE_TEMPLATE/2-feature-request.yml
================================================
name: 🚀 Feature request
description: Suggest an idea for this project
labels: "kind/enhancement,status/unconfirmed"
title: "[Feature] "
body:
- type: markdown
attributes:
value: |
We strongly appreciate you creating a PR to implement this feature [here](https://github.com/open-mmlab/mmagic/pulls)!
If you need our help, please fill in as much of the following form as you're able to.
**The less clear the description, the longer it will take to solve it.**
- type: textarea
attributes:
label: What's the feature?
description: |
Tell us more about the feature and how this feature can help.
placeholder: |
E.g., It is inconvenient when \[....\].
This feature can \[....\].
validations:
required: true
- type: textarea
attributes:
label: Any other context?
description: |
Have you considered any alternative solutions or features? If so, what are they?
Also, feel free to add any other context or screenshots about the feature request here.
================================================
FILE: .github/ISSUE_TEMPLATE/3-new-model.yml
================================================
name: "\U0001F31F New model/dataset/scheduler addition"
description: Submit a proposal/request to implement a new model / dataset / scheduler
labels: "kind/feature,status/unconfirmed"
title: "[New Models] "
body:
- type: textarea
id: description-request
validations:
required: true
attributes:
label: Model/Dataset/Scheduler description
description: |
Put any and all important information relative to the model/dataset/scheduler
- type: checkboxes
attributes:
label: Open source status
description: |
Please provide the open-source status, which would be very helpful
options:
- label: "The model implementation is available"
- label: "The model weights are available."
- type: textarea
id: additional-info
attributes:
label: Provide useful links for the implementation
description: |
Please provide information regarding the implementation, the weights, and the authors.
Please mention the authors by @gh-username if you're aware of their usernames.
================================================
FILE: .github/ISSUE_TEMPLATE/4-documentation.yml
================================================
name: 📚 Documentation
description: Report an issue related to the documentation.
labels: "kind/doc,status/unconfirmed"
title: "[Docs] "
body:
- type: dropdown
id: branch
attributes:
label: Branch
description: This issue is related to the
options:
- main branch https://mmagic.readthedocs.io/en/latest/
- 0.x branch https://mmagic.readthedocs.io/en/0.x/
validations:
required: true
- type: textarea
attributes:
label: 📚 The doc issue
description: >
A clear and concise description the issue.
validations:
required: true
- type: textarea
attributes:
label: Suggest a potential alternative/fix
description: >
Tell us how we could improve the documentation in this regard.
- type: markdown
attributes:
value: >
Thanks for contributing 🎉!
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: 💬 Forum
url: https://github.com/open-mmlab/mmagic/discussions
about: Ask general usage questions and discuss with other MMagic community members
- name: 🌐 Explore OpenMMLab
url: https://openmmlab.com/
about: Get to know more about OpenMMLab
================================================
FILE: .github/pull_request_template.md
================================================
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
## Motivation
Please describe the motivation of this PR and the goal you want to achieve through this PR.
## Modification
Please briefly describe what modification is made in this PR.
## BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
## Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
## Checklist
Submitting this pull request means that,
**Before PR**:
- [x] I have read and followed the workflow indicated in the [CONTRIBUTING.md](https://github.com/open-mmlab/mmagic/blob/main/.github/CONTRIBUTING.md) to create this PR.
- [x] Pre-commit or linting tools indicated in [CONTRIBUTING.md](https://github.com/open-mmlab/mmagic/blob/main/.github/CONTRIBUTING.md) are used to fix the potential lint issues.
- [x] Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
- [x] New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
- [x] The documentation has been modified accordingly, including docstring or example tutorials.
**After PR**:
- [x] If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects.
- [x] CLA has been signed and all committers have signed the CLA in this PR.
================================================
FILE: .github/workflows/lint.yml
================================================
name: lint
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pre-commit hook
run: |
pip install pre-commit
pre-commit install
- name: Linting
run: pre-commit run --all-files
- name: Check docstring coverage
run: |
pip install interrogate
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 90 mmagic
================================================
FILE: .github/workflows/merge_stage_test.yml
================================================
name: merge_stage_test
on:
push:
paths-ignore:
- 'README.md'
- 'README_zh-CN.md'
- 'docs/**'
- '.owners.yml'
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.md'
- '.dev_scripts/**'
- '.circleci/**'
- 'configs/**'
- 'projects/**'
branches:
- dev-1.x
- test-1.x
- main
- test-branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_cpu_py:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8, 3.9]
torch: [1.8.1]
include:
- torch: 1.8.1
torchvision: 0.9.1
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade && pip install wheel
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
- name: Install MMEngine
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
- name: Install MMCV
run: |
pip install -U openmim
mim install 'mmcv >= 2.0.0'
- name: Install other dependencies
run: |
pip install -r requirements/tests.txt
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmagic -m pytest tests/
coverage xml
coverage report -m
build_cpu_pt:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.7]
torch: [1.8.1, 1.9.1, 1.10.1, 1.11.0, 1.12.1, 1.13.0]
include:
- torch: 1.8.1
torchvision: 0.9.1
- torch: 1.9.1
torchvision: 0.10.1
- torch: 1.10.1
torchvision: 0.11.2
- torch: 1.11.0
torchvision: 0.12.0
- torch: 1.12.1
torchvision: 0.13.1
- torch: 1.13.0
torchvision: 0.14.0
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade && pip install wheel
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
- name: Install MMEngine
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
- name: Install MMCV
run: |
pip install -U openmim
mim install 'mmcv >= 2.0.0'
- name: Install other dependencies
run: |
pip install -r requirements/tests.txt
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmagic -m pytest tests/
coverage xml --omit="**/stylegan3_ops/*,**/conv2d_gradfix.py,**/grid_sample_gradfix.py,**/misc.py,**/upfirdn2d.py,**all_gather_layer.py"
coverage report -m
# Only upload coverage report for python3.7 && pytorch1.8.1 cpu
- name: Upload coverage to Codecov
if: ${{matrix.torch == '1.8.1' && matrix.python-version == '3.7'}}
uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
build_cu102:
runs-on: ubuntu-22.04
container:
image: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
strategy:
matrix:
python-version: [3.7]
include:
- torch: 1.8.1
cuda: 10.2
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade && pip install wheel
- name: Fetch GPG keys
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2204/x86_64/7fa2af80.pub
- name: Install system dependencies
run: |
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
- name: Install PyTorch
run: pip install torch==1.8.1+cpu torchvision==0.9.1+cpu -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install mmagic dependencies
run: |
pip install -U openmim
mim install 'mmcv >= 2.0.0'
pip install -r requirements/tests.txt
- name: Build and install
run: |
pip install -e .
build_cu116:
runs-on: ubuntu-22.04
container:
image: pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel
strategy:
matrix:
python-version: [3.7]
include:
- torch: 1.8.1
cuda: 10.2
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade && pip install wheel
- name: Fetch GPG keys
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2204/x86_64/7fa2af80.pub
- name: Install system dependencies
run: |
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
- name: Install PyTorch
run: pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu
- name: Install mmagic dependencies
run: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0'
pip install -r requirements/tests.txt
- name: Build and install
run: |
pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmagic -m pytest tests/
coverage xml --omit="**/stylegan3_ops/*,**/conv2d_gradfix.py,**/grid_sample_gradfix.py,**/misc.py,**/upfirdn2d.py,**all_gather_layer.py"
coverage report -m
build_windows:
runs-on: windows-2022
strategy:
matrix:
python: [3.7]
platform: [cpu, cu111]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install pip --upgrade && pip install wheel
- name: Install lmdb
run: python -m pip install lmdb
- name: Install PyTorch
run: python -m pip install torch==1.8.1+${{matrix.platform}} torchvision==0.9.1+${{matrix.platform}} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install mmagic dependencies
run: |
python -m pip install git+https://github.com/open-mmlab/mmengine.git@main
python -m pip install -U openmim
mim install 'mmcv >= 2.0.0'
python -m pip install -r requirements/tests.txt
- name: Build and install
run: |
python -m pip install -e .
- name: Run unittests and generate coverage report
run: |
pytest tests/
================================================
FILE: .github/workflows/pr_stage_test.yml
================================================
name: pr_stage_test
on:
pull_request:
paths-ignore:
- 'README.md'
- 'README_zh-CN.md'
- '.owners.yml'
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.md'
- 'docs/**'
- 'projects/**'
- '.dev_scripts/**'
- '.circleci/**'
- 'configs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_cpu:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8]
include:
- torch: 2.0.1
torchvision: 0.15.2
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade && pip install wheel
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install MMEngine
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
- name: Install MMCV
run: |
pip install -U openmim
mim install 'mmcv >= 2.0.0'
- name: Install other dependencies
run: |
pip install -r requirements/tests.txt
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmagic -m pytest tests/
coverage xml --omit="**/stylegan3_ops/*,**/conv2d_gradfix.py,**/grid_sample_gradfix.py,**/misc.py,**/upfirdn2d.py,**all_gather_layer.py"
coverage report -m
# Upload coverage report for python3.7 && pytorch1.8.1 cpu
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
build_cu118:
runs-on: ubuntu-22.04
container:
image: pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade && pip install wheel
- name: Fetch GPG keys
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2204/x86_64/7fa2af80.pub
- name: Install system dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev
- name: Install PyTorch
run: pip install torch==2.0.1+cpu torchvision==0.15.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install mmagic dependencies
run: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0'
pip install -r requirements/tests.txt
- name: Build and install
run: |
pip install -e .
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
build_windows:
runs-on: windows-2022
strategy:
matrix:
python-version: [3.8]
platform: [cpu, cu118]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install pip --upgrade && pip install wheel
- name: Install lmdb
run: python -m pip install lmdb
- name: Install PyTorch
run: python -m pip install torch==2.0.1+${{matrix.platform}} torchvision==0.15.2+${{matrix.platform}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install mmagic dependencies
run: |
python -m pip install git+https://github.com/open-mmlab/mmengine.git@main
python -m pip install -U openmim
mim install 'mmcv >= 2.0.0'
python -m pip install -r requirements/tests.txt
- name: Build and install
run: |
python -m pip install -e .
- name: Run unittests and generate coverage report
run: |
pytest tests/
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
================================================
FILE: .github/workflows/publish-to-pypi.yml
================================================
name: deploy
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-n-publish:
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Build MMagic
run: |
pip install torch==1.8.1+cpu torchvision==0.9.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
run: |
pip install twine
twine upload dist/* -u __token__ -p ${{ secrets.pypi_password }}
================================================
FILE: .github/workflows/test_mim.yml
================================================
name: test-mim
on:
push:
paths:
- 'model-index.yml'
- 'configs/**'
pull_request:
paths:
- 'model-index.yml'
- 'configs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_cpu:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.7]
torch: [1.8.0]
include:
- torch: 1.8.0
torch_version: torch1.8
torchvision: 0.9.0
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade && pip install wheel
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install openmim
run: pip install openmim
- name: Build and install
run: rm -rf .eggs && mim install -e .
- name: test commands of mim
run: mim search mmagic
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
**/*.pyc
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
tests/data/out
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/en/_build/
docs/en/_tmp/
docs/zh_cn/_build/
docs/zh_cn/_tmp/
requirements/src/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
# custom
.vscode
.idea
*.pkl
*.pkl.json
*.log.json
work_dirs/
work_dirs
configs_ceph/
configs_ceph_*/
/data/
/data
mmagic/.mim
demo/*.png
*.csv
out/*.png
tests/data/out
resources/
# Pytorch
*.pth
# onnx and tensorrt
*.onnx
*.trt
# local history
.history/**
# Pytorch Server
*.mar
# MacOS
.DS_Store
# Slurm
batchscript-*
*.out
*.png
*.jpg
*.zip
work_dir
work_dir/
================================================
FILE: .owners.yml
================================================
# assign issues to owners automatically
assign:
issues: enabled # or disabled
pull_requests: enabled # or disabled
# assign strategy, both issues and pull requests follow the same strategy
strategy:
# random
# round-robin
daily-shift-based
scedule:
'*/1 * * * *'
# assignees
assignees:
- zengyh1900
- LeoXing1996
- liuwenran
- LeoXing1996
- liuwenran
- zengyh1900
- zengyh1900
================================================
FILE: .pre-commit-config.yaml
================================================
exclude: ^tests/data/
repos:
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/zhouzaida/isort
rev: 5.12.1
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.30.0
hooks:
- id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: trailing-whitespace
exclude: ^dicts/
- id: check-yaml
exclude: ^projects/animated_drawings/configs/retarget/
- id: end-of-file-fixer
exclude: ^dicts/
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- id: check-merge-conflict
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: ["--skip", "*.ipynb", "-L", "formating,theis,te,nd,thre,Gool,gool,lod,patten,confectionary"]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.9
hooks:
- id: mdformat
args: ["--number", "--table-width", "200"]
# language_version: python3.7
additional_dependencies:
- mdformat-openmmlab
- mdformat_frontmatter
- linkify-it-py
- repo: local
hooks:
- id: update-model-index
name: update-model-index
description: Collect model information and update model-index.yml
entry: .dev_scripts/update_model_index.py
additional_dependencies: [mmengine, modelindex, tqdm, rich]
language: python
files: ^configs/.*\.md$
require_serial: true
- repo: https://github.com/myint/docformatter
rev: v1.3.1
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.4.0 # Use the ref you want to point at
hooks:
- id: check-algo-readme
- id: check-copyright
args: ["demo", "mmagic", "tests", "tools"]
- id: remove-improper-eol-in-cn-docs
- repo: local
hooks:
- id: update-model-zoo
name: update-model-zoo
description: update model-zoo.yml
entry: docs/en/.dev_scripts/update_model_zoo.py
additional_dependencies: [mmengine, modelindex, tqdm, rich]
language: python
files: ^configs/.*\.md$
require_serial: true
================================================
FILE: .pylintrc
================================================
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS,configs
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
jobs=1
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
limit-inference-results=100
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
no-member,
invalid-name,
too-many-branches,
wrong-import-order,
too-many-arguments,
missing-function-docstring,
missing-module-docstring,
too-many-locals,
too-few-public-methods,
abstract-method,
broad-except,
too-many-nested-blocks,
too-many-instance-attributes,
missing-class-docstring,
duplicate-code,
not-callable,
protected-access,
dangerous-default-value,
no-name-in-module,
logging-fstring-interpolation,
super-init-not-called,
redefined-builtin,
attribute-defined-outside-init,
arguments-differ,
cyclic-import,
bad-super-call,
too-many-statements
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
[REPORTS]
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
# which contain the number of messages in each category, as well as 'statement'
# which is the total number of statements analyzed. This score is used by the
# global evaluation report (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details.
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages.
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
# it will be considered as an explicit return statement and no message will be
# printed.
never-returning-functions=sys.exit
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
ignore-none=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
# List of decorators that change the signature of a decorated function.
signature-mutators=
[SPELLING]
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4
# Spelling dictionary name. Available dictionaries: none. To make it work,
# install the python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains the private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to the private dictionary (see the
# --spelling-private-dict-file option) instead of raising a message.
spelling-store-unknown-words=no
[LOGGING]
# The type of string formatting that logging methods do. `old` means using %
# formatting, `new` is for `{}` formatting.
logging-format-style=old
# Logging modules to check that the string format arguments are in logging
# function parameter format.
logging-modules=logging
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid defining new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore.
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1000
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[STRING]
# This flag controls whether inconsistent-quotes generates a warning when the
# character used as a quote delimiter is used inconsistently within a module.
check-quote-consistency=no
# This flag controls whether the implicit-str-concat should generate a warning
# on implicit string concatenation in sequences defined over several lines.
check-str-concat-over-line-jumps=no
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=no
# Minimum lines number of a similarity.
min-similarity-lines=4
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,
XXX,
TODO
# Regular expression of note tags to take in consideration.
#notes-rgx=
[BASIC]
# Naming style matching correct argument names.
argument-naming-style=snake_case
# Regular expression matching correct argument names. Overrides argument-
# naming-style.
#argument-rgx=
# Naming style matching correct attribute names.
attr-naming-style=snake_case
# Regular expression matching correct attribute names. Overrides attr-naming-
# style.
#attr-rgx=
# Bad variable names which should always be refused, separated by a comma.
bad-names=foo,
bar,
baz,
toto,
tutu,
tata
# Bad variable names regexes, separated by a comma. If names match any regex,
# they will always be refused
bad-names-rgxs=
# Naming style matching correct class attribute names.
class-attribute-naming-style=any
# Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style.
#class-attribute-rgx=
# Naming style matching correct class names.
class-naming-style=PascalCase
# Regular expression matching correct class names. Overrides class-naming-
# style.
#class-rgx=
# Naming style matching correct constant names.
const-naming-style=UPPER_CASE
# Regular expression matching correct constant names. Overrides const-naming-
# style.
#const-rgx=
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming style matching correct function names.
function-naming-style=snake_case
# Regular expression matching correct function names. Overrides function-
# naming-style.
#function-rgx=
# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
ex,
Run,
_,
x,
y,
w,
h,
a,
b
# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
good-names-rgxs=
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
# Naming style matching correct inline iteration names.
inlinevar-naming-style=any
# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style.
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=snake_case
# Regular expression matching correct method names. Overrides method-naming-
# style.
#method-rgx=
# Naming style matching correct module names.
module-naming-style=snake_case
# Regular expression matching correct module names. Overrides module-naming-
# style.
#module-rgx=
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty
# Naming style matching correct variable names.
variable-naming-style=snake_case
# Regular expression matching correct variable names. Overrides variable-
# naming-style.
#variable-rgx=
[DESIGN]
# Maximum number of arguments for function / method.
max-args=5
# Maximum number of attributes for a class (see R0902).
max-attributes=7
# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5
# Maximum number of branch for function / method body.
max-branches=12
# Maximum number of locals for function / method body.
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body.
max-returns=6
# Maximum number of statements in function / method body.
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
[IMPORTS]
# List of modules that can be imported at any level, not just the top level
# one.
allow-any-import-level=
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma.
deprecated-modules=optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled).
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled).
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled).
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
# Couples of modules and preferred modules, separated by a comma.
preferred-modules=
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
setUp,
__post_init__
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,
_fields,
_replace,
_source,
_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
================================================
FILE: .readthedocs.yml
================================================
version: 2
formats: [pdf, epub]
build:
os: ubuntu-22.04
tools:
python: "3.7"
python:
install:
- requirements: requirements/docs.txt
- requirements: requirements/readthedocs.txt
================================================
FILE: CITATION.cff
================================================
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: MMagic
given-names: Contributors
title: "MMagic: OpenMMLab Multimodal Advanced, Generative, and Intelligent Creation Toolbox"
version: 1.0.0
date-released: 2023-04-25
url: "https://github.com/open-mmlab/mmagic"
license: Apache-2.0
================================================
FILE: LICENSE
================================================
Copyright (c) OpenMMLab. All rights reserved.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 MMagic Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright 2020 MMEditing Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: MANIFEST.in
================================================
include requirements/*.txt
include mmagic/.mim/VERSION
include mmagic/.mim/model-index.yml
include mmagic/evaluation/metrics/niqe_pris_params.npz
recursive-include mmagic/.mim/configs *.py *.yml
recursive-include mmagic/.mim/tools *.sh *.py
recursive-include mmagic/.mim/demo *.py
================================================
FILE: README.md
================================================
<div id="top" align="center">
<img src="docs/en/_static/image/mmagic-logo.png" width="500px"/>
<div> </div>
<div align="center">
<font size="10"><b>M</b>ultimodal <b>A</b>dvanced, <b>G</b>enerative, and <b>I</b>ntelligent <b>C</b>reation (MMagic [em'mædʒɪk])</font>
</div>
<div> </div>
<div align="center">
<b><font size="5">OpenMMLab website</font></b>
<sup>
<a href="https://openmmlab.com">
<i><font size="4">HOT</font></i>
</a>
</sup>
<b><font size="5">OpenMMLab platform</font></b>
<sup>
<a href="https://platform.openmmlab.com">
<i><font size="4">TRY IT OUT</font></i>
</a>
</sup>
</div>
<div> </div>
[](https://pypi.org/project/mmagic/)
[](https://mmagic.readthedocs.io/en/latest/)
[](https://github.com/open-mmlab/mmagic/actions)
[](https://codecov.io/gh/open-mmlab/mmagic)
[](https://github.com/open-mmlab/mmagic/blob/main/LICENSE)
[](https://github.com/open-mmlab/mmagic/issues)
[](https://github.com/open-mmlab/mmagic/issues)
[](https://openxlab.org.cn/apps/detail/%E6%94%BF%E6%9D%B0/OpenMMLab-Projects)
[📘Documentation](https://mmagic.readthedocs.io/en/latest/) |
[🛠️Installation](https://mmagic.readthedocs.io/en/latest/get_started/install.html) |
[📊Model Zoo](https://mmagic.readthedocs.io/en/latest/model_zoo/overview.html) |
[🆕Update News](https://mmagic.readthedocs.io/en/latest/changelog.html) |
[🚀Ongoing Projects](https://github.com/open-mmlab/mmagic/projects) |
[🤔Reporting Issues](https://github.com/open-mmlab/mmagic/issues)
English | [简体中文](README_zh-CN.md)
</div>
<div align="center">
<a href="https://openmmlab.medium.com/" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218352562-cdded397-b0f3-4ca1-b8dd-a60df8dca75b.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://discord.gg/raweFPmdzG" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218347213-c080267f-cbb6-443e-8532-8e1ed9a58ea9.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://twitter.com/OpenMMLab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346637-d30c8a0f-3eba-4699-8131-512fb06d46db.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://www.youtube.com/openmmlab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346691-ceb2116a-465a-40af-8424-9f30d2348ca9.png" width="3%" alt="" /></a>
</div>
## 🚀 What's New <a><img width="35" height="20" src="https://user-images.githubusercontent.com/12782558/212848161-5e783dd6-11e8-4fe0-bbba-39ffb77730be.png"></a>
### New release [**MMagic v1.2.0**](https://github.com/open-mmlab/mmagic/releases/tag/v1.2.0) \[18/12/2023\]:
- An advanced and powerful inpainting algorithm named PowerPaint is released in our repository. [Click to View](https://github.com/open-mmlab/mmagic/tree/main/projects/powerpaint)
We are excited to announce the release of MMagic v1.0.0 that inherits from [MMEditing](https://github.com/open-mmlab/mmediting) and [MMGeneration](https://github.com/open-mmlab/mmgeneration).
After iterative updates with OpenMMLab 2.0 framework and merged with MMGeneration, MMEditing has become a powerful tool that supports low-level algorithms based on both GAN and CNN. Today, MMEditing embraces Generative AI and transforms into a more advanced and comprehensive AIGC toolkit: **MMagic** (**M**ultimodal **A**dvanced, **G**enerative, and **I**ntelligent **C**reation). MMagic will provide more agile and flexible experimental support for researchers and AIGC enthusiasts, and help you on your AIGC exploration journey.
We highlight the following new features.
**1. New Models**
We support 11 new models in 4 new tasks.
- Text2Image / Diffusion
- ControlNet
- DreamBooth
- Stable Diffusion
- Disco Diffusion
- GLIDE
- Guided Diffusion
- 3D-aware Generation
- EG3D
- Image Restoration
- NAFNet
- Restormer
- SwinIR
- Image Colorization
- InstColorization
**2. Magic Diffusion Model**
For the Diffusion Model, we provide the following "magic" :
- Support image generation based on Stable Diffusion and Disco Diffusion.
- Support Finetune methods such as Dreambooth and DreamBooth LoRA.
- Support controllability in text-to-image generation using ControlNet.
- Support acceleration and optimization strategies based on xFormers to improve training and inference efficiency.
- Support video generation based on MultiFrame Render.
- Support calling basic models and sampling strategies through DiffuserWrapper.
**3. Upgraded Framework**
By using MMEngine and MMCV of OpenMMLab 2.0 framework, MMagic has upgraded in the following new features:
- Refactor DataSample to support the combination and splitting of batch dimensions.
- Refactor DataPreprocessor and unify the data format for various tasks during training and inference.
- Refactor MultiValLoop and MultiTestLoop, supporting the evaluation of both generation-type metrics (e.g. FID) and reconstruction-type metrics (e.g. SSIM), and supporting the evaluation of multiple datasets at once.
- Support visualization on local files or using tensorboard and wandb.
- Support for 33+ algorithms accelerated by Pytorch 2.0.
**MMagic** has supported all the tasks, models, metrics, and losses in [MMEditing](https://github.com/open-mmlab/mmediting) and [MMGeneration](https://github.com/open-mmlab/mmgeneration) and unifies interfaces of all components based on [MMEngine](https://github.com/open-mmlab/mmengine) 😍.
Please refer to [changelog.md](docs/en/changelog.md) for details and release history.
Please refer to [migration documents](docs/en/migration/overview.md) to migrate from [old version](https://github.com/open-mmlab/mmagic/tree/0.x) MMEditing 0.x to new version MMagic 1.x .
<div id="table" align="center"></div>
## 📄 Table of Contents
- [📖 Introduction](#-introduction)
- [🙌 Contributing](#-contributing)
- [🛠️ Installation](#️-installation)
- [📊 Model Zoo](#-model-zoo)
- [🤝 Acknowledgement](#-acknowledgement)
- [🖊️ Citation](#️-citation)
- [🎫 License](#-license)
- [🏗️ ️OpenMMLab Family](#️-️openmmlab-family)
## 📖 Introduction
MMagic (**M**ultimodal **A**dvanced, **G**enerative, and **I**ntelligent **C**reation) is an advanced and comprehensive AIGC toolkit that inherits from [MMEditing](https://github.com/open-mmlab/mmediting) and [MMGeneration](https://github.com/open-mmlab/mmgeneration). It is an open-source image and video editing&generating toolbox based on PyTorch. It is a part of the [OpenMMLab](https://openmmlab.com/) project.
Currently, MMagic support multiple image and video generation/editing tasks.
https://user-images.githubusercontent.com/49083766/233564593-7d3d48ed-e843-4432-b610-35e3d257765c.mp4
### ✨ Major features
- **State of the Art Models**
MMagic provides state-of-the-art generative models to process, edit and synthesize images and videos.
- **Powerful and Popular Applications**
MMagic supports popular and contemporary image restoration, text-to-image, 3D-aware generation, inpainting, matting, super-resolution and generation applications. Specifically, MMagic supports fine-tuning for stable diffusion and many exciting diffusion's application such as ControlNet Animation with SAM. MMagic also supports GAN interpolation, GAN projection, GAN manipulations and many other popular GAN’s applications. It’s time to begin your AIGC exploration journey!
- **Efficient Framework**
By using MMEngine and MMCV of OpenMMLab 2.0 framework, MMagic decompose the editing framework into different modules and one can easily construct a customized editor framework by combining different modules. We can define the training process just like playing with Legos and provide rich components and strategies. In MMagic, you can complete controls on the training process with different levels of APIs. With the support of [MMSeparateDistributedDataParallel](https://github.com/open-mmlab/mmengine/blob/main/mmengine/model/wrappers/seperate_distributed.py), distributed training for dynamic architectures can be easily implemented.
### ✨ Best Practice
- The best practice on our main branch works with **Python 3.9+** and **PyTorch 2.0+**.
<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>
## 🙌 Contributing
More and more community contributors are joining us to make our repo better. Some recent projects are contributed by the community including:
- [SDXL](configs/stable_diffusion_xl/README.md) is contributed by @okotaku.
- [AnimateDiff](configs/animatediff/README.md) is contributed by @ElliotQi.
- [ViCo](configs/vico/README.md) is contributed by @FerryHuang.
- [DragGan](configs/draggan/README.md) is contributed by @qsun1.
- [FastComposer](configs/fastcomposer/README.md) is contributed by @xiaomile.
[Projects](projects/README.md) is opened to make it easier for everyone to add projects to MMagic.
We appreciate all contributions to improve MMagic. Please refer to [CONTRIBUTING.md](https://github.com/open-mmlab/mmcv/blob/main/CONTRIBUTING.md) in MMCV and [CONTRIBUTING.md](https://github.com/open-mmlab/mmengine/blob/main/CONTRIBUTING.md) in MMEngine for more details about the contributing guideline.
<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>
## 🛠️ Installation
MMagic depends on [PyTorch](https://pytorch.org/), [MMEngine](https://github.com/open-mmlab/mmengine) and [MMCV](https://github.com/open-mmlab/mmcv).
Below are quick steps for installation.
**Step 1.**
Install PyTorch following [official instructions](https://pytorch.org/get-started/locally/).
**Step 2.**
Install MMCV, MMEngine and MMagic with [MIM](https://github.com/open-mmlab/mim).
```shell
pip3 install openmim
mim install mmcv>=2.0.0
mim install mmengine
mim install mmagic
```
**Step 3.**
Verify MMagic has been successfully installed.
```shell
cd ~
python -c "import mmagic; print(mmagic.__version__)"
# Example output: 1.0.0
```
**Getting Started**
After installing MMagic successfully, now you are able to play with MMagic! To generate an image from text, you only need several lines of codes by MMagic!
```python
from mmagic.apis import MMagicInferencer
sd_inferencer = MMagicInferencer(model_name='stable_diffusion')
text_prompts = 'A panda is having dinner at KFC'
result_out_dir = 'output/sd_res.png'
sd_inferencer.infer(text=text_prompts, result_out_dir=result_out_dir)
```
Please see [quick run](docs/en/get_started/quick_run.md) and [inference](docs/en/user_guides/inference.md) for the basic usage of MMagic.
**Install MMagic from source**
You can also experiment on the latest developed version rather than the stable release by installing MMagic from source with the following commands:
```shell
git clone https://github.com/open-mmlab/mmagic.git
cd mmagic
pip3 install -e .
```
Please refer to [installation](docs/en/get_started/install.md) for more detailed instruction.
<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>
## 📊 Model Zoo
<div align="center">
<b>Supported algorithms</b>
</div>
<table align="center">
<tbody>
<tr align="center" valign="bottom">
<td>
<b>Conditional GANs</b>
</td>
<td>
<b>Unconditional GANs</b>
</td>
<td>
<b>Image Restoration</b>
</td>
<td>
<b>Image Super-Resolution</b>
</td>
</tr>
<tr valign="top">
<td>
<ul>
<li><a href="configs/sngan_proj/README.md">SNGAN/Projection GAN (ICLR'2018)</a></li>
<li><a href="configs/sagan/README.md">SAGAN (ICML'2019)</a></li>
<li><a href="configs/biggan/README.md">BIGGAN/BIGGAN-DEEP (ICLR'2018)</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="configs/dcgan/README.md">DCGAN (ICLR'2016)</a></li>
<li><a href="configs/wgan-gp/README.md">WGAN-GP (NeurIPS'2017)</a></li>
<li><
gitextract_ofufjmnn/
├── .circleci/
│ ├── config.yml
│ ├── docker/
│ │ └── Dockerfile
│ └── test.yml
├── .dele.yml
├── .dev_scripts/
│ ├── README.md
│ ├── create_ceph_configs.py
│ ├── doc_link_checker.py
│ ├── download_models.py
│ ├── inference_benchmark.sh
│ ├── job_watcher.py
│ ├── metric_mapping.py
│ ├── task_mapping.py
│ ├── test_benchmark.py
│ ├── test_benchmark.yml
│ ├── train_benchmark.py
│ ├── train_benchmark.yml
│ ├── update_config_readme.py
│ ├── update_model_index.py
│ ├── update_ut.py
│ └── utils/
│ ├── __init__.py
│ ├── job_util.py
│ └── modelindex.py
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE/
│ │ ├── 1-bug-report.yml
│ │ ├── 2-feature-request.yml
│ │ ├── 3-new-model.yml
│ │ ├── 4-documentation.yml
│ │ └── config.yml
│ ├── pull_request_template.md
│ └── workflows/
│ ├── lint.yml
│ ├── merge_stage_test.yml
│ ├── pr_stage_test.yml
│ ├── publish-to-pypi.yml
│ └── test_mim.yml
├── .gitignore
├── .owners.yml
├── .pre-commit-config.yaml
├── .pylintrc
├── .readthedocs.yml
├── CITATION.cff
├── LICENSE
├── MANIFEST.in
├── README.md
├── README_zh-CN.md
├── configs/
│ ├── _base_/
│ │ ├── datasets/
│ │ │ ├── basicvsr_test_config.py
│ │ │ ├── celeba.py
│ │ │ ├── cifar10_noaug.py
│ │ │ ├── cifar10_nopad.py
│ │ │ ├── comp1k.py
│ │ │ ├── deblurring-defocus_test_config.py
│ │ │ ├── deblurring-motion_test_config.py
│ │ │ ├── decompression_test_config.py
│ │ │ ├── denoising-gaussian_color_test_config.py
│ │ │ ├── denoising-gaussian_gray_test_config.py
│ │ │ ├── denoising-real_test_config.py
│ │ │ ├── deraining_test_config.py
│ │ │ ├── ffhq_flip.py
│ │ │ ├── grow_scale_imgs_ffhq_styleganv1.py
│ │ │ ├── imagenet_128.py
│ │ │ ├── imagenet_256.py
│ │ │ ├── imagenet_512.py
│ │ │ ├── imagenet_64.py
│ │ │ ├── imagenet_noaug_128.py
│ │ │ ├── liif_test_config.py
│ │ │ ├── lsun_stylegan.py
│ │ │ ├── paired_imgs_256x256_crop.py
│ │ │ ├── places.py
│ │ │ ├── sisr_x2_test_config.py
│ │ │ ├── sisr_x3_test_config.py
│ │ │ ├── sisr_x4_test_config.py
│ │ │ ├── tdan_test_config.py
│ │ │ ├── unconditional_imgs_128x128.py
│ │ │ ├── unconditional_imgs_64x64.py
│ │ │ ├── unconditional_imgs_flip_512x512.py
│ │ │ ├── unconditional_imgs_flip_lanczos_resize_256x256.py
│ │ │ └── unpaired_imgs_256x256.py
│ │ ├── default_runtime.py
│ │ ├── gen_default_runtime.py
│ │ ├── inpaint_default_runtime.py
│ │ ├── matting_default_runtime.py
│ │ ├── models/
│ │ │ ├── base_cyclegan.py
│ │ │ ├── base_deepfillv1.py
│ │ │ ├── base_deepfillv2.py
│ │ │ ├── base_edvr.py
│ │ │ ├── base_gl.py
│ │ │ ├── base_glean.py
│ │ │ ├── base_liif.py
│ │ │ ├── base_pconv.py
│ │ │ ├── base_pix2pix.py
│ │ │ ├── base_styleganv1.py
│ │ │ ├── base_styleganv2.py
│ │ │ ├── base_styleganv3.py
│ │ │ ├── base_tof.py
│ │ │ ├── biggan/
│ │ │ │ └── base_biggan_128x128.py
│ │ │ ├── dcgan/
│ │ │ │ ├── base_dcgan_128x128.py
│ │ │ │ └── base_dcgan_64x64.py
│ │ │ ├── sagan/
│ │ │ │ ├── base_sagan_128x128.py
│ │ │ │ └── base_sagan_32x32.py
│ │ │ └── sngan_proj/
│ │ │ ├── base_sngan_proj_128x128.py
│ │ │ └── base_sngan_proj_32x32.py
│ │ └── schedules/
│ │ └── .gitkeep
│ ├── animatediff/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── animatediff_Lyriel.py
│ │ ├── animatediff_MajicMix.py
│ │ ├── animatediff_RcnzCartoon.py
│ │ ├── animatediff_RealisticVision.py
│ │ ├── animatediff_RealisticVision_v2.py
│ │ ├── animatediff_ToonYou.py
│ │ └── metafile.yml
│ ├── aot_gan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── aot-gan_smpgan_4xb4_places-512x512.py
│ │ └── metafile.yml
│ ├── basicvsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── basicvsr_2xb4_reds4.py
│ │ ├── basicvsr_2xb4_vimeo90k-bd.py
│ │ ├── basicvsr_2xb4_vimeo90k-bi.py
│ │ └── metafile.yml
│ ├── basicvsr_pp/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── basicvsr-pp_c128n25_600k_ntire-decompress-track1.py
│ │ ├── basicvsr-pp_c128n25_600k_ntire-decompress-track2.py
│ │ ├── basicvsr-pp_c128n25_600k_ntire-decompress-track3.py
│ │ ├── basicvsr-pp_c128n25_600k_ntire-vsr.py
│ │ ├── basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bd.py
│ │ ├── basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bi.py
│ │ ├── basicvsr-pp_c64n7_8xb1-600k_reds4.py
│ │ └── metafile.yml
│ ├── biggan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── biggan-deep_cvt-hugging-face-rgb_imagenet1k-128x128.py
│ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-256x256.py
│ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-512x512.py
│ │ ├── biggan_2xb25-500kiters_cifar10-32x32.py
│ │ ├── biggan_ajbrock-sn_8xb32-1500kiters_imagenet1k-128x128.py
│ │ ├── biggan_cvt-BigGAN-PyTorch-rgb_imagenet1k-128x128.py
│ │ └── metafile.yml
│ ├── cain/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── cain_g1b32_1xb5_vimeo90k-triplet.py
│ │ └── metafile.yml
│ ├── controlnet/
│ │ ├── README.md
│ │ ├── controlnet-1xb1-fill50k.py
│ │ ├── controlnet-canny.py
│ │ ├── controlnet-pose.py
│ │ ├── controlnet-seg.py
│ │ └── metafile.yml
│ ├── controlnet_animation/
│ │ ├── README.md
│ │ ├── anythingv3_config.py
│ │ └── metafile.yml
│ ├── cyclegan/
│ │ ├── README.md
│ │ ├── cyclegan_lsgan-id0-resnet-in_1xb1-250kiters_summer2winter.py
│ │ ├── cyclegan_lsgan-id0-resnet-in_1xb1-270kiters_horse2zebra.py
│ │ ├── cyclegan_lsgan-id0-resnet-in_1xb1-80kiters_facades.py
│ │ ├── cyclegan_lsgan-resnet-in_1xb1-250kiters_summer2winter.py
│ │ ├── cyclegan_lsgan-resnet-in_1xb1-270kiters_horse2zebra.py
│ │ ├── cyclegan_lsgan-resnet-in_1xb1-80kiters_facades.py
│ │ └── metafile.yml
│ ├── dcgan/
│ │ ├── README.md
│ │ ├── dcgan_1xb128-300kiters_celeba-cropped-64.py
│ │ ├── dcgan_1xb128-5epoches_lsun-bedroom-64x64.py
│ │ ├── dcgan_Glr4e-4_Dlr1e-4_1xb128-5kiters_mnist-64x64.py
│ │ └── metafile.yml
│ ├── deblurganv2/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── deblurganv2_fpn-inception_1xb1_gopro.py
│ │ ├── deblurganv2_fpn-mobilenet_1xb1_gopro.py
│ │ └── metafile.yml
│ ├── deepfillv1/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── deepfillv1_4xb4_celeba-256x256.py
│ │ ├── deepfillv1_8xb2_places-256x256.py
│ │ └── metafile.yml
│ ├── deepfillv2/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── deepfillv2_8xb2_celeba-256x256.py
│ │ ├── deepfillv2_8xb2_places-256x256.py
│ │ └── metafile.yml
│ ├── dic/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── dic_gan-x8c48b6_4xb2-500k_celeba-hq.py
│ │ ├── dic_x8c48b6_4xb2-150k_celeba-hq.py
│ │ └── metafile.yml
│ ├── diffusers_pipeline/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ └── sd_xl_pipeline.py
│ ├── dim/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── dim_stage1-v16_1xb1-1000k_comp1k.py
│ │ ├── dim_stage1-v16_1xb1-1000k_comp1k_online-merge.py
│ │ ├── dim_stage2-v16-pln_1xb1-1000k_comp1k.py
│ │ ├── dim_stage3-v16-pln_1xb1-1000k_comp1k.py
│ │ └── metafile.yml
│ ├── disco_diffusion/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── disco-diffusion_adm-u-finetuned_imagenet-256x256.py
│ │ ├── disco-diffusion_adm-u-finetuned_imagenet-512x512.py
│ │ ├── disco-diffusion_portrait-generator-v001.py
│ │ ├── metafile.yml
│ │ └── tutorials.ipynb
│ ├── draggan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── stylegan2_1024x1024.py
│ │ ├── stylegan2_256x256.py
│ │ └── stylegan2_512x512.py
│ ├── dreambooth/
│ │ ├── README.md
│ │ ├── dreambooth-finetune_text_encoder.py
│ │ ├── dreambooth-lora-prior_pre.py
│ │ ├── dreambooth-lora.py
│ │ ├── dreambooth-prior_pre.py
│ │ ├── dreambooth.py
│ │ └── metafile.yml
│ ├── edsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── edsr_x2c64b16_1xb16-300k_div2k.py
│ │ ├── edsr_x3c64b16_1xb16-300k_div2k.py
│ │ ├── edsr_x4c64b16_1xb16-300k_div2k.py
│ │ └── metafile.yml
│ ├── edvr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── edvrl_c128b40_8xb8-lr2e-4-600k_reds4.py
│ │ ├── edvrl_wotsa-c128b40_8xb8-lr2e-4-600k_reds4.py
│ │ ├── edvrm_8xb4-600k_reds.py
│ │ ├── edvrm_wotsa_8xb4-600k_reds.py
│ │ └── metafile.yml
│ ├── eg3d/
│ │ ├── README.md
│ │ ├── eg3d_cvt-official-rgb_afhq-512x512.py
│ │ ├── eg3d_cvt-official-rgb_ffhq-512x512.py
│ │ ├── eg3d_cvt-official-rgb_shapenet-128x128.py
│ │ └── metafile.yml
│ ├── esrgan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── esrgan_psnr-x4c64b23g32_1xb16-1000k_div2k.py
│ │ ├── esrgan_x4c64b23g32_1xb16-400k_div2k.py
│ │ └── metafile.yml
│ ├── fastcomposer/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── fastcomposer_8xb16_FFHQ.py
│ │ └── metafile.yml
│ ├── flavr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── flavr_in4out1_8xb4_vimeo90k-septuplet.py
│ │ └── metafile.yml
│ ├── gca/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── baseline_r34_4xb10-200k_comp1k.py
│ │ ├── baseline_r34_4xb10-dimaug-200k_comp1k.py
│ │ ├── gca_r34_4xb10-200k_comp1k.py
│ │ ├── gca_r34_4xb10-dimaug-200k_comp1k.py
│ │ └── metafile.yml
│ ├── ggan/
│ │ ├── README.md
│ │ ├── ggan_dcgan-archi_lr1e-3-1xb128-12Mimgs_celeba-cropped-64x64.py
│ │ ├── ggan_dcgan-archi_lr1e-4-1xb64-10Mimgs_celeba-cropped-128x128.py
│ │ ├── ggan_lsgan-archi_lr1e-4-1xb128-20Mimgs_lsun-bedroom-64x64.py
│ │ └── metafile.yml
│ ├── glean/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── glean_in128out1024-fp16_4xb2-300k_ffhq-celeba-hq.py
│ │ ├── glean_in128out1024_4xb2-300k_ffhq-celeba-hq.py
│ │ ├── glean_x16-fp16_2xb8_ffhq.py
│ │ ├── glean_x16_2xb8_cat.py
│ │ ├── glean_x16_2xb8_ffhq.py
│ │ ├── glean_x8-fp16_2xb8_cat.py
│ │ ├── glean_x8_2xb8_cat.py
│ │ └── metafile.yml
│ ├── global_local/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── gl_8xb12_celeba-256x256.py
│ │ ├── gl_8xb12_places-256x256.py
│ │ └── metafile.yml
│ ├── guided_diffusion/
│ │ ├── README.md
│ │ ├── adm-g_ddim25_8xb32_imagenet-256x256.py
│ │ ├── adm-g_ddim25_8xb32_imagenet-512x512.py
│ │ ├── adm-g_ddim25_8xb32_imagenet-64x64.py
│ │ ├── adm_ddim250_8xb32_imagenet-256x256.py
│ │ ├── adm_ddim250_8xb32_imagenet-512x512.py
│ │ ├── adm_ddim250_8xb32_imagenet-64x64.py
│ │ └── metafile.yml
│ ├── iconvsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── iconvsr_2xb4_reds4.py
│ │ ├── iconvsr_2xb4_vimeo90k-bd.py
│ │ ├── iconvsr_2xb4_vimeo90k-bi.py
│ │ └── metafile.yml
│ ├── indexnet/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── indexnet_mobv2-dimaug_1xb16-78k_comp1k.py
│ │ ├── indexnet_mobv2_1xb16-78k_comp1k.py
│ │ └── metafile.yml
│ ├── inst_colorization/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── inst-colorizatioon_full_official_cocostuff-256x256.py
│ │ └── metafile.yml
│ ├── liif/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── liif-edsr-norm_c64b16_1xb16-1000k_div2k.py
│ │ ├── liif-rdn-norm_c64b16_1xb16-1000k_div2k.py
│ │ └── metafile.yml
│ ├── lsgan/
│ │ ├── README.md
│ │ ├── lsgan_dcgan-archi_lr1e-3-1xb128-12Mimgs_celeba-cropped-64x64.py
│ │ ├── lsgan_dcgan-archi_lr1e-4-1xb128-12Mimgs_lsun-bedroom-64x64.py
│ │ ├── lsgan_dcgan-archi_lr1e-4-1xb64-10Mimgs_celeba-cropped-128x128.py
│ │ ├── lsgan_lsgan-archi_lr1e-4-1xb64-10Mimgs_lsun-bedroom-128x128.py
│ │ └── metafile.yml
│ ├── nafnet/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── nafnet_c64eb11128mb1db1111_8xb8-lr1e-3-400k_gopro.py
│ │ └── nafnet_c64eb2248mb12db2222_8xb8-lr1e-3-400k_sidd.py
│ ├── partial_conv/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── pconv_stage1_8xb12_places-256x256.py
│ │ ├── pconv_stage1_8xb1_celeba-256x256.py
│ │ ├── pconv_stage2_4xb2_celeba-256x256.py
│ │ └── pconv_stage2_4xb2_places-256x256.py
│ ├── pggan/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── pggan_8xb4-12Mimg_celeba-hq-1024x1024.py
│ │ ├── pggan_8xb4-12Mimgs_celeba-cropped-128x128.py
│ │ └── pggan_8xb4-12Mimgs_lsun-bedroom-128x128.py
│ ├── pix2pix/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── pix2pix_vanilla-unet-bn_1xb1-220kiters_aerial2maps.py
│ │ ├── pix2pix_vanilla-unet-bn_1xb1-220kiters_maps2aerial.py
│ │ ├── pix2pix_vanilla-unet-bn_1xb1-80kiters_facades.py
│ │ └── pix2pix_vanilla-unet-bn_wo-jitter-flip-1xb4-190kiters_edges2shoes.py
│ ├── positional_encoding_in_gans/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── mspie-stylegan2-config-c_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-d_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-e_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-f_c1_8xb2-1600kiters_ffhq-256-1024.py
│ │ ├── mspie-stylegan2-config-f_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-f_c2_8xb3-1100kiters_ffhq-256-896.py
│ │ ├── mspie-stylegan2-config-g_c1_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-h_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-i_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-j_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── mspie-stylegan2-config-k_c2_8xb3-1100kiters_ffhq-256-512.py
│ │ ├── singan-csg_bohemian.py
│ │ ├── singan-csg_fish.py
│ │ ├── singan_interp-pad_balloons.py
│ │ ├── singan_interp-pad_disc-nobn_balloons.py
│ │ ├── singan_interp-pad_disc-nobn_fish.py
│ │ ├── singan_spe-dim4_bohemian.py
│ │ ├── singan_spe-dim4_fish.py
│ │ ├── singan_spe-dim8_bohemian.py
│ │ ├── stylegan2_c2_8xb3-1100kiters_ffhq-256x256.py
│ │ └── stylegan2_c2_8xb3-1100kiters_ffhq-512x512.py
│ ├── rdn/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── rdn_x2c64b16_1xb16-1000k_div2k.py
│ │ ├── rdn_x3c64b16_1xb16-1000k_div2k.py
│ │ └── rdn_x4c64b16_1xb16-1000k_div2k.py
│ ├── real_basicvsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── realbasicvsr_c64b20-1x30x8_8xb1-lr5e-5-150k_reds.py
│ │ └── realbasicvsr_wogan-c64b20-2x30x8_8xb2-lr1e-4-300k_reds.py
│ ├── real_esrgan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── realesrgan_c64b23g32_4xb12-lr1e-4-400k_df2k-ost.py
│ │ └── realesrnet_c64b23g32_4xb12-lr2e-4-1000k_df2k-ost.py
│ ├── restormer/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── restormer_official_dfwb-color-sigma15.py
│ │ ├── restormer_official_dfwb-color-sigma25.py
│ │ ├── restormer_official_dfwb-color-sigma50.py
│ │ ├── restormer_official_dfwb-gray-sigma15.py
│ │ ├── restormer_official_dfwb-gray-sigma25.py
│ │ ├── restormer_official_dfwb-gray-sigma50.py
│ │ ├── restormer_official_dpdd-dual.py
│ │ ├── restormer_official_dpdd-single.py
│ │ ├── restormer_official_gopro.py
│ │ ├── restormer_official_rain13k.py
│ │ └── restormer_official_sidd.py
│ ├── sagan/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── sagan_128_cvt_studioGAN.py
│ │ ├── sagan_cvt-studioGAN_cifar10-32x32.py
│ │ ├── sagan_wReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ │ ├── sagan_woReLUinplace-Glr1e-4_Dlr4e-4_noaug-ndisc1-8xb32-bigGAN-sch_imagenet1k-128x128.py
│ │ ├── sagan_woReLUinplace_Glr1e-4_Dlr4e-4_ndisc1-4xb64_imagenet1k-128x128.py
│ │ └── sagan_woReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ ├── singan/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── singan_balloons.py
│ │ ├── singan_bohemian.py
│ │ └── singan_fish.py
│ ├── sngan_proj/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── sngan-proj-cvt-studioGAN_cifar10-32x32.py
│ │ ├── sngan-proj-cvt-studioGAN_imagenet1k-128x128.py
│ │ ├── sngan-proj_wReLUinplace_Glr2e-4_Dlr5e-5_ndisc5-2xb128_imagenet1k-128x128.py
│ │ ├── sngan-proj_wReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ │ ├── sngan-proj_woReLUinplace_Glr2e-4_Dlr5e-5_ndisc5-2xb128_imagenet1k-128x128.py
│ │ └── sngan-proj_woReLUinplace_lr2e-4-ndisc5-1xb64_cifar10-32x32.py
│ ├── srcnn/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ └── srcnn_x4k915_1xb16-1000k_div2k.py
│ ├── srgan_resnet/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── msrresnet_x4c64b16_1xb16-1000k_div2k.py
│ │ └── srgan_x4c64b16_1xb16-1000k_div2k.py
│ ├── stable_diffusion/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── stable-diffusion_ddim_denoisingunet-inpaint.py
│ │ ├── stable-diffusion_ddim_denoisingunet-tomesd_5e-1.py
│ │ └── stable-diffusion_ddim_denoisingunet.py
│ ├── stable_diffusion_xl/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ └── stable-diffusion_xl_ddim_denoisingunet.py
│ ├── styleganv1/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── styleganv1_ffhq-1024x1024_8xb4-25Mimgs.py
│ │ └── styleganv1_ffhq-256x256_8xb4-25Mimgs.py
│ ├── styleganv2/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── stylegan2_c2-PL-R1_8xb4-apex-fp16-no-scaler-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2-PL-R1_8xb4-fp16-globalG-partialD-no-scaler-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2-PL_8xb4-fp16-partial-GD-no-scaler-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_ffhq-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_lsun-cat-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_lsun-church-256x256.py
│ │ ├── stylegan2_c2_8xb4-800kiters_lsun-horse-256x256.py
│ │ ├── stylegan2_c2_8xb4_ffhq-1024x1024.py
│ │ └── stylegan2_c2_8xb4_lsun-car-384x512.py
│ ├── styleganv3/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ ├── stylegan3-r_ada-gamma3.3_8xb4-fp16_metfaces-1024x1024.py
│ │ ├── stylegan3-r_cvt-official-rgb_8xb4_ffhq-1024x1024.py
│ │ ├── stylegan3-r_cvt-official-rgb_8xb4_ffhqu-256x256.py
│ │ ├── stylegan3-r_cvt-official-rgb_8xb4x8_afhqv2-512x512.py
│ │ ├── stylegan3-t_ada-gamma6.6_8xb4-fp16_metfaces-1024x1024.py
│ │ ├── stylegan3-t_cvt-official-rgb_8xb4_afhqv2-512x512.py
│ │ ├── stylegan3-t_cvt-official-rgb_8xb4_ffhq-1024x1024.py
│ │ ├── stylegan3-t_cvt-official-rgb_8xb4_ffhqu-256x256.py
│ │ ├── stylegan3-t_gamma2.0_8xb4-fp16-noaug_ffhq-256x256.py
│ │ └── stylegan3-t_gamma32.8_8xb4-fp16-noaug_ffhq-1024x1024.py
│ ├── swinir/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── swinir_gan-x2s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_gan-x4s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_gan-x4s64w8d9e240_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_psnr-x2s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_psnr-x4s64w8d6e180_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_psnr-x4s64w8d9e240_8xb4-lr1e-4-600k_df2k-ost.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR10.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR20.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR30.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-colorCAR40.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR10.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR20.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR30.py
│ │ ├── swinir_s126w7d6e180_8xb1-lr2e-4-1600k_dfwb-grayCAR40.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-colorDN15.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-colorDN25.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-colorDN50.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-grayDN15.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-grayDN25.py
│ │ ├── swinir_s128w8d6e180_8xb1-lr2e-4-1600k_dfwb-grayDN50.py
│ │ ├── swinir_x2s48w8d6e180_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x2s64w8d4e60_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x2s64w8d6e180_8xb4-lr2e-4-500k_df2k.py
│ │ ├── swinir_x3s48w8d6e180_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x3s64w8d4e60_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x3s64w8d6e180_8xb4-lr2e-4-500k_df2k.py
│ │ ├── swinir_x4s48w8d6e180_8xb4-lr2e-4-500k_div2k.py
│ │ ├── swinir_x4s64w8d4e60_8xb4-lr2e-4-500k_div2k.py
│ │ └── swinir_x4s64w8d6e180_8xb4-lr2e-4-500k_df2k.py
│ ├── tdan/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── tdan_x4_8xb16-lr1e-4-400k_vimeo90k-bd.py
│ │ ├── tdan_x4_8xb16-lr1e-4-400k_vimeo90k-bi.py
│ │ ├── tdan_x4ft_8xb16-lr5e-5-400k_vimeo90k-bi.py
│ │ └── tdan_x4ft_8xb16-lr5e-5-800k_vimeo90k-bd.py
│ ├── textual_inversion/
│ │ ├── README.md
│ │ ├── metafile.yml
│ │ └── textual_inversion.py
│ ├── tof/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── tof_spynet-chair-wobn_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-kitti-wobn_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-pytoflow-wobn_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-sintel-wobn-clean_1xb1_vimeo90k-triplet.py
│ │ ├── tof_spynet-sintel-wobn-final_1xb1_vimeo90k-triplet.py
│ │ └── tof_x4_official_vimeo90k.py
│ ├── ttsr/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ ├── ttsr-gan_x4c64b16_1xb9-500k_CUFED.py
│ │ └── ttsr-rec_x4c64b16_1xb9-200k_CUFED.py
│ ├── vico/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── metafile.yml
│ │ └── vico.py
│ └── wgan-gp/
│ ├── README.md
│ ├── metafile.yml
│ ├── wgangp_GN-GP-50_1xb64-160kiters_lsun-bedroom-128x128.py
│ └── wgangp_GN_1xb64-160kiters_celeba-cropped-128x128.py
├── demo/
│ ├── README.md
│ ├── download_inference_resources.py
│ ├── gradio_animatediff.py
│ ├── gradio_controlnet_animation.py
│ ├── gradio_draggan.py
│ ├── gradio_fastcomposer.py
│ ├── gradio_inpainting.py
│ ├── gradio_vico.py
│ ├── mmagic_inference_demo.py
│ ├── mmagic_inference_tutorial.ipynb
│ ├── singan_demo.py
│ └── utils/
│ ├── gradio_utils.py
│ └── renderer.py
├── docker/
│ ├── Dockerfile
│ └── README.md
├── docs/
│ ├── en/
│ │ ├── .dev_scripts/
│ │ │ ├── update_dataset_zoo.py
│ │ │ └── update_model_zoo.py
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ ├── _static/
│ │ │ └── css/
│ │ │ └── readthedocs.css
│ │ ├── _templates/
│ │ │ ├── 404.html
│ │ │ └── python/
│ │ │ ├── attribute.rst
│ │ │ ├── class.rst
│ │ │ ├── data.rst
│ │ │ ├── exception.rst
│ │ │ ├── function.rst
│ │ │ ├── method.rst
│ │ │ ├── module.rst
│ │ │ ├── package.rst
│ │ │ └── property.rst
│ │ ├── advanced_guides/
│ │ │ ├── data_flow.md
│ │ │ ├── data_preprocessor.md
│ │ │ ├── evaluator.md
│ │ │ └── structures.md
│ │ ├── changelog.md
│ │ ├── community/
│ │ │ ├── contributing.md
│ │ │ └── projects.md
│ │ ├── conf.py
│ │ ├── device/
│ │ │ └── npu.md
│ │ ├── docutils.conf
│ │ ├── faq.md
│ │ ├── get_started/
│ │ │ ├── install.md
│ │ │ ├── overview.md
│ │ │ └── quick_run.md
│ │ ├── howto/
│ │ │ ├── dataset.md
│ │ │ ├── losses.md
│ │ │ ├── models.md
│ │ │ └── transforms.md
│ │ ├── index.rst
│ │ ├── make.bat
│ │ ├── migration/
│ │ │ ├── amp.md
│ │ │ ├── data.md
│ │ │ ├── distributed_train.md
│ │ │ ├── eval_test.md
│ │ │ ├── models.md
│ │ │ ├── optimizers.md
│ │ │ ├── overview.md
│ │ │ ├── runtime.md
│ │ │ ├── schedule.md
│ │ │ └── visualization.md
│ │ ├── switch_language.md
│ │ └── user_guides/
│ │ ├── config.md
│ │ ├── dataset_prepare.md
│ │ ├── deploy.md
│ │ ├── inference.md
│ │ ├── metrics.md
│ │ ├── train_test.md
│ │ ├── useful_tools.md
│ │ └── visualization.md
│ └── zh_cn/
│ ├── .dev_scripts/
│ │ ├── update_dataset_zoo.py
│ │ └── update_model_zoo.py
│ ├── .gitignore
│ ├── Makefile
│ ├── _static/
│ │ └── css/
│ │ └── readthedocs.css
│ ├── _templates/
│ │ └── 404.html
│ ├── advanced_guides/
│ │ ├── data_flow.md
│ │ ├── data_preprocessor.md
│ │ ├── evaluator.md
│ │ └── structures.md
│ ├── changelog.md
│ ├── community/
│ │ ├── contributing.md
│ │ └── projects.md
│ ├── conf.py
│ ├── device/
│ │ └── npu_zh.md
│ ├── faq.md
│ ├── get_started/
│ │ ├── install.md
│ │ ├── overview.md
│ │ └── quick_run.md
│ ├── howto/
│ │ ├── dataset.md
│ │ ├── losses.md
│ │ ├── models.md
│ │ └── transforms.md
│ ├── index.rst
│ ├── make.bat
│ ├── migration/
│ │ ├── amp.md
│ │ ├── data.md
│ │ ├── distributed_train.md
│ │ ├── eval_test.md
│ │ ├── models.md
│ │ ├── optimizers.md
│ │ ├── overview.md
│ │ ├── runtime.md
│ │ ├── schedule.md
│ │ └── visualization.md
│ ├── stat.py
│ ├── switch_language.md
│ └── user_guides/
│ ├── config.md
│ ├── dataset_prepare.md
│ ├── deploy.md
│ ├── index.rst
│ ├── inference.md
│ ├── metrics.md
│ ├── train_test.md
│ ├── useful_tools.md
│ └── visualization.md
├── mmagic/
│ ├── __init__.py
│ ├── apis/
│ │ ├── __init__.py
│ │ ├── inferencers/
│ │ │ ├── __init__.py
│ │ │ ├── base_mmagic_inferencer.py
│ │ │ ├── colorization_inferencer.py
│ │ │ ├── conditional_inferencer.py
│ │ │ ├── controlnet_animation_inferencer.py
│ │ │ ├── diffusers_pipeline_inferencer.py
│ │ │ ├── eg3d_inferencer.py
│ │ │ ├── image_super_resolution_inferencer.py
│ │ │ ├── inference_functions.py
│ │ │ ├── inpainting_inferencer.py
│ │ │ ├── matting_inferencer.py
│ │ │ ├── text2image_inferencer.py
│ │ │ ├── translation_inferencer.py
│ │ │ ├── unconditional_inferencer.py
│ │ │ ├── video_interpolation_inferencer.py
│ │ │ └── video_restoration_inferencer.py
│ │ └── mmagic_inferencer.py
│ ├── configs/
│ │ ├── _base_/
│ │ │ ├── datasets/
│ │ │ │ ├── basicvsr_test_config.py
│ │ │ │ ├── celeba.py
│ │ │ │ ├── cifar10_noaug.py
│ │ │ │ ├── cifar10_nopad.py
│ │ │ │ ├── comp1k.py
│ │ │ │ ├── deblurring-defocus_test_config.py
│ │ │ │ ├── deblurring-motion_test_config.py
│ │ │ │ ├── decompression_test_config.py
│ │ │ │ ├── denoising-gaussian_color_test_config.py
│ │ │ │ ├── denoising-gaussian_gray_test_config.py
│ │ │ │ ├── denoising-real_test_config.py
│ │ │ │ ├── deraining_test_config.py
│ │ │ │ ├── ffhq_flip.py
│ │ │ │ ├── grow_scale_imgs_ffhq_styleganv1.py
│ │ │ │ ├── imagenet_128.py
│ │ │ │ ├── imagenet_256.py
│ │ │ │ ├── imagenet_512.py
│ │ │ │ ├── imagenet_64.py
│ │ │ │ ├── imagenet_noaug_128.py
│ │ │ │ ├── liif_test_config.py
│ │ │ │ ├── lsun_stylegan.py
│ │ │ │ ├── paired_imgs_256x256_crop.py
│ │ │ │ ├── places.py
│ │ │ │ ├── sisr_x2_test_config.py
│ │ │ │ ├── sisr_x3_test_config.py
│ │ │ │ ├── sisr_x4_test_config.py
│ │ │ │ ├── tdan_test_config.py
│ │ │ │ ├── unconditional_imgs_128x128.py
│ │ │ │ ├── unconditional_imgs_64x64.py
│ │ │ │ ├── unconditional_imgs_flip_512x512.py
│ │ │ │ ├── unconditional_imgs_flip_lanczos_resize_256x256.py
│ │ │ │ └── unpaired_imgs_256x256.py
│ │ │ ├── default_runtime.py
│ │ │ ├── gen_default_runtime.py
│ │ │ ├── inpaint_default_runtime.py
│ │ │ ├── matting_default_runtime.py
│ │ │ ├── models/
│ │ │ │ ├── base_cyclegan.py
│ │ │ │ ├── base_deepfillv1.py
│ │ │ │ ├── base_deepfillv2.py
│ │ │ │ ├── base_edvr.py
│ │ │ │ ├── base_gl.py
│ │ │ │ ├── base_glean.py
│ │ │ │ ├── base_liif.py
│ │ │ │ ├── base_pconv.py
│ │ │ │ ├── base_pix2pix.py
│ │ │ │ ├── base_styleganv1.py
│ │ │ │ ├── base_styleganv2.py
│ │ │ │ ├── base_styleganv3.py
│ │ │ │ ├── base_tof.py
│ │ │ │ ├── biggan/
│ │ │ │ │ └── base_biggan_128x128.py
│ │ │ │ ├── dcgan/
│ │ │ │ │ ├── base_dcgan_128x128.py
│ │ │ │ │ └── base_dcgan_64x64.py
│ │ │ │ ├── sagan/
│ │ │ │ │ ├── base_sagan_128x128.py
│ │ │ │ │ └── base_sagan_32x32.py
│ │ │ │ └── sngan_proj/
│ │ │ │ ├── base_sngan_proj_128x128.py
│ │ │ │ └── base_sngan_proj_32x32.py
│ │ │ └── schedules/
│ │ │ └── .gitkeep
│ │ ├── biggan/
│ │ │ ├── biggan-deep_cvt-hugging-face-rgb_imagenet1k-128x128.py
│ │ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-256x256.py
│ │ │ ├── biggan-deep_cvt-hugging-face_rgb_imagenet1k-512x512.py
│ │ │ ├── biggan_2xb25-500kiters_cifar10-32x32.py
│ │ │ ├── biggan_ajbrock-sn_8xb32-1500kiters_imagenet1k-128x128.py
│ │ │ └── biggan_cvt-BigGAN-PyTorch-rgb_imagenet1k-128x128.py
│ │ ├── dreambooth/
│ │ │ ├── dreambooth-finetune_text_encoder.py
│ │ │ ├── dreambooth-prior_pre.py
│ │ │ ├── dreambooth.py
│ │ │ ├── dreambooth_lora-prior_pre.py
│ │ │ └── dreambooth_lora.py
│ │ ├── eg3d/
│ │ │ ├── eg3d_cvt-official-rgb_afhq-512x512.py
│ │ │ ├── eg3d_cvt-official-rgb_ffhq-512x512.py
│ │ │ └── eg3d_cvt-official-rgb_shapenet-128x128.py
│ │ ├── guided_diffusion/
│ │ │ ├── adm-g_ddim25_8xb32_imagenet_256x256.py
│ │ │ ├── adm-g_ddim25_8xb32_imagenet_512x512.py
│ │ │ ├── adm-g_ddim25_8xb32_imagenet_64x64.py
│ │ │ ├── adm_ddim250_8xb32_imagenet_256x256.py
│ │ │ ├── adm_ddim250_8xb32_imagenet_512x512.py
│ │ │ └── adm_ddim250_8xb32_imagenet_64x64.py
│ │ ├── inst_colorization/
│ │ │ └── inst-colorizatioon_full_official_cocostuff-256x256.py
│ │ ├── real_basicvsr/
│ │ │ ├── realbasicvsr_c64b20_1x30x8_8xb1_lr5e_5_150k_reds.py
│ │ │ └── realbasicvsr_wogan_c64b20_2x30x8_8xb2_lr1e_4_300k_reds.py
│ │ ├── styleganv2/
│ │ │ ├── stylegan2_c2_8xb4_800kiters_ffhq_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_800kiters_lsun_cat_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_800kiters_lsun_church_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_800kiters_lsun_horse_256x256.py
│ │ │ ├── stylegan2_c2_8xb4_ffhq_1024x1024.py
│ │ │ ├── stylegan2_c2_8xb4_lsun_car_384x512.py
│ │ │ ├── stylegan2_c2_PL_8xb4_fp16_partial_GD_no_scaler_800kiters_ffhq_256x256.py
│ │ │ ├── stylegan2_c2_PL_R1_8xb4_apex_fp16_no_scaler_800kiters_ffhq_256x256.py
│ │ │ └── stylegan2_c2_PL_R1_8xb4_fp16_globalG_partialD_no_scaler_800kiters_ffhq_256x256.py
│ │ └── styleganv3/
│ │ ├── stylegan3_r_ada_gamma33_8xb4_fp16_metfaces_1024x1024.py
│ │ ├── stylegan3_r_cvt_official_rgb_8xb4_ffhq_1024x1024.py
│ │ ├── stylegan3_r_cvt_official_rgb_8xb4_ffhqu_256x256.py
│ │ ├── stylegan3_r_cvt_official_rgb_8xb4x8_afhqv2_512x512.py
│ │ ├── stylegan3_t_ada_gamma66_8xb4_fp16_metfaces_1024x1024.py
│ │ ├── stylegan3_t_cvt_official_rgb_8xb4_afhqv2_512x512.py
│ │ ├── stylegan3_t_cvt_official_rgb_8xb4_ffhq_1024x1024.py
│ │ ├── stylegan3_t_cvt_official_rgb_8xb4_ffhqu_256x256.py
│ │ ├── stylegan3_t_gamma20_8xb4_fp16_noaug_ffhq_256x256.py
│ │ └── stylegan3_t_gamma328_8xb4_fp16_noaug_ffhq_1024x1024.py
│ ├── datasets/
│ │ ├── __init__.py
│ │ ├── basic_conditional_dataset.py
│ │ ├── basic_frames_dataset.py
│ │ ├── basic_image_dataset.py
│ │ ├── categories.py
│ │ ├── cifar10_dataset.py
│ │ ├── comp1k_dataset.py
│ │ ├── controlnet_dataset.py
│ │ ├── data_utils.py
│ │ ├── dreambooth_dataset.py
│ │ ├── grow_scale_image_dataset.py
│ │ ├── imagenet_dataset.py
│ │ ├── mscoco_dataset.py
│ │ ├── paired_image_dataset.py
│ │ ├── singan_dataset.py
│ │ ├── textual_inversion_dataset.py
│ │ ├── transforms/
│ │ │ ├── __init__.py
│ │ │ ├── albu_function.py
│ │ │ ├── albumentations.py
│ │ │ ├── alpha.py
│ │ │ ├── aug_frames.py
│ │ │ ├── aug_pixel.py
│ │ │ ├── aug_shape.py
│ │ │ ├── blur_kernels.py
│ │ │ ├── crop.py
│ │ │ ├── fgbg.py
│ │ │ ├── formatting.py
│ │ │ ├── generate_assistant.py
│ │ │ ├── generate_frame_indices.py
│ │ │ ├── get_masked_image.py
│ │ │ ├── loading.py
│ │ │ ├── matlab_like_resize.py
│ │ │ ├── normalization.py
│ │ │ ├── random_degradations.py
│ │ │ ├── random_down_sampling.py
│ │ │ ├── trimap.py
│ │ │ └── values.py
│ │ └── unpaired_image_dataset.py
│ ├── engine/
│ │ ├── __init__.py
│ │ ├── hooks/
│ │ │ ├── __init__.py
│ │ │ ├── ema.py
│ │ │ ├── iter_time_hook.py
│ │ │ ├── pggan_fetch_data_hook.py
│ │ │ ├── pickle_data_hook.py
│ │ │ ├── reduce_lr_scheduler_hook.py
│ │ │ └── visualization_hook.py
│ │ ├── optimizers/
│ │ │ ├── __init__.py
│ │ │ ├── multi_optimizer_constructor.py
│ │ │ ├── pggan_optimizer_constructor.py
│ │ │ └── singan_optimizer_constructor.py
│ │ ├── runner/
│ │ │ ├── __init__.py
│ │ │ ├── log_processor.py
│ │ │ ├── loop_utils.py
│ │ │ └── multi_loops.py
│ │ └── schedulers/
│ │ ├── __init__.py
│ │ ├── linear_lr_scheduler_with_interval.py
│ │ └── reduce_lr_scheduler.py
│ ├── evaluation/
│ │ ├── __init__.py
│ │ ├── evaluator.py
│ │ ├── functional/
│ │ │ ├── __init__.py
│ │ │ ├── fid_inception.py
│ │ │ ├── gaussian_funcs.py
│ │ │ └── inception_utils.py
│ │ └── metrics/
│ │ ├── __init__.py
│ │ ├── base_gen_metric.py
│ │ ├── base_sample_wise_metric.py
│ │ ├── connectivity_error.py
│ │ ├── equivariance.py
│ │ ├── fid.py
│ │ ├── gradient_error.py
│ │ ├── inception_score.py
│ │ ├── mae.py
│ │ ├── matting_mse.py
│ │ ├── metrics_utils.py
│ │ ├── ms_ssim.py
│ │ ├── mse.py
│ │ ├── niqe.py
│ │ ├── niqe_pris_params.npz
│ │ ├── ppl.py
│ │ ├── precision_and_recall.py
│ │ ├── psnr.py
│ │ ├── sad.py
│ │ ├── snr.py
│ │ ├── ssim.py
│ │ └── swd.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── archs/
│ │ │ ├── __init__.py
│ │ │ ├── all_gather_layer.py
│ │ │ ├── aspp.py
│ │ │ ├── attention_injection.py
│ │ │ ├── conv.py
│ │ │ ├── downsample.py
│ │ │ ├── ensemble.py
│ │ │ ├── gated_conv_module.py
│ │ │ ├── img_normalize.py
│ │ │ ├── linear_module.py
│ │ │ ├── lora.py
│ │ │ ├── multi_layer_disc.py
│ │ │ ├── patch_disc.py
│ │ │ ├── resnet.py
│ │ │ ├── separable_conv_module.py
│ │ │ ├── simple_encoder_decoder.py
│ │ │ ├── smpatch_disc.py
│ │ │ ├── sr_backbone.py
│ │ │ ├── tokenizer.py
│ │ │ ├── upsample.py
│ │ │ ├── vgg.py
│ │ │ └── wrapper.py
│ │ ├── base_models/
│ │ │ ├── __init__.py
│ │ │ ├── average_model.py
│ │ │ ├── base_conditional_gan.py
│ │ │ ├── base_edit_model.py
│ │ │ ├── base_gan.py
│ │ │ ├── base_mattor.py
│ │ │ ├── base_translation_model.py
│ │ │ ├── basic_interpolator.py
│ │ │ ├── one_stage.py
│ │ │ └── two_stage.py
│ │ ├── data_preprocessors/
│ │ │ ├── __init__.py
│ │ │ ├── data_preprocessor.py
│ │ │ └── mattor_preprocessor.py
│ │ ├── diffusion_schedulers/
│ │ │ ├── __init__.py
│ │ │ ├── ddim_scheduler.py
│ │ │ └── ddpm_scheduler.py
│ │ ├── editors/
│ │ │ ├── __init__.py
│ │ │ ├── animatediff/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── animatediff.py
│ │ │ │ ├── animatediff_utils.py
│ │ │ │ ├── attention_3d.py
│ │ │ │ ├── motion_module.py
│ │ │ │ ├── resnet_3d.py
│ │ │ │ ├── unet_3d.py
│ │ │ │ └── unet_block.py
│ │ │ ├── aotgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── aot_decoder.py
│ │ │ │ ├── aot_encoder.py
│ │ │ │ ├── aot_encoder_decoder.py
│ │ │ │ ├── aot_inpaintor.py
│ │ │ │ └── aot_neck.py
│ │ │ ├── arcface/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── arcface_modules.py
│ │ │ │ ├── id_loss.py
│ │ │ │ └── model_irse.py
│ │ │ ├── basicvsr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── basicvsr.py
│ │ │ │ └── basicvsr_net.py
│ │ │ ├── basicvsr_plusplus_net/
│ │ │ │ ├── __init__.py
│ │ │ │ └── basicvsr_plusplus_net.py
│ │ │ ├── biggan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── biggan.py
│ │ │ │ ├── biggan_deep_discriminator.py
│ │ │ │ ├── biggan_deep_generator.py
│ │ │ │ ├── biggan_discriminator.py
│ │ │ │ ├── biggan_generator.py
│ │ │ │ ├── biggan_modules.py
│ │ │ │ └── biggan_snmodule.py
│ │ │ ├── cain/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── cain.py
│ │ │ │ └── cain_net.py
│ │ │ ├── controlnet/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── controlnet.py
│ │ │ │ └── controlnet_utils.py
│ │ │ ├── cyclegan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── cyclegan.py
│ │ │ │ ├── cyclegan_generator.py
│ │ │ │ └── cyclegan_modules.py
│ │ │ ├── dcgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── dcgan.py
│ │ │ │ ├── dcgan_discriminator.py
│ │ │ │ └── dcgan_generator.py
│ │ │ ├── ddpm/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── attention.py
│ │ │ │ ├── denoising_unet.py
│ │ │ │ ├── embeddings.py
│ │ │ │ ├── res_blocks.py
│ │ │ │ └── unet_blocks.py
│ │ │ ├── deblurganv2/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── deblurganv2.py
│ │ │ │ ├── deblurganv2_discriminator.py
│ │ │ │ ├── deblurganv2_generator.py
│ │ │ │ └── deblurganv2_util.py
│ │ │ ├── deepfillv1/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── contextual_attention.py
│ │ │ │ ├── contextual_attention_neck.py
│ │ │ │ ├── deepfill_decoder.py
│ │ │ │ ├── deepfill_disc.py
│ │ │ │ ├── deepfill_encoder.py
│ │ │ │ ├── deepfill_refiner.py
│ │ │ │ └── deepfillv1.py
│ │ │ ├── deepfillv2/
│ │ │ │ ├── __init__.py
│ │ │ │ └── two_stage_encoder_decoder.py
│ │ │ ├── dic/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── dic.py
│ │ │ │ ├── dic_net.py
│ │ │ │ ├── feedback_hour_glass.py
│ │ │ │ └── light_cnn.py
│ │ │ ├── dim/
│ │ │ │ ├── __init__.py
│ │ │ │ └── dim.py
│ │ │ ├── disco_diffusion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── clip_wrapper.py
│ │ │ │ ├── disco.py
│ │ │ │ ├── guider.py
│ │ │ │ └── secondary_model.py
│ │ │ ├── dreambooth/
│ │ │ │ ├── __init__.py
│ │ │ │ └── dreambooth.py
│ │ │ ├── duf/
│ │ │ │ ├── __init__.py
│ │ │ │ └── duf.py
│ │ │ ├── edsr/
│ │ │ │ ├── __init__.py
│ │ │ │ └── edsr_net.py
│ │ │ ├── edvr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── edvr.py
│ │ │ │ └── edvr_net.py
│ │ │ ├── eg3d/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── camera.py
│ │ │ │ ├── dual_discriminator.py
│ │ │ │ ├── eg3d.py
│ │ │ │ ├── eg3d_generator.py
│ │ │ │ ├── eg3d_modules.py
│ │ │ │ ├── eg3d_utils.py
│ │ │ │ ├── ray_sampler.py
│ │ │ │ └── renderer.py
│ │ │ ├── esrgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── esrgan.py
│ │ │ │ └── rrdb_net.py
│ │ │ ├── fastcomposer/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── fastcomposer.py
│ │ │ │ └── fastcomposer_util.py
│ │ │ ├── fba/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── fba_decoder.py
│ │ │ │ └── fba_encoder.py
│ │ │ ├── flavr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── flavr.py
│ │ │ │ └── flavr_net.py
│ │ │ ├── gca/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── gca.py
│ │ │ │ ├── gca_module.py
│ │ │ │ ├── resgca_dec.py
│ │ │ │ └── resgca_enc.py
│ │ │ ├── ggan/
│ │ │ │ ├── __init__.py
│ │ │ │ └── ggan.py
│ │ │ ├── glean/
│ │ │ │ ├── __init__.py
│ │ │ │ └── glean_styleganv2.py
│ │ │ ├── global_local/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── gl_decoder.py
│ │ │ │ ├── gl_dilation.py
│ │ │ │ ├── gl_disc.py
│ │ │ │ ├── gl_encoder.py
│ │ │ │ ├── gl_encoder_decoder.py
│ │ │ │ └── gl_inpaintor.py
│ │ │ ├── guided_diffusion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── adm.py
│ │ │ │ └── classifier.py
│ │ │ ├── iconvsr/
│ │ │ │ ├── __init__.py
│ │ │ │ └── iconvsr_net.py
│ │ │ ├── indexnet/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── indexnet.py
│ │ │ │ ├── indexnet_decoder.py
│ │ │ │ └── indexnet_encoder.py
│ │ │ ├── inst_colorization/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── color_utils.py
│ │ │ │ ├── colorization_net.py
│ │ │ │ ├── fusion_net.py
│ │ │ │ ├── inst_colorization.py
│ │ │ │ └── weight_layer.py
│ │ │ ├── liif/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── liif.py
│ │ │ │ ├── liif_net.py
│ │ │ │ └── mlp_refiner.py
│ │ │ ├── lsgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── lsgan.py
│ │ │ │ ├── lsgan_discriminator.py
│ │ │ │ └── lsgan_generator.py
│ │ │ ├── mspie/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── mspie_stylegan2.py
│ │ │ │ ├── mspie_stylegan2_discriminator.py
│ │ │ │ ├── mspie_stylegan2_generator.py
│ │ │ │ ├── mspie_stylegan2_modules.py
│ │ │ │ ├── pe_singan.py
│ │ │ │ ├── pe_singan_generator.py
│ │ │ │ └── positional_encoding.py
│ │ │ ├── nafnet/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── naf_avgpool2d.py
│ │ │ │ ├── naf_layerNorm2d.py
│ │ │ │ ├── nafbaseline_net.py
│ │ │ │ └── nafnet_net.py
│ │ │ ├── pconv/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── mask_conv_module.py
│ │ │ │ ├── partial_conv.py
│ │ │ │ ├── pconv_decoder.py
│ │ │ │ ├── pconv_encoder.py
│ │ │ │ ├── pconv_encoder_decoder.py
│ │ │ │ └── pconv_inpaintor.py
│ │ │ ├── pggan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── pggan.py
│ │ │ │ ├── pggan_discriminator.py
│ │ │ │ ├── pggan_generator.py
│ │ │ │ └── pggan_modules.py
│ │ │ ├── pix2pix/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── pix2pix.py
│ │ │ │ ├── pix2pix_generator.py
│ │ │ │ └── pix2pix_modules.py
│ │ │ ├── plain/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── plain_decoder.py
│ │ │ │ └── plain_refiner.py
│ │ │ ├── rdn/
│ │ │ │ ├── __init__.py
│ │ │ │ └── rdn_net.py
│ │ │ ├── real_basicvsr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── real_basicvsr.py
│ │ │ │ └── real_basicvsr_net.py
│ │ │ ├── real_esrgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── real_esrgan.py
│ │ │ │ └── unet_disc.py
│ │ │ ├── restormer/
│ │ │ │ ├── __init__.py
│ │ │ │ └── restormer_net.py
│ │ │ ├── sagan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── sagan.py
│ │ │ │ ├── sagan_discriminator.py
│ │ │ │ ├── sagan_generator.py
│ │ │ │ └── sagan_modules.py
│ │ │ ├── singan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── singan.py
│ │ │ │ ├── singan_discriminator.py
│ │ │ │ ├── singan_generator.py
│ │ │ │ └── singan_modules.py
│ │ │ ├── srcnn/
│ │ │ │ ├── __init__.py
│ │ │ │ └── srcnn_net.py
│ │ │ ├── srgan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── modified_vgg.py
│ │ │ │ ├── sr_resnet.py
│ │ │ │ └── srgan.py
│ │ │ ├── stable_diffusion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── clip_wrapper.py
│ │ │ │ ├── stable_diffusion.py
│ │ │ │ ├── stable_diffusion_inpaint.py
│ │ │ │ └── vae.py
│ │ │ ├── stable_diffusion_xl/
│ │ │ │ ├── __init__.py
│ │ │ │ └── stable_diffusion_xl.py
│ │ │ ├── stylegan1/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── stylegan1.py
│ │ │ │ ├── stylegan1_discriminator.py
│ │ │ │ ├── stylegan1_generator.py
│ │ │ │ ├── stylegan1_modules.py
│ │ │ │ └── stylegan_utils.py
│ │ │ ├── stylegan2/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ada/
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── augment.py
│ │ │ │ │ ├── grid_sample_gradfix.py
│ │ │ │ │ ├── misc.py
│ │ │ │ │ └── upfirdn2d.py
│ │ │ │ ├── stylegan2.py
│ │ │ │ ├── stylegan2_discriminator.py
│ │ │ │ ├── stylegan2_generator.py
│ │ │ │ └── stylegan2_modules.py
│ │ │ ├── stylegan3/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── stylegan3.py
│ │ │ │ ├── stylegan3_generator.py
│ │ │ │ ├── stylegan3_modules.py
│ │ │ │ └── stylegan3_utils.py
│ │ │ ├── swinir/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── swinir_modules.py
│ │ │ │ ├── swinir_net.py
│ │ │ │ ├── swinir_rstb.py
│ │ │ │ └── swinir_utils.py
│ │ │ ├── tdan/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── tdan.py
│ │ │ │ └── tdan_net.py
│ │ │ ├── textual_inversion/
│ │ │ │ ├── __init__.py
│ │ │ │ └── textual_inversion.py
│ │ │ ├── tof/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── tof_vfi_net.py
│ │ │ │ └── tof_vsr_net.py
│ │ │ ├── ttsr/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── lte.py
│ │ │ │ ├── search_transformer.py
│ │ │ │ ├── ttsr.py
│ │ │ │ ├── ttsr_disc.py
│ │ │ │ └── ttsr_net.py
│ │ │ ├── vico/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── vico.py
│ │ │ │ └── vico_utils.py
│ │ │ └── wgan_gp/
│ │ │ ├── __init__.py
│ │ │ ├── wgan_discriminator.py
│ │ │ ├── wgan_generator.py
│ │ │ ├── wgan_gp.py
│ │ │ └── wgan_gp_module.py
│ │ ├── losses/
│ │ │ ├── __init__.py
│ │ │ ├── adv_loss.py
│ │ │ ├── clip_loss.py
│ │ │ ├── composition_loss.py
│ │ │ ├── face_id_loss.py
│ │ │ ├── feature_loss.py
│ │ │ ├── gan_loss.py
│ │ │ ├── gradient_loss.py
│ │ │ ├── loss_comps/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── clip_loss_comps.py
│ │ │ │ ├── disc_auxiliary_loss_comps.py
│ │ │ │ ├── face_id_loss_comps.py
│ │ │ │ ├── gan_loss_comps.py
│ │ │ │ └── gen_auxiliary_loss_comps.py
│ │ │ ├── loss_wrapper.py
│ │ │ ├── perceptual_loss.py
│ │ │ └── pixelwise_loss.py
│ │ └── utils/
│ │ ├── __init__.py
│ │ ├── bbox_utils.py
│ │ ├── diffusion_utils.py
│ │ ├── flow_warp.py
│ │ ├── model_utils.py
│ │ ├── sampling_utils.py
│ │ ├── tensor_utils.py
│ │ └── tome_utils.py
│ ├── registry.py
│ ├── structures/
│ │ ├── __init__.py
│ │ └── data_sample.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── cli.py
│ │ ├── collect_env.py
│ │ ├── img_utils.py
│ │ ├── io_utils.py
│ │ ├── logger.py
│ │ ├── sampler.py
│ │ ├── setup_env.py
│ │ ├── trans_utils.py
│ │ └── typing.py
│ ├── version.py
│ └── visualization/
│ ├── __init__.py
│ ├── concat_visualizer.py
│ ├── vis_backend.py
│ └── visualizer.py
├── model-index.yml
├── projects/
│ ├── README.md
│ ├── animated_drawings/
│ │ ├── README.md
│ │ ├── bvh/
│ │ │ └── zombie.bvh
│ │ ├── characters/
│ │ │ └── slamdunk/
│ │ │ └── char_cfg.yaml
│ │ ├── configs/
│ │ │ ├── motion/
│ │ │ │ └── zombie.yaml
│ │ │ ├── mvc/
│ │ │ │ └── slamdunk.yaml
│ │ │ └── retarget/
│ │ │ └── fair1_spf.yaml
│ │ └── tools/
│ │ ├── generate_character.py
│ │ └── generate_video.py
│ ├── example_project/
│ │ ├── README.md
│ │ ├── configs/
│ │ │ └── examplenet_8xb32_in1k.py
│ │ └── models/
│ │ ├── __init__.py
│ │ └── example_net.py
│ ├── flow_style_vton/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── configs/
│ │ │ └── flow_style_vton_PFAFN_epoch_101.py
│ │ ├── inference.py
│ │ ├── models/
│ │ │ ├── __init__.py
│ │ │ ├── afwm.py
│ │ │ ├── flow_style_vton_model.py
│ │ │ └── generator.py
│ │ ├── test_pairs.txt
│ │ └── vton_dataset.py
│ ├── glide/
│ │ ├── configs/
│ │ │ ├── README.md
│ │ │ ├── glide_ddim-classifier-free_laion-64-256.py
│ │ │ └── glide_ddim-classifier-free_laion-64x64.py
│ │ └── models/
│ │ ├── __init__.py
│ │ ├── glide.py
│ │ ├── glide_modules.py
│ │ ├── glide_tokenizer/
│ │ │ ├── __init__.py
│ │ │ ├── bpe.py
│ │ │ └── simple_tokenizer.py
│ │ └── text2im_unet.py
│ ├── magicmaker/
│ │ └── index.html
│ ├── powerpaint/
│ │ ├── README.md
│ │ ├── gradio_PowerPaint.py
│ │ ├── pipeline/
│ │ │ ├── pipeline_PowerPaint.py
│ │ │ └── pipeline_PowerPaint_ControlNet.py
│ │ ├── requirements.txt
│ │ └── utils/
│ │ └── utils.py
│ └── prompt_to_prompt/
│ ├── README.md
│ ├── inversions/
│ │ ├── __init__.py
│ │ ├── ddim_inversion.py
│ │ └── null_text_inversion.py
│ ├── models/
│ │ ├── ptp.py
│ │ ├── ptp_utils.py
│ │ └── seq_aligner.py
│ └── visualize.ipynb
├── requirements/
│ ├── docs.txt
│ ├── mminstall.txt
│ ├── optional.txt
│ ├── readthedocs.txt
│ ├── runtime.txt
│ └── tests.txt
├── requirements.txt
├── setup.cfg
├── setup.py
├── tests/
│ ├── configs/
│ │ ├── aot_test.py
│ │ ├── deepfillv1_test.py
│ │ ├── diffuser_wrapper_cfg/
│ │ │ └── config.json
│ │ ├── gl_test.py
│ │ ├── one_stage_gl.py
│ │ ├── pconv_test.py
│ │ └── two_stage_test.py
│ ├── data/
│ │ ├── coco/
│ │ │ └── annotations/
│ │ │ ├── captions_train2014.json
│ │ │ └── captions_val2014.json
│ │ ├── controlnet/
│ │ │ └── prompt.json
│ │ ├── dataset/
│ │ │ ├── anno.json
│ │ │ ├── anno.txt
│ │ │ ├── c/
│ │ │ │ └── c.not_support_type
│ │ │ ├── classes.txt
│ │ │ └── wrong.yml
│ │ ├── frames/
│ │ │ ├── ann1.txt
│ │ │ ├── ann2.txt
│ │ │ └── ann3.txt
│ │ ├── image/
│ │ │ └── train.txt
│ │ ├── inpainting/
│ │ │ ├── mask_list.txt
│ │ │ └── mask_list_single_ch.txt
│ │ ├── lq.lmdb/
│ │ │ ├── data.mdb
│ │ │ ├── lock.mdb
│ │ │ └── meta_info.txt
│ │ ├── matting_dataset/
│ │ │ ├── ann.json
│ │ │ └── ann_old.json
│ │ └── textual_inversion/
│ │ └── imagenet_templates_small.txt
│ ├── test_apis/
│ │ ├── test_inferencers/
│ │ │ ├── test_base_mmagic_inferencer.py
│ │ │ ├── test_colorization_inferencer.py
│ │ │ ├── test_conditional_inferencer.py
│ │ │ ├── test_diffusers_pipeline_inferencer.py
│ │ │ ├── test_eg3d_inferencer.py
│ │ │ ├── test_image_super_resolution_inferencer.py
│ │ │ ├── test_inference_functions.py
│ │ │ ├── test_inpainting_inferencer.py
│ │ │ ├── test_matting_inferencer.py
│ │ │ ├── test_mmedit_inferencer.py
│ │ │ ├── test_text2image_inferencers.py
│ │ │ ├── test_translation_inferencer.py
│ │ │ ├── test_unconditional_inferencer.py
│ │ │ ├── test_video_interpolation_inferencer.py
│ │ │ └── test_video_restoration_inferencer.py
│ │ └── test_mmagic_inferencer.py
│ ├── test_datasets/
│ │ ├── test_basic_conditional_dataset.py
│ │ ├── test_basic_frames_dataset.py
│ │ ├── test_basic_image_dataset.py
│ │ ├── test_categories.py
│ │ ├── test_cifar10_dataset.py
│ │ ├── test_comp1k_dataset.py
│ │ ├── test_controlnet_dataset.py
│ │ ├── test_data_utils.py
│ │ ├── test_dreambooth_dataset.py
│ │ ├── test_grow_scale_image_dataset.py
│ │ ├── test_imagenet_dataset.py
│ │ ├── test_mscoco_dataset.py
│ │ ├── test_paired_image_dataset.py
│ │ ├── test_singan_dataset.py
│ │ ├── test_textual_inversion_dataset.py
│ │ ├── test_transforms/
│ │ │ ├── test_albumentations.py
│ │ │ ├── test_alpha.py
│ │ │ ├── test_aug_frames.py
│ │ │ ├── test_aug_pixel.py
│ │ │ ├── test_aug_shape.py
│ │ │ ├── test_blur_kernels.py
│ │ │ ├── test_crop.py
│ │ │ ├── test_fgbg.py
│ │ │ ├── test_formatting.py
│ │ │ ├── test_generate_assistant.py
│ │ │ ├── test_generate_frame_indices.py
│ │ │ ├── test_get_masked_image.py
│ │ │ ├── test_loading.py
│ │ │ ├── test_matlab_like_resize.py
│ │ │ ├── test_normalization.py
│ │ │ ├── test_random_degradations.py
│ │ │ ├── test_random_down_sampling.py
│ │ │ ├── test_trimap.py
│ │ │ └── test_values.py
│ │ └── test_unpaired_image_dataset.py
│ ├── test_engine/
│ │ ├── test_hooks/
│ │ │ ├── test_ema.py
│ │ │ ├── test_iter_time_hook.py
│ │ │ ├── test_pggan_fetch_data_hook.py
│ │ │ ├── test_pickle_data_hook.py
│ │ │ ├── test_reduce_lr_scheduler_hook.py
│ │ │ └── test_visualization_hook.py
│ │ ├── test_optimizers/
│ │ │ ├── test_multi_optimizer_constructor.py
│ │ │ ├── test_pggan_optimizer_constructor.py
│ │ │ └── test_singan_optimizer_constructor.py
│ │ ├── test_runner/
│ │ │ ├── test_log_processor.py
│ │ │ ├── test_loop_utils.py
│ │ │ └── test_multi_loops.py
│ │ └── test_schedulers/
│ │ ├── test_linear_lr_scheduler_with_interval.py
│ │ └── test_reduce_lr_scheduler.py
│ ├── test_evaluation/
│ │ ├── test_evaluator.py
│ │ ├── test_functional/
│ │ │ ├── test_fid_inception.py
│ │ │ ├── test_gaussian_funcs.py
│ │ │ └── test_inception_utils.py
│ │ └── test_metrics/
│ │ ├── test_base_gen_metric.py
│ │ ├── test_base_sample_wise_metric.py
│ │ ├── test_connectivity_error.py
│ │ ├── test_equivariance.py
│ │ ├── test_fid.py
│ │ ├── test_gradient_error.py
│ │ ├── test_inception_score.py
│ │ ├── test_mae.py
│ │ ├── test_matting_mse.py
│ │ ├── test_metrics_utils.py
│ │ ├── test_ms_ssim.py
│ │ ├── test_mse.py
│ │ ├── test_niqe.py
│ │ ├── test_ppl.py
│ │ ├── test_precision_and_recall.py
│ │ ├── test_psnr.py
│ │ ├── test_sad.py
│ │ ├── test_snr.py
│ │ ├── test_ssim.py
│ │ └── test_swd.py
│ ├── test_models/
│ │ ├── test_archs/
│ │ │ ├── test_aspp.py
│ │ │ ├── test_conv.py
│ │ │ ├── test_downsample.py
│ │ │ ├── test_ensemble.py
│ │ │ ├── test_gated_conv_module.py
│ │ │ ├── test_img_normalize.py
│ │ │ ├── test_linear_module.py
│ │ │ ├── test_lora.py
│ │ │ ├── test_multi_layer_disc.py
│ │ │ ├── test_patch_disc.py
│ │ │ ├── test_resnet.py
│ │ │ ├── test_separable_conv_module.py
│ │ │ ├── test_simple_encoder_decoder.py
│ │ │ ├── test_smpatch_disc.py
│ │ │ ├── test_sr_backbone.py
│ │ │ ├── test_tokenizer.py
│ │ │ ├── test_upsample.py
│ │ │ ├── test_vgg.py
│ │ │ └── test_wrapper.py
│ │ ├── test_base_models/
│ │ │ ├── test_average_model.py
│ │ │ ├── test_base_conditional_gan.py
│ │ │ ├── test_base_edit_model.py
│ │ │ ├── test_base_gan.py
│ │ │ ├── test_base_mattor.py
│ │ │ ├── test_base_translation_model.py
│ │ │ ├── test_basic_interpolator.py
│ │ │ ├── test_one_stage.py
│ │ │ └── test_two_stage.py
│ │ ├── test_data_preprocessors/
│ │ │ ├── test_data_preprocessor.py
│ │ │ └── test_mattor_preprocessor.py
│ │ ├── test_diffusion_schedulers/
│ │ │ ├── test_ddim_scheduler.py
│ │ │ └── test_init.py
│ │ ├── test_editors/
│ │ │ ├── test_animatediff/
│ │ │ │ ├── test_animatediff.py
│ │ │ │ ├── test_attention3d.py
│ │ │ │ ├── test_motion_module.py
│ │ │ │ ├── test_res_blocks3d.py
│ │ │ │ ├── test_unet3d.py
│ │ │ │ └── test_unet_blocks3d.py
│ │ │ ├── test_aotgan/
│ │ │ │ ├── test_aot_decoder.py
│ │ │ │ ├── test_aot_encoder.py
│ │ │ │ ├── test_aot_encoder_decoder.py
│ │ │ │ ├── test_aot_inpaintor.py
│ │ │ │ └── test_aot_neck.py
│ │ │ ├── test_arcface/
│ │ │ │ ├── test_arcface_modules.py
│ │ │ │ ├── test_id_loss.py
│ │ │ │ └── test_model_irse.py
│ │ │ ├── test_basicvsr/
│ │ │ │ ├── test_basicvsr.py
│ │ │ │ └── test_basicvsr_net.py
│ │ │ ├── test_basicvsr_plusplus_net/
│ │ │ │ └── test_basicvsr_plusplus_net.py
│ │ │ ├── test_biggan/
│ │ │ │ ├── test_biggan.py
│ │ │ │ ├── test_biggan_deep_discriminator.py
│ │ │ │ ├── test_biggan_deep_generator.py
│ │ │ │ ├── test_biggan_discriminator.py
│ │ │ │ ├── test_biggan_generator.py
│ │ │ │ ├── test_biggan_modules.py
│ │ │ │ └── test_biggan_snmodule.py
│ │ │ ├── test_cain/
│ │ │ │ ├── test_cain.py
│ │ │ │ └── test_cain_net.py
│ │ │ ├── test_controlnet/
│ │ │ │ ├── test_controlnet.py
│ │ │ │ └── test_controlnet_utils.py
│ │ │ ├── test_cyclegan/
│ │ │ │ ├── test_cyclegan.py
│ │ │ │ ├── test_cyclegan_generator.py
│ │ │ │ └── test_cyclegan_modules.py
│ │ │ ├── test_dcgan/
│ │ │ │ ├── test_dcgan.py
│ │ │ │ ├── test_dcgan_discriminator.py
│ │ │ │ └── test_dcgan_generator.py
│ │ │ ├── test_ddpm/
│ │ │ │ ├── test_attention.py
│ │ │ │ ├── test_ddpm_scheduler.py
│ │ │ │ ├── test_denoising_unet.py
│ │ │ │ ├── test_embeddings.py
│ │ │ │ ├── test_res_blocks.py
│ │ │ │ └── test_unet_blocks.py
│ │ │ ├── test_deblurganv2/
│ │ │ │ ├── test_deblurganv2.py
│ │ │ │ ├── test_deblurganv2_discriminator.py
│ │ │ │ └── test_deblurganv2_generator.py
│ │ │ ├── test_deepfillv1/
│ │ │ │ ├── test_contextual_attention.py
│ │ │ │ ├── test_contextual_attention_neck.py
│ │ │ │ ├── test_deepfill_decoder.py
│ │ │ │ ├── test_deepfill_disc.py
│ │ │ │ ├── test_deepfill_encoder.py
│ │ │ │ ├── test_deepfill_refiner.py
│ │ │ │ └── test_deepfillv1.py
│ │ │ ├── test_deepfillv2/
│ │ │ │ └── test_two_stage_encoder_decoder.py
│ │ │ ├── test_dic/
│ │ │ │ ├── test_dic.py
│ │ │ │ ├── test_dic_net.py
│ │ │ │ ├── test_feedback_hour_glass.py
│ │ │ │ └── test_light_cnn.py
│ │ │ ├── test_dim/
│ │ │ │ └── test_dim.py
│ │ │ ├── test_disco_diffusion/
│ │ │ │ ├── test_disco_diffusion.py
│ │ │ │ └── test_disco_diffusion_clip_wrapper.py
│ │ │ ├── test_dreambooth/
│ │ │ │ └── test_dreambooth.py
│ │ │ ├── test_duf/
│ │ │ │ └── test_duf.py
│ │ │ ├── test_edsr/
│ │ │ │ └── test_edsr_net.py
│ │ │ ├── test_edvr/
│ │ │ │ ├── test_edvr.py
│ │ │ │ └── test_edvr_net.py
│ │ │ ├── test_eg3d/
│ │ │ │ ├── test_camera.py
│ │ │ │ ├── test_dual_discriminator.py
│ │ │ │ ├── test_eg3d.py
│ │ │ │ ├── test_eg3d_generator.py
│ │ │ │ ├── test_eg3d_modules.py
│ │ │ │ ├── test_eg3d_utils.py
│ │ │ │ ├── test_ray_sampler.py
│ │ │ │ └── test_renderer.py
│ │ │ ├── test_esrgan/
│ │ │ │ ├── test_esrgan.py
│ │ │ │ └── test_rrdb_net.py
│ │ │ ├── test_fastcomposer/
│ │ │ │ └── test_fastcomposer.py
│ │ │ ├── test_fba/
│ │ │ │ ├── test_fba_decoder.py
│ │ │ │ └── test_fba_encoder.py
│ │ │ ├── test_flavr/
│ │ │ │ ├── test_flavr.py
│ │ │ │ └── test_flavr_net.py
│ │ │ ├── test_gca/
│ │ │ │ ├── test_gca.py
│ │ │ │ ├── test_gca_module.py
│ │ │ │ ├── test_resgca_dec.py
│ │ │ │ └── test_resgca_enc.py
│ │ │ ├── test_ggan/
│ │ │ │ └── test_ggan.py
│ │ │ ├── test_glean/
│ │ │ │ └── test_glean_styleganv2.py
│ │ │ ├── test_glide/
│ │ │ │ └── test_glide.py
│ │ │ ├── test_global_local/
│ │ │ │ ├── test_gl_decoder.py
│ │ │ │ ├── test_gl_dilation.py
│ │ │ │ ├── test_gl_disc.py
│ │ │ │ ├── test_gl_encoder.py
│ │ │ │ ├── test_gl_encoder_decoder.py
│ │ │ │ └── test_gl_inpaintor.py
│ │ │ ├── test_guided_diffusion/
│ │ │ │ └── test_adm.py
│ │ │ ├── test_iconvsr/
│ │ │ │ └── test_iconvsr_net.py
│ │ │ ├── test_indexnet/
│ │ │ │ ├── test_indexnet.py
│ │ │ │ ├── test_indexnet_decoder.py
│ │ │ │ └── test_indexnet_encoder.py
│ │ │ ├── test_inst_colorization/
│ │ │ │ ├── test_color_utils.py
│ │ │ │ ├── test_colorization_net.py
│ │ │ │ ├── test_fusion_net.py
│ │ │ │ ├── test_inst_colorization.py
│ │ │ │ └── test_weight_layer.py
│ │ │ ├── test_liif/
│ │ │ │ ├── test_liif.py
│ │ │ │ ├── test_liif_net.py
│ │ │ │ └── test_mlp_refiner.py
│ │ │ ├── test_lsgan/
│ │ │ │ ├── test_lsgan.py
│ │ │ │ ├── test_lsgan_discriminator.py
│ │ │ │ └── test_lsgan_generator.py
│ │ │ ├── test_mspie/
│ │ │ │ ├── test_mspie_stylegan2.py
│ │ │ │ ├── test_mspie_stylegan2_discriminator.py
│ │ │ │ ├── test_mspie_stylegan2_generator.py
│ │ │ │ ├── test_mspie_stylegan2_modules.py
│ │ │ │ ├── test_pe_singan.py
│ │ │ │ ├── test_pe_singan_generator.py
│ │ │ │ └── test_positional_encoding.py
│ │ │ ├── test_nafnet/
│ │ │ │ ├── test_naf_avgpool2d.py
│ │ │ │ ├── test_naf_layernorm2d.py
│ │ │ │ ├── test_nafbaseline.py
│ │ │ │ └── test_nafnet.py
│ │ │ ├── test_pconv/
│ │ │ │ ├── test_mask_conv_module.py
│ │ │ │ ├── test_partial_conv.py
│ │ │ │ ├── test_pconv_decoder.py
│ │ │ │ ├── test_pconv_encoder.py
│ │ │ │ ├── test_pconv_encoder_decoder.py
│ │ │ │ └── test_pconv_inpaintor.py
│ │ │ ├── test_pggan/
│ │ │ │ ├── test_pggan.py
│ │ │ │ ├── test_pggan_discriminator.py
│ │ │ │ ├── test_pggan_generator.py
│ │ │ │ └── test_pggan_modules.py
│ │ │ ├── test_pix2pix/
│ │ │ │ ├── test_pix2pix.py
│ │ │ │ ├── test_pix2pix_generator.py
│ │ │ │ └── test_pix2pix_modules.py
│ │ │ ├── test_plain/
│ │ │ │ ├── test_plain_decoder.py
│ │ │ │ └── test_plain_refiner.py
│ │ │ ├── test_rdn/
│ │ │ │ └── test_rdn_net.py
│ │ │ ├── test_real_basicvsr/
│ │ │ │ ├── test_real_basicvsr.py
│ │ │ │ └── test_real_basicvsr_net.py
│ │ │ ├── test_real_esrgan/
│ │ │ │ ├── test_real_esrgan.py
│ │ │ │ └── test_unet_disc.py
│ │ │ ├── test_restormer/
│ │ │ │ └── test_restormer_net.py
│ │ │ ├── test_sagan/
│ │ │ │ ├── test_sagan.py
│ │ │ │ ├── test_sagan_discriminator.py
│ │ │ │ ├── test_sagan_generator.py
│ │ │ │ └── test_sagan_modules.py
│ │ │ ├── test_singan/
│ │ │ │ ├── test_singan.py
│ │ │ │ ├── test_singan_discriminator.py
│ │ │ │ ├── test_singan_generator.py
│ │ │ │ └── test_singan_modules.py
│ │ │ ├── test_srcnn/
│ │ │ │ └── test_srcnn_net.py
│ │ │ ├── test_srgan/
│ │ │ │ ├── test_modified_vgg.py
│ │ │ │ ├── test_sr_resnet.py
│ │ │ │ └── test_srgan.py
│ │ │ ├── test_stable_diffusion/
│ │ │ │ ├── test_clip_wrapper.py
│ │ │ │ ├── test_stable_diffusion.py
│ │ │ │ ├── test_stable_diffusion_inpaint.py
│ │ │ │ ├── test_stable_diffusion_tomesd.py
│ │ │ │ └── test_vae.py
│ │ │ ├── test_stable_diffusion_xl/
│ │ │ │ └── test_stable_diffusion_xl.py
│ │ │ ├── test_stylegan1/
│ │ │ │ ├── test_stylegan1.py
│ │ │ │ ├── test_stylegan1_discriminator.py
│ │ │ │ ├── test_stylegan1_generator.py
│ │ │ │ ├── test_stylegan1_modules.py
│ │ │ │ └── test_stylegan_utils.py
│ │ │ ├── test_stylegan2/
│ │ │ │ ├── test_ada/
│ │ │ │ │ └── test_augment.py
│ │ │ │ ├── test_stylegan2.py
│ │ │ │ ├── test_stylegan2_discriminator.py
│ │ │ │ ├── test_stylegan2_generator.py
│ │ │ │ └── test_stylegan2_modules.py
│ │ │ ├── test_stylegan3/
│ │ │ │ ├── test_stylegan3.py
│ │ │ │ ├── test_stylegan3_generator.py
│ │ │ │ ├── test_stylegan3_modules.py
│ │ │ │ └── test_stylegan3_utils.py
│ │ │ ├── test_swinir/
│ │ │ │ ├── test_swinir_modules.py
│ │ │ │ ├── test_swinir_net.py
│ │ │ │ ├── test_swinir_rstb.py
│ │ │ │ └── test_swinir_utils.py
│ │ │ ├── test_tdan/
│ │ │ │ ├── test_tdan.py
│ │ │ │ └── test_tdan_net.py
│ │ │ ├── test_tof/
│ │ │ │ ├── test_tof_vfi_net.py
│ │ │ │ └── test_tof_vsr_net.py
│ │ │ ├── test_ttsr/
│ │ │ │ ├── test_lte.py
│ │ │ │ ├── test_search_transformer.py
│ │ │ │ ├── test_ttsr.py
│ │ │ │ ├── test_ttsr_disc.py
│ │ │ │ └── test_ttsr_net.py
│ │ │ ├── test_vico/
│ │ │ │ ├── test_vico.py
│ │ │ │ └── test_vico_utils.py
│ │ │ └── test_wgan_gp/
│ │ │ ├── test_wgan_discriminator.py
│ │ │ ├── test_wgan_generator.py
│ │ │ ├── test_wgan_gp.py
│ │ │ └── test_wgan_gp_module.py
│ │ ├── test_losses/
│ │ │ ├── test_clip_loss.py
│ │ │ ├── test_composition_loss.py
│ │ │ ├── test_face_id_loss.py
│ │ │ ├── test_feature_loss.py
│ │ │ ├── test_gan_loss.py
│ │ │ ├── test_gradient_loss.py
│ │ │ ├── test_loss_comps/
│ │ │ │ ├── test_clip_loss_comps.py
│ │ │ │ ├── test_disc_auxiliary_loss_comps.py
│ │ │ │ ├── test_face_id_loss_comps.py
│ │ │ │ ├── test_gan_loss_comps.py
│ │ │ │ └── test_gen_auxiliary_loss_comps.py
│ │ │ ├── test_loss_wrapper.py
│ │ │ ├── test_perceptual_loss.py
│ │ │ └── test_pixelwise_loss.py
│ │ └── test_utils/
│ │ ├── test_bbox_utils.py
│ │ ├── test_flow_warp.py
│ │ ├── test_model_utils.py
│ │ ├── test_sampling_utils.py
│ │ └── test_tensor_utils.py
│ ├── test_structures/
│ │ └── test_data_sample.py
│ ├── test_utils/
│ │ ├── test_cli.py
│ │ ├── test_img_utils.py
│ │ ├── test_io_utils.py
│ │ ├── test_logger.py
│ │ ├── test_sampler.py
│ │ ├── test_setup_env.py
│ │ └── test_trans_utils.py
│ └── test_visualization/
│ ├── test_concat_visualizer.py
│ ├── test_vis_backend.py
│ └── test_visualizer.py
└── tools/
├── analysis_tools/
│ ├── get_flops.py
│ └── print_config.py
├── cpu_train.sh
├── dataset_converters/
│ ├── bgm/
│ │ └── preprocess_bgm_dataset.py
│ ├── celeba-hq/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── classic5/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── comp1k/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── check_extended_fg.py
│ │ ├── evaluate_comp1k.py
│ │ ├── extend_fg.py
│ │ ├── filter_comp1k_anno.py
│ │ └── preprocess_comp1k_dataset.py
│ ├── denoising/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── deraining/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── df2k_ost/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_df2k_ost_dataset.py
│ ├── div2k/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_div2k_dataset.py
│ ├── dpdd/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── glean/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── preprocess_cat_test_dataset.py
│ │ ├── preprocess_cat_train_dataset.py
│ │ └── preprocess_ffhq_celebahq_dataset.py
│ ├── gopro/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── hide/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── live1/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── ntire21_decompression/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── paired-pix2pix/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── paris-street-view/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── places365/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── realblur/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── realsrset/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── reds/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ ├── crop_sub_images.py
│ │ └── preprocess_reds_dataset.py
│ ├── sidd/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_sidd_test_dataset.py
│ ├── spmcs/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── udm10/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── unconditional_gans/
│ │ └── README.md
│ ├── unpaired-cyclegan/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── vid4/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_vid4_dataset.py
│ ├── videolq/
│ │ ├── README.md
│ │ └── README_zh-CN.md
│ ├── vimeo90k/
│ │ ├── README.md
│ │ ├── README_zh-CN.md
│ │ └── preprocess_vimeo90k_dataset.py
│ └── vimeo90k-triplet/
│ ├── README.md
│ └── README_zh-CN.md
├── dist_test.sh
├── dist_train.sh
├── gui/
│ ├── README.md
│ ├── component.py
│ ├── gui.py
│ ├── page_general.py
│ ├── page_sr.py
│ └── utils.py
├── model_converters/
│ └── publish_model.py
├── slurm_test.sh
├── slurm_train.sh
├── test.py
└── train.py
Showing preview only (420K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (5290 symbols across 781 files)
FILE: .dev_scripts/create_ceph_configs.py
function update_intervals (line 11) | def update_intervals(config, args):
function convert_data_config (line 32) | def convert_data_config(data_cfg):
function update_ceph_config (line 138) | def update_ceph_config(filename, args, dry_run=False):
FILE: .dev_scripts/doc_link_checker.py
function make_parser (line 13) | def make_parser():
function analyze_doc (line 28) | def analyze_doc(home, path):
function traverse (line 94) | def traverse(args):
FILE: .dev_scripts/download_models.py
function additional_download (line 21) | def additional_download(args):
function parse_args (line 51) | def parse_args():
function download (line 71) | def download(args):
FILE: .dev_scripts/job_watcher.py
function show_job_out (line 15) | def show_job_out(name, root, job_name_list):
function show_job_status (line 40) | def show_job_status(root, job_name_list, csv_path=None):
function save_for_resume (line 80) | def save_for_resume(root, job_name_list):
function resume_from_file (line 99) | def resume_from_file(file_path):
function start_from_proc (line 113) | def start_from_proc(root, proc):
function show_tui (line 135) | def show_tui(root, job_name_list):
FILE: .dev_scripts/metric_mapping.py
function filter_metric (line 174) | def filter_metric(metric_mapping, summary_data):
FILE: .dev_scripts/test_benchmark.py
function parse_args (line 23) | def parse_args():
function create_test_job_batch (line 84) | def create_test_job_batch(commands, model_info, args, port, script_name):
function test (line 185) | def test(args):
function show_summary (line 276) | def show_summary(summary_data,
function summary (line 348) | def summary(args):
function main (line 420) | def main():
FILE: .dev_scripts/train_benchmark.py
function parse_args (line 87) | def parse_args():
function create_train_job_batch (line 178) | def create_train_job_batch(commands, model_info, args, port, script_name):
function train (line 282) | def train(args):
function show_summary (line 357) | def show_summary(summary_data, models_map, work_dir, save=False):
function summary (line 420) | def summary(args):
function main (line 482) | def main():
FILE: .dev_scripts/update_config_readme.py
function update_md (line 15) | def update_md(md_file):
FILE: .dev_scripts/update_model_index.py
function parse_md (line 101) | def parse_md(md_file):
function update_model_index (line 243) | def update_model_index():
FILE: .dev_scripts/update_ut.py
function check_exclude (line 24) | def check_exclude(fn):
function update_ut (line 31) | def update_ut():
FILE: .dev_scripts/utils/job_util.py
function parse_job_list (line 9) | def parse_job_list(job_list) -> Tuple[list, list]:
function parse_job_list_from_file (line 31) | def parse_job_list_from_file(job_list_file: str) -> Tuple[list, list]:
function get_info_from_id (line 48) | def get_info_from_id(job_id: str) -> dict:
function filter_jobs (line 76) | def filter_jobs(job_id_list: list,
FILE: .dev_scripts/utils/modelindex.py
function dump_yaml_and_check_difference (line 8) | def dump_yaml_and_check_difference(obj, file):
function collate_metrics (line 43) | def collate_metrics(keys):
function found_table (line 60) | def found_table(lines, i):
function modelindex_to_dict (line 74) | def modelindex_to_dict(model):
FILE: demo/download_inference_resources.py
function parse_args (line 40) | def parse_args():
function main (line 66) | def main():
FILE: demo/gradio_animatediff.py
class AnimateController (line 37) | class AnimateController:
method __init__ (line 39) | def __init__(self):
method refresh_stable_diffusion (line 67) | def refresh_stable_diffusion(self):
method refresh_motion_module (line 70) | def refresh_motion_module(self):
method refresh_personalized_model (line 77) | def refresh_personalized_model(self):
method update_stable_diffusion (line 84) | def update_stable_diffusion(self, stable_diffusion_dropdown):
method update_motion_module (line 89) | def update_motion_module(self, motion_module_dropdown):
method update_base_model (line 102) | def update_base_model(self, base_model_dropdown):
method update_lora_model (line 116) | def update_lora_model(self, lora_model_dropdown):
method animate (line 129) | def animate(
function ui (line 196) | def ui():
FILE: demo/gradio_controlnet_animation.py
function process (line 9) | def process(video, prompt, a_prompt, negative_prompt,
FILE: demo/gradio_draggan.py
function get_default_gr_state (line 32) | def get_default_gr_state(device='cuda',
function reverse_point_pairs (line 71) | def reverse_point_pairs(points):
function clear_state (line 78) | def clear_state(global_state, target=None):
function init_images (line 101) | def init_images(global_state, cache_dir='./checkpoints'):
function update_image_draw (line 142) | def update_image_draw(image, points, mask, show_mask, global_state=None):
function preprocess_mask_info (line 154) | def preprocess_mask_info(global_state, image):
function on_change_pretrained_dropdown (line 360) | def on_change_pretrained_dropdown(pretrained_value, global_state):
function on_click_reset_image (line 379) | def on_click_reset_image(global_state):
function on_change_update_image_seed (line 397) | def on_change_update_image_seed(seed, global_state):
function on_click_latent_space (line 416) | def on_click_latent_space(latent_space, global_state):
function on_change_lr (line 443) | def on_change_lr(lr, global_state):
function on_click_start (line 461) | def on_click_start(global_state, image):
function on_click_stop (line 689) | def on_click_stop(global_state):
function on_click_remove_point (line 715) | def on_click_remove_point(global_state):
function on_click_reset_mask (line 730) | def on_click_reset_mask(global_state):
function on_click_enable_draw (line 752) | def on_click_enable_draw(global_state, image):
function on_click_remove_draw (line 768) | def on_click_remove_draw(global_state, image):
function on_click_add_point (line 792) | def on_click_add_point(global_state, image: dict):
function on_click_image (line 816) | def on_click_image(global_state, evt: gr.SelectData):
function on_click_clear_points (line 855) | def on_click_clear_points(global_state):
function on_click_show_mask (line 877) | def on_click_show_mask(global_state, show_mask):
FILE: demo/gradio_fastcomposer.py
class ModelWrapper (line 18) | class ModelWrapper:
method __init__ (line 20) | def __init__(self, model):
method inference (line 27) | def inference(
function create_demo (line 84) | def create_demo():
FILE: demo/gradio_inpainting.py
class InpaintingGradio (line 20) | class InpaintingGradio:
method __init__ (line 37) | def __init__(self,
method model_reconfig (line 64) | def model_reconfig(self,
method change_text2dict (line 109) | def change_text2dict(input_text: str) -> Union[Dict, None]:
method get_package_path (line 120) | def get_package_path() -> str:
method get_model_config (line 134) | def get_model_config(self, model_name: str) -> Dict:
method init_inference_supported_models_cfg (line 151) | def init_inference_supported_models_cfg() -> None:
method _get_inpainting_kwargs (line 167) | def _get_inpainting_kwargs(self, model_name: Optional[str],
method send_notification (line 219) | def send_notification(msg: str, color: str, label: str) -> None:
method get_inpainting_supported_models (line 223) | def get_inpainting_supported_models() -> List:
method infer (line 227) | def infer(self, input_img_arg: Dict) -> np.ndarray:
method run (line 233) | def run(self) -> None:
FILE: demo/gradio_vico.py
function load_base_model (line 19) | def load_base_model():
function train (line 25) | def train(train_data, init_token, placeholder):
class DummyModel (line 47) | class DummyModel:
method __init__ (line 49) | def __init__(self, model):
function infer_fn (line 53) | def infer_fn(checkpoint, img_ref, prompt, negative_prompt, guidance_scale,
FILE: demo/mmagic_inference_demo.py
function parse_args (line 8) | def parse_args():
function main (line 97) | def main():
FILE: demo/singan_demo.py
function parse_args (line 24) | def parse_args():
function _tensor2img (line 52) | def _tensor2img(img):
function main (line 60) | def main():
FILE: demo/utils/gradio_utils.py
class EasyDict (line 8) | class EasyDict(dict):
method __getattr__ (line 12) | def __getattr__(self, name: str):
method __setattr__ (line 18) | def __setattr__(self, name: str, value) -> None:
method __delattr__ (line 21) | def __delattr__(self, name: str) -> None:
class ImageMask (line 25) | class ImageMask(gr.components.Image):
method __init__ (line 32) | def __init__(self, **kwargs):
method preprocess (line 36) | def preprocess(self, x):
function get_valid_mask (line 50) | def get_valid_mask(mask: np.ndarray):
function draw_points_on_image (line 60) | def draw_points_on_image(image,
function draw_mask_on_image (line 126) | def draw_mask_on_image(image, mask):
function on_change_single_global_state (line 142) | def on_change_single_global_state(keys,
function get_latest_points_pair (line 163) | def get_latest_points_pair(points_dict):
FILE: demo/utils/renderer.py
class CapturedException (line 25) | class CapturedException(Exception):
method __init__ (line 27) | def __init__(self, msg=None):
class CaptureSuccess (line 44) | class CaptureSuccess(Exception):
method __init__ (line 46) | def __init__(self, out):
function add_watermark_np (line 56) | def add_watermark_np(input_image_array, watermark_text='AI Generated'):
class Renderer (line 83) | class Renderer:
method __init__ (line 85) | def __init__(self, disable_timing=False):
method render (line 101) | def render(self, **args):
method get_network (line 150) | def get_network(self, pkl, key, **tweak_kwargs):
method _get_pinned_buf (line 196) | def _get_pinned_buf(self, ref):
method to_device (line 204) | def to_device(self, buf):
method to_cpu (line 207) | def to_cpu(self, buf):
method _ignore_timing (line 210) | def _ignore_timing(self):
method _apply_cmap (line 213) | def _apply_cmap(self, x, name='viridis'):
method init_network (line 225) | def init_network(self,
method update_lr (line 299) | def update_lr(self, lr):
method _render_drag_impl (line 306) | def _render_drag_impl(self,
FILE: docs/en/.dev_scripts/update_dataset_zoo.py
function update_dataset_zoo (line 6) | def update_dataset_zoo():
FILE: docs/en/.dev_scripts/update_model_zoo.py
function write_file (line 14) | def write_file(file, content):
function update_model_zoo (line 20) | def update_model_zoo():
FILE: docs/en/conf.py
function builder_inited_handler (line 150) | def builder_inited_handler(app):
function skip_member (line 155) | def skip_member(app, what, name, obj, skip, options):
function viewcode_follow_imported (line 161) | def viewcode_follow_imported(app, modname, attribute):
function setup (line 180) | def setup(app):
FILE: docs/zh_cn/.dev_scripts/update_dataset_zoo.py
function update_dataset_zoo (line 6) | def update_dataset_zoo():
FILE: docs/zh_cn/.dev_scripts/update_model_zoo.py
function anchor (line 18) | def anchor(name):
function summarize (line 24) | def summarize(stats, name):
function update_model_zoo (line 69) | def update_model_zoo():
FILE: docs/zh_cn/conf.py
function builder_inited_handler (line 146) | def builder_inited_handler(app):
function skip_member (line 151) | def skip_member(app, what, name, obj, skip, options):
function setup (line 157) | def setup(app):
FILE: docs/zh_cn/stat.py
function anchor (line 12) | def anchor(name):
FILE: mmagic/__init__.py
function digit_version (line 11) | def digit_version(version_str):
FILE: mmagic/apis/inferencers/__init__.py
class Inferencers (line 31) | class Inferencers:
method __init__ (line 43) | def __init__(self,
method __call__ (line 101) | def __call__(self, **kwargs) -> Union[Dict, List[Dict]]:
method get_extra_parameters (line 112) | def get_extra_parameters(self) -> List[str]:
FILE: mmagic/apis/inferencers/base_mmagic_inferencer.py
class BaseMMagicInferencer (line 25) | class BaseMMagicInferencer(BaseInferencer):
method __init__ (line 47) | def __init__(self,
method _init_model (line 67) | def _init_model(self, cfg: Union[ConfigType, str], ckpt: Optional[str],
method _init_pipeline (line 82) | def _init_pipeline(self, cfg: ConfigType) -> Compose:
method _init_extra_parameters (line 91) | def _init_extra_parameters(self, extra_parameters: Dict) -> None:
method _update_extra_parameters (line 98) | def _update_extra_parameters(self, **kwargs) -> None:
method _dispatch_kwargs (line 108) | def _dispatch_kwargs(self, **kwargs) -> Tuple[Dict, Dict, Dict, Dict]:
method __call__ (line 124) | def __call__(self, **kwargs) -> Union[Dict, List[Dict]]:
method base_call (line 142) | def base_call(self, **kwargs) -> Union[Dict, List[Dict]]:
method get_extra_parameters (line 170) | def get_extra_parameters(self) -> List[str]:
method postprocess (line 179) | def postprocess(
method _pred2dict (line 211) | def _pred2dict(self, pred_tensor: torch.Tensor) -> Dict:
method visualize (line 226) | def visualize(self,
FILE: mmagic/apis/inferencers/colorization_inferencer.py
class ColorizationInferencer (line 17) | class ColorizationInferencer(BaseMMagicInferencer):
method preprocess (line 26) | def preprocess(self, img: InputsType) -> Dict:
method forward (line 55) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 61) | def visualize(self,
FILE: mmagic/apis/inferencers/conditional_inferencer.py
class ConditionalInferencer (line 14) | class ConditionalInferencer(BaseMMagicInferencer):
method preprocess (line 25) | def preprocess(self, label: InputsType) -> Dict:
method forward (line 42) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 46) | def visualize(self,
method _pred2dict (line 73) | def _pred2dict(self, data_sample: DataSample) -> Dict:
FILE: mmagic/apis/inferencers/controlnet_animation_inferencer.py
function load_image (line 23) | def load_image(image: Union[str, PIL.Image.Image]) -> PIL.Image.Image:
class ControlnetAnimationInferencer (line 52) | class ControlnetAnimationInferencer(BaseMMagicInferencer):
method __init__ (line 72) | def __init__(self,
method __call__ (line 93) | def __call__(self,
FILE: mmagic/apis/inferencers/diffusers_pipeline_inferencer.py
class DiffusersPipelineInferencer (line 13) | class DiffusersPipelineInferencer(BaseMMagicInferencer):
method preprocess (line 24) | def preprocess(self,
method forward (line 53) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 59) | def visualize(self,
FILE: mmagic/apis/inferencers/eg3d_inferencer.py
class EG3DInferencer (line 25) | class EG3DInferencer(BaseMMagicInferencer):
method preprocess (line 38) | def preprocess(self, inputs: InputsType = None) -> ForwardInputs:
method forward (line 86) | def forward(self,
method visualize (line 134) | def visualize(self,
method preprocess_img (line 271) | def preprocess_img(self, preds: List[dict]) -> torch.Tensor:
method preprocess_depth (line 286) | def preprocess_depth(self, preds: List[dict]) -> torch.Tensor:
method postprocess (line 312) | def postprocess(self,
FILE: mmagic/apis/inferencers/image_super_resolution_inferencer.py
class ImageSuperResolutionInferencer (line 15) | class ImageSuperResolutionInferencer(BaseMMagicInferencer):
method preprocess (line 24) | def preprocess(self, img: InputsType, ref: InputsType = None) -> Dict:
method forward (line 75) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 82) | def visualize(self,
FILE: mmagic/apis/inferencers/inference_functions.py
function set_random_seed (line 20) | def set_random_seed(seed, deterministic=False, use_rank_shift=True):
function delete_cfg (line 38) | def delete_cfg(cfg, key='init_cfg'):
function init_model (line 53) | def init_model(config, checkpoint=None, device='cuda:0'):
function pad_sequence (line 89) | def pad_sequence(data, window_size):
function read_image (line 111) | def read_image(filepath):
function read_frames (line 126) | def read_frames(source, start_index, num_frames, from_video, end_index):
function calculate_grid_size (line 153) | def calculate_grid_size(num_batches: int = 1, aspect_ratio: int = 1) -> ...
FILE: mmagic/apis/inferencers/inpainting_inferencer.py
class InpaintingInferencer (line 15) | class InpaintingInferencer(BaseMMagicInferencer):
method _init_pipeline (line 24) | def _init_pipeline(self, cfg) -> Compose:
method preprocess (line 28) | def preprocess(self, img: InputsType, mask: InputsType) -> Dict:
method forward (line 57) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 64) | def visualize(self,
FILE: mmagic/apis/inferencers/matting_inferencer.py
class MattingInferencer (line 15) | class MattingInferencer(BaseMMagicInferencer):
method preprocess (line 24) | def preprocess(self, img: InputsType, trimap: InputsType) -> Dict:
method forward (line 58) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 64) | def visualize(self,
method _pred2dict (line 89) | def _pred2dict(self, data_sample: DataSample) -> Dict:
FILE: mmagic/apis/inferencers/text2image_inferencer.py
class Text2ImageInferencer (line 14) | class Text2ImageInferencer(BaseMMagicInferencer):
method preprocess (line 25) | def preprocess(self,
method forward (line 56) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 62) | def visualize(self,
FILE: mmagic/apis/inferencers/translation_inferencer.py
class TranslationInferencer (line 16) | class TranslationInferencer(BaseMMagicInferencer):
method preprocess (line 25) | def preprocess(self, img: InputsType) -> Dict:
method forward (line 57) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 65) | def visualize(self,
FILE: mmagic/apis/inferencers/unconditional_inferencer.py
class UnconditionalInferencer (line 14) | class UnconditionalInferencer(BaseMMagicInferencer):
method preprocess (line 26) | def preprocess(self) -> Dict:
method forward (line 45) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 49) | def visualize(self,
method _pred2dict (line 79) | def _pred2dict(self, data_sample: DataSample) -> Dict:
FILE: mmagic/apis/inferencers/video_interpolation_inferencer.py
class VideoInterpolationInferencer (line 22) | class VideoInterpolationInferencer(BaseMMagicInferencer):
method preprocess (line 39) | def preprocess(self, video: InputsType) -> Dict:
method forward (line 70) | def forward(self,
method visualize (line 192) | def visualize(self,
method postprocess (line 200) | def postprocess(
FILE: mmagic/apis/inferencers/video_restoration_inferencer.py
class VideoRestorationInferencer (line 22) | class VideoRestorationInferencer(BaseMMagicInferencer):
method preprocess (line 37) | def preprocess(self, video: InputsType) -> Dict:
method forward (line 101) | def forward(self, inputs: InputsType) -> PredType:
method visualize (line 142) | def visualize(self,
method postprocess (line 186) | def postprocess(
FILE: mmagic/apis/mmagic_inferencer.py
class MMagicInferencer (line 14) | class MMagicInferencer:
method __init__ (line 130) | def __init__(self,
method _get_inferencer_kwargs (line 150) | def _get_inferencer_kwargs(self, model_name: Optional[str],
method print_extra_parameters (line 203) | def print_extra_parameters(self):
method infer (line 208) | def infer(self,
method get_model_config (line 240) | def get_model_config(self, model_name: str) -> Dict:
method init_inference_supported_models_cfg (line 255) | def init_inference_supported_models_cfg() -> None:
method get_inference_supported_models (line 280) | def get_inference_supported_models() -> List:
method get_inference_supported_tasks (line 285) | def get_inference_supported_tasks() -> List:
method get_task_supported_models (line 299) | def get_task_supported_models(task: str) -> List:
FILE: mmagic/datasets/basic_conditional_dataset.py
class BasicConditionalDataset (line 15) | class BasicConditionalDataset(BaseDataset):
method __init__ (line 112) | def __init__(self,
method _find_samples (line 146) | def _find_samples(self, file_backend):
method load_data_list (line 180) | def load_data_list(self):
method is_valid_file (line 212) | def is_valid_file(self, filename: str) -> bool:
method img_prefix (line 217) | def img_prefix(self):
method CLASSES (line 222) | def CLASSES(self):
method class_to_idx (line 227) | def class_to_idx(self):
method get_gt_labels (line 236) | def get_gt_labels(self):
method get_cat_ids (line 247) | def get_cat_ids(self, idx: int) -> List[int]:
method _compat_classes (line 259) | def _compat_classes(self, metainfo, classes):
method full_init (line 277) | def full_init(self):
method __repr__ (line 290) | def __repr__(self):
method extra_repr (line 318) | def extra_repr(self) -> List[str]:
FILE: mmagic/datasets/basic_frames_dataset.py
class BasicFramesDataset (line 13) | class BasicFramesDataset(BaseDataset):
method __init__ (line 129) | def __init__(self,
method load_data_list (line 177) | def load_data_list(self) -> List[dict]:
method _get_path_list (line 217) | def _get_path_list(self):
method _get_path_list_from_ann (line 231) | def _get_path_list_from_ann(self):
method _get_path_list_from_folder (line 271) | def _get_path_list_from_folder(self,
method _set_seq_lens (line 312) | def _set_seq_lens(self):
method _get_frames_list (line 325) | def _get_frames_list(self, key, folder):
FILE: mmagic/datasets/basic_image_dataset.py
class BasicImageDataset (line 17) | class BasicImageDataset(BaseDataset):
method __init__ (line 133) | def __init__(self,
method load_data_list (line 175) | def load_data_list(self) -> List[dict]:
method _get_path_list (line 200) | def _get_path_list(self):
method _get_path_list_from_ann (line 215) | def _get_path_list_from_ann(self):
method _get_path_list_from_folder (line 235) | def _get_path_list_from_folder(self):
FILE: mmagic/datasets/cifar10_dataset.py
class CIFAR10 (line 16) | class CIFAR10(BasicConditionalDataset):
method __init__ (line 57) | def __init__(self,
method load_data_list (line 74) | def load_data_list(self):
method _load_meta (line 140) | def _load_meta(self):
method _check_integrity (line 157) | def _check_integrity(self):
method extra_repr (line 172) | def extra_repr(self) -> List[str]:
FILE: mmagic/datasets/comp1k_dataset.py
class AdobeComp1kDataset (line 13) | class AdobeComp1kDataset(BaseDataset):
method load_data_list (line 75) | def load_data_list(self) -> List[dict]:
method parse_data_info (line 134) | def parse_data_info(self, raw_data_info: dict) -> Union[dict, List[dic...
FILE: mmagic/datasets/controlnet_dataset.py
class ControlNetDataset (line 12) | class ControlNetDataset(BaseDataset):
method __init__ (line 27) | def __init__(self,
method load_data_list (line 38) | def load_data_list(self) -> List[dict]:
FILE: mmagic/datasets/data_utils.py
function infer_io_backend (line 20) | def infer_io_backend(data_root: str) -> str:
function calculate_md5 (line 45) | def calculate_md5(fpath: str,
function check_md5 (line 70) | def check_md5(fpath, md5, **kwargs) -> bool:
function check_integrity (line 83) | def check_integrity(fpath, md5=None) -> bool:
function download_url_to_file (line 101) | def download_url_to_file(url, dst, hash_prefix=None, progress=True):
function download_url (line 168) | def download_url(url, root, filename=None, md5=None):
function _is_tarxz (line 205) | def _is_tarxz(filename):
function _is_tar (line 210) | def _is_tar(filename):
function _is_targz (line 215) | def _is_targz(filename):
function _is_tgz (line 220) | def _is_tgz(filename):
function _is_gzip (line 225) | def _is_gzip(filename):
function _is_zip (line 230) | def _is_zip(filename):
function extract_archive (line 235) | def extract_archive(from_path, to_path=None, remove_finished=False):
function download_and_extract_archive (line 265) | def download_and_extract_archive(url,
function open_maybe_compressed_file (line 285) | def open_maybe_compressed_file(path: str):
function expanduser (line 302) | def expanduser(path):
function find_folders (line 313) | def find_folders(root: str, file_backend: BaseStorageBackend
function get_samples (line 338) | def get_samples(root: str, folder_to_idx: Dict[str, int],
FILE: mmagic/datasets/dreambooth_dataset.py
class DreamBoothDataset (line 12) | class DreamBoothDataset(BaseDataset):
method __init__ (line 22) | def __init__(self,
method load_data_list (line 35) | def load_data_list(self) -> list:
FILE: mmagic/datasets/grow_scale_image_dataset.py
class GrowScaleImgDataset (line 12) | class GrowScaleImgDataset(BaseDataset):
method __init__ (line 62) | def __init__(self,
method load_data_list (line 107) | def load_data_list(self):
method update_annotations (line 125) | def update_annotations(self, curr_scale):
method concat_imgs_list_to (line 151) | def concat_imgs_list_to(self, num):
method prepare_train_data (line 166) | def prepare_train_data(self, idx):
method prepare_test_data (line 178) | def prepare_test_data(self, idx):
method __getitem__ (line 190) | def __getitem__(self, idx):
method __repr__ (line 211) | def __repr__(self):
FILE: mmagic/datasets/imagenet_dataset.py
class ImageNet (line 10) | class ImageNet(BasicConditionalDataset):
method __init__ (line 30) | def __init__(self,
FILE: mmagic/datasets/mscoco_dataset.py
class MSCoCoDataset (line 15) | class MSCoCoDataset(BasicConditionalDataset):
method __init__ (line 45) | def __init__(self,
method load_data_list (line 81) | def load_data_list(self):
FILE: mmagic/datasets/paired_image_dataset.py
class PairedImageDataset (line 15) | class PairedImageDataset(BaseDataset):
method __init__ (line 32) | def __init__(self,
method load_data_list (line 51) | def load_data_list(self):
method scan_folder (line 64) | def scan_folder(self, path):
FILE: mmagic/datasets/singan_dataset.py
function create_real_pyramid (line 11) | def create_real_pyramid(real, min_size, max_size, scale_factor_init):
class SinGANDataset (line 63) | class SinGANDataset(BaseDataset):
method __init__ (line 80) | def __init__(self,
method full_init (line 93) | def full_init(self):
method load_data_list (line 99) | def load_data_list(self, min_size, max_size, scale_factor_init):
method __getitem__ (line 119) | def __getitem__(self, index):
method __len__ (line 132) | def __len__(self):
FILE: mmagic/datasets/textual_inversion_dataset.py
class TextualInversionDataset (line 14) | class TextualInversionDataset(BaseDataset):
method __init__ (line 26) | def __init__(
method load_data_list (line 49) | def load_data_list(self) -> list:
method prepare_data (line 63) | def prepare_data(self, idx):
FILE: mmagic/datasets/transforms/albu_function.py
class PairedAlbuTransForms (line 11) | class PairedAlbuTransForms(BaseTransform):
method __init__ (line 17) | def __init__(self,
method transform (line 55) | def transform(self, results):
method __repr__ (line 71) | def __repr__(self):
class AlbuTransForms (line 84) | class AlbuTransForms(BaseTransform):
method __init__ (line 90) | def __init__(self,
method transform (line 125) | def transform(self, results):
method __repr__ (line 140) | def __repr__(self):
class PairedAlbuNormalize (line 152) | class PairedAlbuNormalize(BaseTransform):
method __init__ (line 158) | def __init__(self,
method transform (line 182) | def transform(self, results):
method __repr__ (line 202) | def __repr__(self):
class AlbuNormalize (line 216) | class AlbuNormalize(BaseTransform):
method __init__ (line 222) | def __init__(self,
method transform (line 243) | def transform(self, results):
method __repr__ (line 258) | def __repr__(self):
function _resolve_aug_fn (line 270) | def _resolve_aug_fn(name):
class AlbuCorruptFunction (line 293) | class AlbuCorruptFunction(BaseTransform):
method __init__ (line 299) | def __init__(self, keys: List[str], config: List[dict], p: float = 1.0):
method transform (line 312) | def transform(self, results):
method __repr__ (line 326) | def __repr__(self):
FILE: mmagic/datasets/transforms/albumentations.py
class Albumentations (line 20) | class Albumentations(BaseTransform):
method __init__ (line 70) | def __init__(self, keys: List[str], transforms: List[dict]) -> None:
method albu_builder (line 82) | def albu_builder(self, cfg: dict) -> albumentations:
method _apply_albu (line 115) | def _apply_albu(self, imgs):
method transform (line 130) | def transform(self, results):
method __repr__ (line 138) | def __repr__(self):
FILE: mmagic/datasets/transforms/alpha.py
class GenerateSeg (line 17) | class GenerateSeg(BaseTransform):
method __init__ (line 38) | def __init__(self,
method _crop_hole (line 53) | def _crop_hole(img, start_point, hole_size):
method transform (line 74) | def transform(self, results: dict) -> dict:
method __repr__ (line 113) | def __repr__(self):
class GenerateSoftSeg (line 125) | class GenerateSoftSeg(BaseTransform):
method __init__ (line 148) | def __init__(self,
method transform (line 187) | def transform(self, results: dict) -> dict:
method __repr__ (line 231) | def __repr__(self):
FILE: mmagic/datasets/transforms/aug_frames.py
class MirrorSequence (line 9) | class MirrorSequence(BaseTransform):
method __init__ (line 27) | def __init__(self, keys):
method transform (line 31) | def transform(self, results):
method __repr__ (line 51) | def __repr__(self):
class TemporalReverse (line 60) | class TemporalReverse(BaseTransform):
method __init__ (line 72) | def __init__(self, keys, reverse_ratio=0.5):
method transform (line 77) | def transform(self, results):
method __repr__ (line 97) | def __repr__(self):
FILE: mmagic/datasets/transforms/aug_pixel.py
class BinarizeImage (line 17) | class BinarizeImage(BaseTransform):
method __init__ (line 28) | def __init__(self, keys, binary_thr, a_min=0, a_max=1, dtype=np.uint8):
method _binarize (line 36) | def _binarize(self, img):
method transform (line 55) | def transform(self, results):
method __repr__ (line 71) | def __repr__(self):
class Clip (line 81) | class Clip(BaseTransform):
method __init__ (line 92) | def __init__(self, keys, a_min=0, a_max=255):
method _clip (line 98) | def _clip(self, input_):
method transform (line 120) | def transform(self, results):
method __repr__ (line 137) | def __repr__(self):
class ColorJitter (line 146) | class ColorJitter(BaseTransform):
method __init__ (line 189) | def __init__(self, keys, channel_order='rgb', **kwargs):
method _color_jitter (line 200) | def _color_jitter(self, image, this_seed):
method transform (line 224) | def transform(self, results: Dict) -> Dict:
method __repr__ (line 246) | def __repr__(self):
class RandomAffine (line 259) | class RandomAffine(BaseTransform):
method __init__ (line 298) | def __init__(self,
method _get_params (line 352) | def _get_params(degrees, translate, scale_ranges, shears, flip_ratio,
method _get_inverse_affine_matrix (line 389) | def _get_inverse_affine_matrix(center, angle, translate, scale, shear,
method transform (line 439) | def transform(self, results):
method __repr__ (line 475) | def __repr__(self):
class RandomMaskDilation (line 486) | class RandomMaskDilation(BaseTransform):
method __init__ (line 496) | def __init__(self, keys, binary_thr=0., kernel_min=9, kernel_max=49):
method _random_dilate (line 503) | def _random_dilate(self, img):
method transform (line 514) | def transform(self, results):
method __repr__ (line 533) | def __repr__(self):
class UnsharpMasking (line 543) | class UnsharpMasking(BaseTransform):
method __init__ (line 558) | def __init__(self, kernel_size, sigma, weight, threshold, keys):
method _unsharp_masking (line 573) | def _unsharp_masking(self, imgs):
method transform (line 596) | def transform(self, results):
method __repr__ (line 611) | def __repr__(self):
FILE: mmagic/datasets/transforms/aug_shape.py
class Flip (line 15) | class Flip(BaseTransform):
method __init__ (line 40) | def __init__(self, keys, flip_ratio=0.5, direction='horizontal'):
method transform (line 50) | def transform(self, results):
method __repr__ (line 83) | def __repr__(self):
class RandomRotation (line 93) | class RandomRotation(BaseTransform):
method __init__ (line 103) | def __init__(self, keys, degrees):
method transform (line 118) | def transform(self, results):
method __repr__ (line 139) | def __repr__(self):
class RandomTransposeHW (line 148) | class RandomTransposeHW(BaseTransform):
method __init__ (line 165) | def __init__(self, keys, transpose_ratio=0.5):
method transform (line 170) | def transform(self, results):
method __repr__ (line 194) | def __repr__(self):
class Resize (line 204) | class Resize(BaseTransform):
method __init__ (line 267) | def __init__(self,
method _resize (line 315) | def _resize(self, img):
method transform (line 350) | def transform(self, results: Dict) -> Dict:
method __repr__ (line 393) | def __repr__(self):
class NumpyPad (line 406) | class NumpyPad(BaseTransform):
method __init__ (line 429) | def __init__(self, keys, padding, **kwargs):
method transform (line 436) | def transform(self, results):
method __repr__ (line 451) | def __repr__(self) -> str:
FILE: mmagic/datasets/transforms/blur_kernels.py
function get_rotated_sigma_matrix (line 9) | def get_rotated_sigma_matrix(sig_x, sig_y, theta):
function _mesh_grid (line 28) | def _mesh_grid(kernel_size):
function calculate_gaussian_pdf (line 53) | def calculate_gaussian_pdf(sigma_matrix, grid):
function bivariate_gaussian (line 71) | def bivariate_gaussian(kernel_size,
function bivariate_generalized_gaussian (line 118) | def bivariate_generalized_gaussian(kernel_size,
function bivariate_plateau (line 168) | def bivariate_plateau(kernel_size,
function random_bivariate_gaussian_kernel (line 211) | def random_bivariate_gaussian_kernel(kernel_size,
function random_bivariate_generalized_gaussian_kernel (line 266) | def random_bivariate_generalized_gaussian_kernel(kernel_size,
function random_bivariate_plateau_kernel (line 334) | def random_bivariate_plateau_kernel(kernel_size,
function random_circular_lowpass_kernel (line 402) | def random_circular_lowpass_kernel(omega_range, kernel_size, pad_to=0):
function random_mixed_kernels (line 441) | def random_mixed_kernels(kernel_list,
FILE: mmagic/datasets/transforms/crop.py
class Crop (line 22) | class Crop(BaseTransform):
method __init__ (line 34) | def __init__(self, keys, crop_size, random_crop=True, is_pad_zeros=Fal...
method _crop (line 46) | def _crop(self, data):
method transform (line 109) | def transform(self, results):
method __repr__ (line 127) | def __repr__(self):
class CropLike (line 137) | class CropLike(BaseTransform):
method __init__ (line 147) | def __init__(self, target_key, reference_key=None):
method transform (line 153) | def transform(self, results):
method __repr__ (line 179) | def __repr__(self):
class FixedCrop (line 186) | class FixedCrop(BaseTransform):
method __init__ (line 197) | def __init__(self, keys, crop_size, crop_pos=None):
method _crop (line 213) | def _crop(self, data, x_offset, y_offset, crop_w, crop_h):
method transform (line 232) | def transform(self, results):
method __repr__ (line 286) | def __repr__(self):
class ModCrop (line 296) | class ModCrop(BaseTransform):
method __init__ (line 306) | def __init__(self, key='gt') -> None:
method transform (line 311) | def transform(self, results):
method __repr__ (line 334) | def __repr__(self):
class PairedRandomCrop (line 343) | class PairedRandomCrop(BaseTransform):
method __init__ (line 357) | def __init__(self, gt_patch_size, lq_key='img', gt_key='gt'):
method transform (line 363) | def transform(self, results):
method __repr__ (line 421) | def __repr__(self):
class RandomResizedCrop (line 432) | class RandomResizedCrop(BaseTransform):
method __init__ (line 458) | def __init__(self,
method get_params (line 485) | def get_params(self, data):
method transform (line 528) | def transform(self, results):
method __repr__ (line 552) | def __repr__(self):
class CropAroundCenter (line 563) | class CropAroundCenter(BaseTransform):
method __init__ (line 579) | def __init__(self, crop_size):
method transform (line 587) | def transform(self, results):
method __repr__ (line 657) | def __repr__(self):
class CropAroundFg (line 663) | class CropAroundFg(BaseTransform):
method __init__ (line 682) | def __init__(self, keys, bd_ratio_range=(0.1, 0.4), test_mode=False):
method transform (line 694) | def transform(self, results):
class CropAroundUnknown (line 737) | class CropAroundUnknown(BaseTransform):
method __init__ (line 760) | def __init__(self,
method transform (line 796) | def transform(self, results):
method __repr__ (line 842) | def __repr__(self):
class RandomCropLongEdge (line 853) | class RandomCropLongEdge(BaseTransform):
method __init__ (line 860) | def __init__(self, keys='img'):
method transform (line 866) | def transform(self, results):
method __repr__ (line 892) | def __repr__(self):
class CenterCropLongEdge (line 899) | class CenterCropLongEdge(BaseTransform):
method __init__ (line 906) | def __init__(self, keys='img'):
method transform (line 912) | def transform(self, results):
method __repr__ (line 939) | def __repr__(self):
class InstanceCrop (line 946) | class InstanceCrop(BaseTransform):
method __init__ (line 959) | def __init__(self,
method transform (line 983) | def transform(self, results: dict) -> dict:
method predict_bbox (line 1043) | def predict_bbox(self, image):
FILE: mmagic/datasets/transforms/fgbg.py
class CompositeFg (line 17) | class CompositeFg(BaseTransform):
method __init__ (line 45) | def __init__(self, fg_dirs, alpha_dirs, interpolation='nearest'):
method transform (line 57) | def transform(self, results: dict) -> dict:
method _get_file_list (line 96) | def _get_file_list(self, fg_dirs, alpha_dirs):
method __repr__ (line 115) | def __repr__(self):
class MergeFgAndBg (line 124) | class MergeFgAndBg(BaseTransform):
method transform (line 130) | def transform(self, results: dict) -> dict:
method __repr__ (line 147) | def __repr__(self) -> str:
class PerturbBg (line 153) | class PerturbBg(BaseTransform):
method __init__ (line 163) | def __init__(self, gamma_ratio=0.6):
method transform (line 169) | def transform(self, results: dict) -> dict:
method __repr__ (line 190) | def __repr__(self):
class RandomJitter (line 195) | class RandomJitter(BaseTransform):
method __init__ (line 209) | def __init__(self, hue_range=40):
method transform (line 220) | def transform(self, results):
method __repr__ (line 264) | def __repr__(self):
class RandomLoadResizeBg (line 270) | class RandomLoadResizeBg(BaseTransform):
method __init__ (line 283) | def __init__(self, bg_dir, flag='color', channel_order='bgr'):
method transform (line 293) | def transform(self, results: dict) -> dict:
method __repr__ (line 313) | def __repr__(self):
FILE: mmagic/datasets/transforms/formatting.py
class PackInputs (line 12) | class PackInputs(BaseTransform):
method __init__ (line 31) | def __init__(
method transform (line 51) | def transform(self, results: dict) -> dict:
method __repr__ (line 104) | def __repr__(self) -> str:
FILE: mmagic/datasets/transforms/generate_assistant.py
class GenerateCoordinateAndCell (line 17) | class GenerateCoordinateAndCell(BaseTransform):
method __init__ (line 54) | def __init__(self,
method transform (line 65) | def transform(self, results):
method __repr__ (line 117) | def __repr__(self):
class GenerateFacialHeatmap (line 128) | class GenerateFacialHeatmap(BaseTransform):
method __init__ (line 139) | def __init__(self,
method transform (line 168) | def transform(self, results):
method generate_heatmap_from_img (line 196) | def generate_heatmap_from_img(self, image):
method _face_alignment_detector (line 217) | def _face_alignment_detector(self, image):
method _generate_one_heatmap (line 239) | def _generate_one_heatmap(self, keypoint):
method __repr__ (line 260) | def __repr__(self):
FILE: mmagic/datasets/transforms/generate_frame_indices.py
class GenerateFrameIndices (line 12) | class GenerateFrameIndices(BaseTransform):
method __init__ (line 41) | def __init__(self, interval_list, frames_per_clip=99):
method transform (line 46) | def transform(self, results):
method __repr__ (line 93) | def __repr__(self):
class GenerateFrameIndiceswithPadding (line 103) | class GenerateFrameIndiceswithPadding(BaseTransform):
method __init__ (line 135) | def __init__(self, padding, filename_tmpl='{:08d}'):
method transform (line 145) | def transform(self, results):
method __repr__ (line 200) | def __repr__(self):
class GenerateSegmentIndices (line 208) | class GenerateSegmentIndices(BaseTransform):
method __init__ (line 239) | def __init__(self, interval_list, start_idx=0, filename_tmpl='{:08d}.p...
method transform (line 245) | def transform(self, results):
method __repr__ (line 295) | def __repr__(self):
FILE: mmagic/datasets/transforms/get_masked_image.py
class GetMaskedImage (line 11) | class GetMaskedImage(BaseTransform):
method __init__ (line 23) | def __init__(self,
method transform (line 33) | def transform(self, results):
method __repr__ (line 62) | def __repr__(self):
FILE: mmagic/datasets/transforms/loading.py
class LoadImageFromFile (line 16) | class LoadImageFromFile(BaseTransform):
method __init__ (line 48) | def __init__(
method transform (line 83) | def transform(self, results: dict) -> dict:
method _load_image (line 129) | def _load_image(self, filename):
method _convert (line 160) | def _convert(self, img: np.ndarray):
method __repr__ (line 187) | def __repr__(self):
class LoadMask (line 204) | class LoadMask(BaseTransform):
method __init__ (line 271) | def __init__(self, mask_mode='bbox', mask_config=None):
method _init_info (line 279) | def _init_info(self):
method _get_random_mask_from_set (line 301) | def _get_random_mask_from_set(self):
method _get_mask_from_file (line 317) | def _get_mask_from_file(self, path):
method transform (line 332) | def transform(self, results):
method __repr__ (line 361) | def __repr__(self):
class GetSpatialDiscountMask (line 366) | class GetSpatialDiscountMask(BaseTransform):
method __init__ (line 379) | def __init__(self, gamma=0.99, beta=1.5):
method spatial_discount_mask (line 383) | def spatial_discount_mask(self, mask_width, mask_height):
method transform (line 402) | def transform(self, results):
method __repr__ (line 426) | def __repr__(self):
class LoadPairedImageFromFile (line 432) | class LoadPairedImageFromFile(LoadImageFromFile):
method __init__ (line 474) | def __init__(self,
method transform (line 494) | def transform(self, results: dict) -> dict:
FILE: mmagic/datasets/transforms/matlab_like_resize.py
function get_size_from_scale (line 11) | def get_size_from_scale(input_size, scale_factor):
function get_scale_from_size (line 30) | def get_scale_from_size(input_size, output_size):
function _cubic (line 49) | def _cubic(x):
function get_weights_indices (line 73) | def get_weights_indices(input_length, output_length, scale, kernel,
function resize_along_dim (line 127) | def resize_along_dim(img_in, weights, indices, dim):
class MATLABLikeResize (line 169) | class MATLABLikeResize(BaseTransform):
method __init__ (line 193) | def __init__(self,
method _resize (line 216) | def _resize(self, img):
method transform (line 259) | def transform(self, results):
method __repr__ (line 285) | def __repr__(self):
FILE: mmagic/datasets/transforms/normalization.py
class Normalize (line 10) | class Normalize(BaseTransform):
method __init__ (line 26) | def __init__(self, keys, mean, std, to_rgb=False, save_original=False):
method transform (line 33) | def transform(self, results):
method __repr__ (line 63) | def __repr__(self):
class RescaleToZeroOne (line 72) | class RescaleToZeroOne(BaseTransform):
method __init__ (line 83) | def __init__(self, keys):
method transform (line 86) | def transform(self, results):
method __repr__ (line 105) | def __repr__(self):
FILE: mmagic/datasets/transforms/random_degradations.py
class RandomBlur (line 20) | class RandomBlur:
method __init__ (line 31) | def __init__(self, params, keys):
method get_kernel (line 35) | def get_kernel(self, num_kernels: int):
method _apply_random_blur (line 114) | def _apply_random_blur(self, imgs):
method __call__ (line 140) | def __call__(self, results):
method __repr__ (line 150) | def __repr__(self):
class RandomJPEGCompression (line 158) | class RandomJPEGCompression:
method __init__ (line 170) | def __init__(self, params, keys, color_type='color', bgr2rgb=False):
method _apply_random_compression (line 176) | def _apply_random_compression(self, imgs):
method __call__ (line 212) | def __call__(self, results):
method __repr__ (line 222) | def __repr__(self):
class RandomNoise (line 230) | class RandomNoise:
method __init__ (line 243) | def __init__(self, params, keys):
method _apply_gaussian_noise (line 247) | def _apply_gaussian_noise(self, imgs):
method _apply_poisson_noise (line 277) | def _apply_poisson_noise(self, imgs):
method _apply_random_noise (line 305) | def _apply_random_noise(self, imgs):
method __call__ (line 335) | def __call__(self, results):
method __repr__ (line 345) | def __repr__(self):
class RandomResize (line 353) | class RandomResize:
method __init__ (line 364) | def __init__(self, params, keys):
method _random_resize (line 374) | def _random_resize(self, imgs):
method __call__ (line 451) | def __call__(self, results):
method __repr__ (line 461) | def __repr__(self):
class RandomVideoCompression (line 469) | class RandomVideoCompression:
method __init__ (line 480) | def __init__(self, params, keys):
method _apply_random_compression (line 487) | def _apply_random_compression(self, imgs):
method __call__ (line 529) | def __call__(self, results):
method __repr__ (line 539) | def __repr__(self):
class DegradationsWithShuffle (line 556) | class DegradationsWithShuffle:
method __init__ (line 583) | def __init__(self, degradations, keys, shuffle_idx=None):
method _build_degradations (line 594) | def _build_degradations(self, degradations):
method __call__ (line 605) | def __call__(self, results):
method __repr__ (line 624) | def __repr__(self):
FILE: mmagic/datasets/transforms/random_down_sampling.py
class RandomDownSampling (line 13) | class RandomDownSampling(BaseTransform):
method __init__ (line 36) | def __init__(self,
method transform (line 50) | def transform(self, results):
method __repr__ (line 91) | def __repr__(self):
function resize_fn (line 102) | def resize_fn(img, size, interpolation='bicubic', backend='pillow'):
FILE: mmagic/datasets/transforms/trimap.py
class FormatTrimap (line 13) | class FormatTrimap(BaseTransform):
method __init__ (line 26) | def __init__(self, to_onehot=False):
method transform (line 29) | def transform(self, results):
method __repr__ (line 56) | def __repr__(self):
class GenerateTrimap (line 61) | class GenerateTrimap(BaseTransform):
method __init__ (line 82) | def __init__(self, kernel_size, iterations=1, random=True):
method transform (line 113) | def transform(self, results: dict) -> dict:
method __repr__ (line 148) | def __repr__(self):
class GenerateTrimapWithDistTransform (line 156) | class GenerateTrimapWithDistTransform(BaseTransform):
method __init__ (line 169) | def __init__(self, dist_thr=20, random=True):
method transform (line 176) | def transform(self, results: dict) -> dict:
method __repr__ (line 201) | def __repr__(self):
class TransformTrimap (line 208) | class TransformTrimap(BaseTransform):
method transform (line 223) | def transform(self, results: dict) -> dict:
method __repr__ (line 255) | def __repr__(self):
FILE: mmagic/datasets/transforms/values.py
class CopyValues (line 11) | class CopyValues(BaseTransform):
method __init__ (line 34) | def __init__(self, src_keys, dst_keys):
method transform (line 46) | def transform(self, results):
method __repr__ (line 62) | def __repr__(self):
class SetValues (line 72) | class SetValues(BaseTransform):
method __init__ (line 91) | def __init__(self, dictionary):
method transform (line 95) | def transform(self, results: Dict):
method __repr__ (line 111) | def __repr__(self):
FILE: mmagic/datasets/unpaired_image_dataset.py
class UnpairedImageDataset (line 16) | class UnpairedImageDataset(BaseDataset):
method __init__ (line 40) | def __init__(self,
method load_data_list (line 70) | def load_data_list(self):
method _load_domain_data_list (line 80) | def _load_domain_data_list(self, dataroot):
method get_data_info (line 97) | def get_data_info(self, idx) -> dict:
method __len__ (line 118) | def __len__(self):
method scan_folder (line 122) | def scan_folder(self, path):
FILE: mmagic/engine/hooks/ema.py
class ExponentialMovingAverageHook (line 18) | class ExponentialMovingAverageHook(Hook):
method __init__ (line 45) | def __init__(self,
method lerp (line 72) | def lerp(a, b, momentum=0.001, momentum_nontrainable=1., trainable=True):
method every_n_iters (line 103) | def every_n_iters(self, runner: Runner, n: int):
method after_train_iter (line 118) | def after_train_iter(self,
method before_run (line 154) | def before_run(self, runner: Runner):
FILE: mmagic/engine/hooks/iter_time_hook.py
class IterTimerHook (line 14) | class IterTimerHook(BaseIterTimerHook):
method _after_iter (line 23) | def _after_iter(self,
FILE: mmagic/engine/hooks/pggan_fetch_data_hook.py
class PGGANFetchDataHook (line 18) | class PGGANFetchDataHook(Hook):
method __init__ (line 26) | def __init__(self):
method before_train_iter (line 29) | def before_train_iter(self,
method update_dataloader (line 49) | def update_dataloader(self, dataloader: DataLoader,
FILE: mmagic/engine/hooks/pickle_data_hook.py
class PickleDataHook (line 22) | class PickleDataHook(Hook):
method __init__ (line 43) | def __init__(self,
method after_run (line 59) | def after_run(self, runner):
method before_run (line 69) | def before_run(self, runner):
method after_train_iter (line 79) | def after_train_iter(self,
method _pickle_data (line 98) | def _pickle_data(self, runner: Runner):
method _get_numpy_data (line 130) | def _get_numpy_data(
FILE: mmagic/engine/hooks/reduce_lr_scheduler_hook.py
class ReduceLRSchedulerHook (line 14) | class ReduceLRSchedulerHook(ParamSchedulerHook):
method __init__ (line 24) | def __init__(self,
method _calculate_average_value (line 38) | def _calculate_average_value(self):
method after_train_epoch (line 44) | def after_train_epoch(self, runner: Runner):
method after_train_iter (line 61) | def after_train_iter(self,
method after_val_epoch (line 98) | def after_val_epoch(self,
FILE: mmagic/engine/hooks/visualization_hook.py
class BasicVisualizationHook (line 23) | class BasicVisualizationHook(Hook):
method __init__ (line 34) | def __init__(self,
method _after_iter (line 46) | def _after_iter(
class VisualizationHook (line 82) | class VisualizationHook(Hook):
method __init__ (line 173) | def __init__(self,
method after_val_iter (line 216) | def after_val_iter(self, runner: Runner, batch_idx: int, data_batch: d...
method after_test_iter (line 231) | def after_test_iter(self, runner: Runner, batch_idx: int, data_batch: ...
method after_train_iter (line 276) | def after_train_iter(self,
method vis_sample (line 294) | def vis_sample(self,
method vis_from_message_hub (line 393) | def vis_from_message_hub(self, batch_idx: int):
FILE: mmagic/engine/optimizers/multi_optimizer_constructor.py
class MultiOptimWrapperConstructor (line 15) | class MultiOptimWrapperConstructor:
method __init__ (line 116) | def __init__(self, optim_wrapper_cfg: dict, paramwise_cfg=None):
method __call__ (line 143) | def __call__(self,
function get_params_by_names (line 215) | def get_params_by_names(module: nn.Module,
FILE: mmagic/engine/optimizers/pggan_optimizer_constructor.py
class PGGANOptimWrapperConstructor (line 13) | class PGGANOptimWrapperConstructor:
method __init__ (line 76) | def __init__(self,
method __call__ (line 98) | def __call__(self, module: nn.Module) -> OptimWrapperDict:
FILE: mmagic/engine/optimizers/singan_optimizer_constructor.py
class SinGANOptimWrapperConstructor (line 11) | class SinGANOptimWrapperConstructor:
method __init__ (line 56) | def __init__(self,
method __call__ (line 72) | def __call__(self, module: nn.Module) -> OptimWrapperDict:
FILE: mmagic/engine/runner/log_processor.py
class LogProcessor (line 8) | class LogProcessor(BaseLogProcessor):
method _get_dataloader_size (line 17) | def _get_dataloader_size(self, runner, mode) -> int:
FILE: mmagic/engine/runner/loop_utils.py
function update_and_check_evaluator (line 11) | def update_and_check_evaluator(evaluator: EVALUATOR_TYPE
function is_evaluator (line 51) | def is_evaluator(evaluator: Any) -> bool:
FILE: mmagic/engine/runner/multi_loops.py
class MultiValLoop (line 19) | class MultiValLoop(BaseLoop):
method __init__ (line 79) | def __init__(self,
method total_length (line 99) | def total_length(self) -> int:
method _build_dataloaders (line 109) | def _build_dataloaders(self,
method _build_evaluators (line 136) | def _build_evaluators(self, evaluator: EVALUATOR_TYPE) -> List[Evaluat...
method run (line 167) | def run(self):
method run_iter (line 251) | def run_iter(self, idx, data_batch: dict, metrics: Sequence[BaseMetric]):
class MultiTestLoop (line 274) | class MultiTestLoop(BaseLoop):
method __init__ (line 334) | def __init__(self, runner, dataloader, evaluator, fp16=False):
method total_length (line 350) | def total_length(self) -> int:
method _build_dataloaders (line 360) | def _build_dataloaders(self,
method _build_evaluators (line 387) | def _build_evaluators(self, evaluator: EVALUATOR_TYPE) -> List[Evaluat...
method run (line 418) | def run(self):
method run_iter (line 502) | def run_iter(self, idx, data_batch: dict, metrics: Sequence[BaseMetric]):
FILE: mmagic/engine/schedulers/linear_lr_scheduler_with_interval.py
class LinearLrInterval (line 9) | class LinearLrInterval(LinearLR):
method __init__ (line 23) | def __init__(self, *args, interval=1, **kwargs):
method _get_value (line 27) | def _get_value(self):
FILE: mmagic/engine/schedulers/reduce_lr_scheduler.py
class ReduceLR (line 9) | class ReduceLR(_ParamScheduler):
method __init__ (line 59) | def __init__(self,
method _get_value (line 103) | def _get_value(self):
method _init_is_better (line 138) | def _init_is_better(self, mode):
method _reset (line 144) | def _reset(self):
method is_better (line 149) | def is_better(self, a, best):
method in_cooldown (line 162) | def in_cooldown(self):
FILE: mmagic/evaluation/evaluator.py
class Evaluator (line 16) | class Evaluator(Evaluator):
method __init__ (line 46) | def __init__(self, metrics: Union[dict, BaseMetric, Sequence]):
method prepare_metrics (line 53) | def prepare_metrics(self, module: BaseModel, dataloader: DataLoader):
method _cal_metric_hash (line 83) | def _cal_metric_hash(metric: GenMetric):
method prepare_samplers (line 97) | def prepare_samplers(self, module: BaseModel, dataloader: DataLoader
method process (line 137) | def process(self, data_samples: Sequence[DataSample],
method evaluate (line 164) | def evaluate(self) -> dict:
FILE: mmagic/evaluation/functional/fid_inception.py
class InceptionV3 (line 19) | class InceptionV3(nn.Module):
method __init__ (line 34) | def __init__(self,
method forward (line 126) | def forward(self, inp):
function fid_inception_v3 (line 158) | def fid_inception_v3(load_ckpt=True):
class FIDInceptionA (line 186) | class FIDInceptionA(models.inception.InceptionA):
method __init__ (line 189) | def __init__(self, in_channels, pool_features):
method forward (line 192) | def forward(self, x):
class FIDInceptionC (line 220) | class FIDInceptionC(models.inception.InceptionC):
method __init__ (line 223) | def __init__(self, in_channels, channels_7x7):
method forward (line 226) | def forward(self, x):
class FIDInceptionE_1 (line 257) | class FIDInceptionE_1(models.inception.InceptionE):
method __init__ (line 260) | def __init__(self, in_channels):
method forward (line 263) | def forward(self, x):
class FIDInceptionE_2 (line 299) | class FIDInceptionE_2(models.inception.InceptionE):
method __init__ (line 302) | def __init__(self, in_channels):
method forward (line 305) | def forward(self, x):
FILE: mmagic/evaluation/functional/gaussian_funcs.py
function gaussian (line 6) | def gaussian(x, sigma):
function dgaussian (line 19) | def dgaussian(x, sigma):
function gauss_filter (line 32) | def gauss_filter(sigma, epsilon=1e-2):
function gauss_gradient (line 63) | def gauss_gradient(img, sigma):
FILE: mmagic/evaluation/functional/inception_utils.py
function disable_gpu_fuser_on_pt19 (line 32) | def disable_gpu_fuser_on_pt19():
function load_inception (line 48) | def load_inception(inception_args, metric):
function _load_inception_from_path (line 107) | def _load_inception_from_path(inception_path):
function _load_inception_from_url (line 129) | def _load_inception_from_url(inception_url: str) -> nn.Module:
function _load_inception_torch (line 143) | def _load_inception_torch(inception_args, metric) -> nn.Module:
function get_inception_feat_cache_name_and_args (line 162) | def get_inception_feat_cache_name_and_args(dataloader: DataLoader,
function get_vgg_feat_cache_name_and_args (line 229) | def get_vgg_feat_cache_name_and_args(dataloader: DataLoader,
function prepare_inception_feat (line 276) | def prepare_inception_feat(dataloader: DataLoader,
function prepare_vgg_feat (line 450) | def prepare_vgg_feat(dataloader: DataLoader,
FILE: mmagic/evaluation/metrics/base_gen_metric.py
class GenMetric (line 21) | class GenMetric(BaseMetric):
method __init__ (line 45) | def __init__(self,
method real_nums_per_device (line 64) | def real_nums_per_device(self):
method fake_nums_per_device (line 69) | def fake_nums_per_device(self):
method _collect_target_results (line 73) | def _collect_target_results(self, target: str) -> Optional[list]:
method evaluate (line 110) | def evaluate(self) -> dict:
method get_metric_sampler (line 145) | def get_metric_sampler(self, model: nn.Module, dataloader: DataLoader,
method compute_metrics (line 177) | def compute_metrics(self, results_fake, results_real) -> dict:
method prepare (line 188) | def prepare(self, module: nn.Module, dataloader: DataLoader) -> None:
class GenerativeMetric (line 201) | class GenerativeMetric(GenMetric):
method __init__ (line 235) | def __init__(self,
method get_metric_sampler (line 253) | def get_metric_sampler(self, model: nn.Module, dataloader: DataLoader,
method evaluate (line 330) | def evaluate(self) -> dict():
method compute_metrics (line 361) | def compute_metrics(self, results) -> dict:
FILE: mmagic/evaluation/metrics/base_sample_wise_metric.py
class BaseSampleWiseMetric (line 16) | class BaseSampleWiseMetric(BaseMetric):
method __init__ (line 45) | def __init__(self,
method compute_metrics (line 65) | def compute_metrics(self, results: List):
method process (line 80) | def process(self, data_batch: Sequence[dict],
method process_image (line 112) | def process_image(self, gt, pred, mask):
method evaluate (line 115) | def evaluate(self) -> dict:
method prepare (line 121) | def prepare(self, module: nn.Module, dataloader: DataLoader):
method get_metric_sampler (line 127) | def get_metric_sampler(self, model: nn.Module, dataloader: DataLoader,
FILE: mmagic/evaluation/metrics/connectivity_error.py
class ConnectivityError (line 18) | class ConnectivityError(BaseSampleWiseMetric):
method __init__ (line 45) | def __init__(
method prepare (line 55) | def prepare(self, module: nn.Module, dataloader: DataLoader):
method process (line 61) | def process(self, data_batch: Sequence[dict],
method compute_metrics (line 115) | def compute_metrics(self, results: List):
FILE: mmagic/evaluation/metrics/equivariance.py
class Equivariance (line 18) | class Equivariance(GenerativeMetric):
method __init__ (line 22) | def __init__(self,
method process (line 57) | def process(self, data_batch: dict, data_samples: Sequence[dict]) -> N...
method get_metric_sampler (line 78) | def get_metric_sampler(self, model: nn.Module, dataloader: DataLoader,
method compute_metrics (line 109) | def compute_metrics(self, results) -> dict:
method _collect_target_results (line 130) | def _collect_target_results(self, target: str) -> Optional[list]:
class eq_iterator (line 154) | class eq_iterator:
method __init__ (line 156) | def __init__(self, batch_size, max_length, sample_mode, eq_cfg,
method __iter__ (line 164) | def __iter__(self) -> Iterator:
method __len__ (line 168) | def __len__(self) -> int:
method __next__ (line 171) | def __next__(self) -> dict:
FILE: mmagic/evaluation/metrics/fid.py
class FrechetInceptionDistance (line 21) | class FrechetInceptionDistance(GenerativeMetric):
method __init__ (line 65) | def __init__(self,
method prepare (line 88) | def prepare(self, module: nn.Module, dataloader: DataLoader) -> None:
method _load_inception (line 104) | def _load_inception(self, inception_style: str,
method forward_inception (line 126) | def forward_inception(self, image: Tensor) -> Tensor:
method process (line 148) | def process(self, data_batch: dict, data_samples: Sequence[dict]) -> N...
method _calc_fid (line 189) | def _calc_fid(sample_mean: np.ndarray,
method compute_metrics (line 224) | def compute_metrics(self, fake_results: list) -> dict:
class TransFID (line 246) | class TransFID(FrechetInceptionDistance):
method __init__ (line 248) | def __init__(self,
method get_metric_sampler (line 267) | def get_metric_sampler(self, model: nn.Module, dataloader: DataLoader,
FILE: mmagic/evaluation/metrics/gradient_error.py
class GradientError (line 17) | class GradientError(BaseSampleWiseMetric):
method __init__ (line 44) | def __init__(
method prepare (line 54) | def prepare(self, module: nn.Module, dataloader: DataLoader):
method process (line 60) | def process(self, data_batch: Sequence[dict],
method compute_metrics (line 93) | def compute_metrics(self, results: List):
FILE: mmagic/evaluation/metrics/inception_score.py
class InceptionScore (line 22) | class InceptionScore(GenerativeMetric):
method __init__ (line 92) | def __init__(self,
method prepare (line 132) | def prepare(self, module: nn.Module, dataloader: DataLoader) -> None:
method _load_inception (line 143) | def _load_inception(self, inception_style: str,
method _preprocess (line 161) | def _preprocess(self, image: Tensor) -> Tensor:
method process (line 193) | def process(self, data_batch: dict, data_samples: Sequence[dict]) -> N...
method compute_metrics (line 232) | def compute_metrics(self, fake_results: list) -> dict:
class TransIS (line 262) | class TransIS(InceptionScore):
method __init__ (line 315) | def __init__(self,
method get_metric_sampler (line 334) | def get_metric_sampler(self, model: nn.Module, dataloader: DataLoader,
FILE: mmagic/evaluation/metrics/mae.py
class MAE (line 11) | class MAE(BaseSampleWiseMetric):
method process_image (line 36) | def process_image(self, gt, pred, mask):
FILE: mmagic/evaluation/metrics/matting_mse.py
class MattingMSE (line 14) | class MattingMSE(BaseSampleWiseMetric):
method __init__ (line 44) | def __init__(
method prepare (line 52) | def prepare(self, module: nn.Module, dataloader: DataLoader):
method process (line 58) | def process(self, data_batch: Sequence[dict],
method compute_metrics (line 79) | def compute_metrics(self, results: List):
FILE: mmagic/evaluation/metrics/metrics_utils.py
function _assert_ndim (line 9) | def _assert_ndim(input, name, ndim, shape_hint):
function _assert_masked (line 15) | def _assert_masked(pred_alpha, trimap):
function _fetch_data_and_check (line 22) | def _fetch_data_and_check(data_samples):
function average (line 53) | def average(results, key):
function img_transform (line 74) | def img_transform(img,
function obtain_data (line 129) | def obtain_data(data_sample, key, device='cpu'):
FILE: mmagic/evaluation/metrics/ms_ssim.py
function _f_special_gauss (line 14) | def _f_special_gauss(size, sigma):
function _hox_downsample (line 38) | def _hox_downsample(img):
function _ssim_for_multi_scale (line 53) | def _ssim_for_multi_scale(img1,
function ms_ssim (line 143) | def ms_ssim(img1,
class MultiScaleStructureSimilarity (line 229) | class MultiScaleStructureSimilarity(GenerativeMetric):
method __init__ (line 262) | def __init__(self,
method process (line 275) | def process(self, data_batch: dict, data_samples: Sequence[dict]) -> N...
method _collect_target_results (line 309) | def _collect_target_results(self, target: str) -> Optional[list]:
method compute_metrics (line 341) | def compute_metrics(self, results_fake: List):
FILE: mmagic/evaluation/metrics/mse.py
class MSE (line 9) | class MSE(BaseSampleWiseMetric):
method process_image (line 34) | def process_image(self, gt, pred, mask):
FILE: mmagic/evaluation/metrics/niqe.py
class NIQE (line 19) | class NIQE(BaseSampleWiseMetric):
method __init__ (line 57) | def __init__(self,
method process_image (line 79) | def process_image(self, gt, pred, mask) -> None:
function estimate_aggd_param (line 98) | def estimate_aggd_param(block):
function compute_feature (line 128) | def compute_feature(block):
function niqe_core (line 154) | def niqe_core(img,
function niqe (line 242) | def niqe(img, crop_border, input_order='HWC', convert_to='y'):
FILE: mmagic/evaluation/metrics/ppl.py
function slerp (line 16) | def slerp(a, b, percent):
class PerceptualPathLength (line 40) | class PerceptualPathLength(GenerativeMetric):
method __init__ (line 74) | def __init__(self,
method process (line 98) | def process(self, data_batch: dict, data_samples: Sequence[dict]) -> N...
method _compute_distance (line 127) | def _compute_distance(self, images):
method compute_metrics (line 155) | def compute_metrics(self, fake_results: list) -> dict:
method get_metric_sampler (line 169) | def get_metric_sampler(self, model: nn.Module, dataloader: DataLoader,
FILE: mmagic/evaluation/metrics/precision_and_recall.py
function compute_pr_distances (line 19) | def compute_pr_distances(row_features,
class PrecisionAndRecall (line 49) | class PrecisionAndRecall(GenerativeMetric):
method __init__ (line 104) | def __init__(self,
method _load_vgg (line 131) | def _load_vgg(self, vgg16_script: Optional[str]) -> Tuple[nn.Module, b...
method extract_features (line 154) | def extract_features(self, images: torch.Tensor) -> torch.Tensor:
method compute_metrics (line 177) | def compute_metrics(self, results_fake) -> dict:
method process (line 218) | def process(self, data_batch: dict, data_samples: Sequence[dict]) -> N...
method prepare (line 246) | def prepare(self, module: nn.Module, dataloader: DataLoader) -> None:
FILE: mmagic/evaluation/metrics/psnr.py
class PSNR (line 12) | class PSNR(BaseSampleWiseMetric):
method __init__ (line 43) | def __init__(self,
method process_image (line 62) | def process_image(self, gt, pred, mask):
function psnr (line 82) | def psnr(img1,
FILE: mmagic/evaluation/metrics/sad.py
class SAD (line 15) | class SAD(BaseSampleWiseMetric):
method __init__ (line 45) | def __init__(
method prepare (line 53) | def prepare(self, module: nn.Module, dataloader: DataLoader):
method process (line 59) | def process(self, data_batch: Sequence[dict],
method compute_metrics (line 79) | def compute_metrics(self, results: List):
FILE: mmagic/evaluation/metrics/snr.py
class SNR (line 12) | class SNR(BaseSampleWiseMetric):
method __init__ (line 43) | def __init__(self,
method process_image (line 62) | def process_image(self, gt, pred, mask):
function snr (line 82) | def snr(gt,
FILE: mmagic/evaluation/metrics/ssim.py
class SSIM (line 14) | class SSIM(BaseSampleWiseMetric):
method __init__ (line 52) | def __init__(self,
method process_image (line 71) | def process_image(self, gt, pred, mask):
function _ssim (line 91) | def _ssim(img1, img2):
function ssim (line 125) | def ssim(img1,
FILE: mmagic/evaluation/metrics/swd.py
function sliced_wasserstein (line 13) | def sliced_wasserstein(distribution_a,
function get_gaussian_kernel (line 54) | def get_gaussian_kernel():
function get_pyramid_layer (line 67) | def get_pyramid_layer(image, gaussian_k, direction='down'):
function gaussian_pyramid (line 93) | def gaussian_pyramid(original, n_pyramids, gaussian_k):
function laplacian_pyramid (line 113) | def laplacian_pyramid(original, n_pyramids, gaussian_k):
function get_descriptors_for_minibatch (line 140) | def get_descriptors_for_minibatch(minibatch, nhood_size, nhoods_per_image):
function finalize_descriptors (line 165) | def finalize_descriptors(desc):
class SlicedWassersteinDistance (line 187) | class SlicedWassersteinDistance(GenMetric):
method __init__ (line 219) | def __init__(self,
method process (line 248) | def process(self, data_batch: dict, data_samples: Sequence[dict]) -> N...
method _collect_target_results (line 315) | def _collect_target_results(self, target: str) -> Optional[list]:
method compute_metrics (line 345) | def compute_metrics(self, results_fake, results_real) -> dict:
FILE: mmagic/models/archs/__init__.py
function register_diffusers_models (line 31) | def register_diffusers_models() -> List[str]:
FILE: mmagic/models/archs/all_gather_layer.py
class AllGatherLayer (line 7) | class AllGatherLayer(autograd.Function):
method forward (line 16) | def forward(ctx, x):
method backward (line 24) | def backward(ctx, *grad_outputs):
FILE: mmagic/models/archs/aspp.py
class ASPPPooling (line 12) | class ASPPPooling(nn.Sequential):
method __init__ (line 28) | def __init__(self, in_channels: int, out_channels: int,
method forward (line 41) | def forward(self, x: Tensor) -> Tensor:
class ASPP (line 57) | class ASPP(nn.Module):
method __init__ (line 85) | def __init__(self,
method forward (line 138) | def forward(self, x: Tensor) -> Tensor:
FILE: mmagic/models/archs/attention_injection.py
function torch_dfs (line 12) | def torch_dfs(model: torch.nn.Module):
class AttentionInjection (line 19) | class AttentionInjection(nn.Module):
method __init__ (line 26) | def __init__(self, module: nn.Module, injection_weight=5):
method forward (line 122) | def forward(self,
FILE: mmagic/models/archs/downsample.py
function pixel_unshuffle (line 5) | def pixel_unshuffle(x: Tensor, scale: int) -> Tensor:
FILE: mmagic/models/archs/ensemble.py
class SpatialTemporalEnsemble (line 8) | class SpatialTemporalEnsemble(nn.Module):
method __init__ (line 18) | def __init__(self, is_temporal_ensemble: Optional[bool] = False):
method _transform (line 24) | def _transform(self, imgs: torch.Tensor, mode: str) -> torch.Tensor:
method spatial_ensemble (line 57) | def spatial_ensemble(self, imgs: torch.Tensor,
method forward (line 88) | def forward(self, imgs: torch.Tensor, model: nn.Module) -> torch.Tensor:
FILE: mmagic/models/archs/gated_conv_module.py
class SimpleGatedConvModule (line 10) | class SimpleGatedConvModule(nn.Module):
method __init__ (line 35) | def __init__(self,
method forward (line 58) | def forward(self, x: torch.Tensor) -> torch.Tensor:
FILE: mmagic/models/archs/img_normalize.py
class ImgNormalize (line 8) | class ImgNormalize(nn.Conv2d):
method __init__ (line 20) | def __init__(self,
FILE: mmagic/models/archs/linear_module.py
class LinearModule (line 10) | class LinearModule(nn.Module):
method __init__ (line 29) | def __init__(self,
method init_weights (line 68) | def init_weights(self) -> None:
method forward (line 79) | def forward(self, x: Tensor, activate: Optional[bool] = True) -> Tensor:
FILE: mmagic/models/archs/lora.py
class LoRALinear (line 10) | class LoRALinear(nn.Module):
method __init__ (line 19) | def __init__(self, in_feat: int, out_feat: int, rank: int = 4):
method forward (line 30) | def forward(self, x: Tensor) -> Tensor:
class LoRAWrapper (line 39) | class LoRAWrapper(nn.Module):
method __init__ (line 53) | def __init__(self,
method add_lora (line 104) | def add_lora(self,
method _set_value (line 145) | def _set_value(self,
method set_scale (line 174) | def set_scale(self, scale: float, name: Optional[str] = None):
method set_enable (line 183) | def set_enable(self, name: Optional[str] = None):
method set_disable (line 191) | def set_disable(self, name: Optional[str] = None):
method forward_lora_mapping (line 199) | def forward_lora_mapping(self, x: Tensor) -> Tensor:
method forward (line 222) | def forward(self, x: Tensor, *args, **kwargs) -> Tensor:
method wrap_lora (line 235) | def wrap_lora(cls, module, rank=4, scale=1, names=None, state_dict=None):
function replace_module (line 259) | def replace_module(parent_module: nn.Module, child_name: str,
function get_submodule (line 265) | def get_submodule(module: nn.Module, key: str):
function set_lora (line 273) | def set_lora(module: nn.Module,
function set_only_lora_trainable (line 349) | def set_only_lora_trainable(module: nn.Module) -> nn.Module:
function set_lora_enable (line 361) | def set_lora_enable(module: nn.Module) -> nn.Module:
function set_lora_disable (line 371) | def set_lora_disable(module: nn.Module) -> nn.Module:
FILE: mmagic/models/archs/multi_layer_disc.py
class MultiLayerDiscriminator (line 15) | class MultiLayerDiscriminator(nn.Module):
method __init__ (line 49) | def __init__(self,
method forward (line 134) | def forward(self, x: Tensor) -> Tensor:
method init_weights (line 155) | def init_weights(self, pretrained: Optional[str] = None) -> None:
FILE: mmagic/models/archs/patch_disc.py
class PatchDiscriminator (line 14) | class PatchDiscriminator(BaseModule):
method __init__ (line 31) | def __init__(self,
method forward (line 110) | def forward(self, x: Tensor) -> Tensor:
method init_weights (line 121) | def init_weights(self) -> None:
FILE: mmagic/models/archs/resnet.py
class BasicBlock (line 14) | class BasicBlock(nn.Module):
method __init__ (line 35) | def __init__(self,
method norm1 (line 71) | def norm1(self) -> nn.Module:
method norm2 (line 76) | def norm2(self) -> nn.Module:
method forward (line 80) | def forward(self, x: Tensor) -> Tensor:
class Bottleneck (line 110) | class Bottleneck(nn.Module):
method __init__ (line 131) | def __init__(self,
method norm1 (line 191) | def norm1(self) -> nn.Module:
method norm2 (line 196) | def norm2(self) -> nn.Module:
method norm3 (line 201) | def norm3(self) -> nn.Module:
method forward (line 205) | def forward(self, x: Tensor) -> Tensor:
class ResNet (line 228) | class ResNet(nn.Module):
method __init__ (line 274) | def __init__(self,
method _make_stem_layer (line 340) | def _make_stem_layer(self, in_channels: int, stem_channels: int) -> None:
method norm1 (line 390) | def norm1(self) -> nn.Module:
method _make_layer (line 394) | def _make_layer(self,
method _nostride_dilate (line 435) | def _nostride_dilate(self, m: nn.Module, dilate: int) -> None:
method init_weights (line 451) | def init_weights(self, pretrained: Optional[str] = None) -> None:
method _freeze_stages (line 477) | def _freeze_stages(self) -> None:
method forward (line 496) | def forward(self, x: Tensor) -> List[Tensor]:
FILE: mmagic/models/archs/separable_conv_module.py
class DepthwiseSeparableConvModule (line 9) | class DepthwiseSeparableConvModule(nn.Module):
method __init__ (line 44) | def __init__(self,
method forward (line 89) | def forward(self, x: Tensor) -> Tensor:
FILE: mmagic/models/archs/simple_encoder_decoder.py
class SimpleEncoderDecoder (line 11) | class SimpleEncoderDecoder(BaseModule):
method __init__ (line 20) | def __init__(self,
method forward (line 31) | def forward(self, *args, **kwargs) -> Tensor:
FILE: mmagic/models/archs/smpatch_disc.py
class SoftMaskPatchDiscriminator (line 14) | class SoftMaskPatchDiscriminator(BaseModule):
method __init__ (line 33) | def __init__(self,
method forward (line 109) | def forward(self, x: Tensor) -> Tensor:
method init_weights (line 120) | def init_weights(self) -> None:
FILE: mmagic/models/archs/sr_backbone.py
class ResidualBlockNoBN (line 41) | class ResidualBlockNoBN(nn.Module):
method __init__ (line 58) | def __init__(self, mid_channels: int = 64, res_scale: float = 1.0):
method init_weights (line 71) | def init_weights(self) -> None:
method forward (line 83) | def forward(self, x: Tensor) -> Tensor:
FILE: mmagic/models/archs/tokenizer.py
class TokenizerWrapper (line 14) | class TokenizerWrapper:
method __init__ (line 34) | def __init__(self,
method __getattr__ (line 62) | def __getattr__(self, name: str) -> Any:
method try_adding_tokens (line 77) | def try_adding_tokens(self, tokens: Union[str, List[str]], *args,
method get_token_info (line 90) | def get_token_info(self, token: str) -> dict:
method add_placeholder_token (line 105) | def add_placeholder_token(self,
method replace_placeholder_tokens_in_text (line 137) | def replace_placeholder_tokens_in_text(self,
method replace_text_with_placeholder_tokens (line 173) | def replace_text_with_placeholder_tokens(self, text: Union[str, List[s...
method __call__ (line 197) | def __call__(self,
method encode (line 220) | def encode(self, text: Union[str, List[str]], *args, **kwargs):
method decode (line 230) | def decode(self,
method __repr__ (line 252) | def __repr__(self):
FILE: mmagic/models/archs/upsample.py
class PixelShufflePack (line 9) | class PixelShufflePack(nn.Module):
method __init__ (line 22) | def __init__(self, in_channels: int, out_channels: int, scale_factor: ...
method init_weights (line 36) | def init_weights(self) -> None:
method forward (line 40) | def forward(self, x: Tensor) -> Tensor:
FILE: mmagic/models/archs/vgg.py
class VGG16 (line 14) | class VGG16(BaseModule):
method __init__ (line 31) | def __init__(self,
method _make_layer (line 59) | def _make_layer(self, inplanes: int, planes: int,
method init_weights (line 73) | def init_weights(self) -> None:
method forward (line 85) | def forward(self, x: Tensor) -> Dict[str, Tensor]:
FILE: mmagic/models/archs/wrapper.py
class DiffusersWrapper (line 20) | class DiffusersWrapper(BaseModule):
method __init__ (line 72) | def __init__(self,
method init_weights (line 112) | def init_weights(self):
method __getattr__ (line 126) | def __getattr__(self, name: str) -> Any:
method __repr__ (line 158) | def __repr__(self):
method forward (line 170) | def forward(self, *args, **kwargs) -> Any:
method to (line 181) | def to(
FILE: mmagic/models/base_models/average_model.py
class ExponentialMovingAverage (line 19) | class ExponentialMovingAverage(BaseAveragedModel):
method __init__ (line 43) | def __init__(self,
method avg_func (line 60) | def avg_func(self, averaged_param: Tensor, source_param: Tensor,
method _load_from_state_dict (line 74) | def _load_from_state_dict(self, state_dict: dict, prefix: str,
method sync_buffers (line 131) | def sync_buffers(self, model: nn.Module) -> None:
method sync_parameters (line 148) | def sync_parameters(self, model: nn.Module) -> None:
class RampUpEMA (line 163) | class RampUpEMA(BaseAveragedModel):
method __init__ (line 183) | def __init__(self,
method rampup (line 202) | def rampup(steps, ema_kimg=10, ema_rampup=0.05, batch_size=4, eps=1e-8):
method avg_func (line 228) | def avg_func(self, averaged_param: Tensor, source_param: Tensor,
method _load_from_state_dict (line 246) | def _load_from_state_dict(self, state_dict: dict, prefix: str,
method sync_buffers (line 303) | def sync_buffers(self, model: nn.Module) -> None:
method sync_parameters (line 320) | def sync_parameters(self, model: nn.Module) -> None:
FILE: mmagic/models/base_models/base_conditional_gan.py
class BaseConditionalGAN (line 19) | class BaseConditionalGAN(BaseGAN):
method __init__ (line 40) | def __init__(self,
method label_fn (line 57) | def label_fn(self, label: LabelVar = None, num_batches: int = 1) -> Te...
method data_sample_to_label (line 88) | def data_sample_to_label(self, data_sample: DataSample
method _get_valid_num_classes (line 107) | def _get_valid_num_classes(num_classes: Optional[int],
method forward (line 153) | def forward(self,
method train_generator (line 234) | def train_generator(self, inputs: dict, data_samples: List[DataSample],
method train_discriminator (line 271) | def train_discriminator(self, inputs: dict, data_samples: List[DataSam...
FILE: mmagic/models/base_models/base_edit_model.py
class BaseEditModel (line 12) | class BaseEditModel(BaseModel):
method __init__ (line 35) | def __init__(self,
method forward (line 54) | def forward(self,
method convert_to_datasample (line 121) | def convert_to_datasample(self, predictions: DataSample,
method forward_tensor (line 151) | def forward_tensor(self,
method forward_inference (line 171) | def forward_inference(self,
method forward_train (line 196) | def forward_train(self,
FILE: mmagic/models/base_models/base_gan.py
class BaseGAN (line 22) | class BaseGAN(BaseModel, metaclass=ABCMeta):
method __init__ (line 39) | def __init__(self,
method gather_log_vars (line 94) | def gather_log_vars(log_vars_list: List[Dict[str, Tensor]]
method _init_loss (line 118) | def _init_loss(self, loss_config: Optional[Dict] = None) -> None:
method noise_fn (line 202) | def noise_fn(self, noise: NoiseVar = None, num_batches: int = 1):
method generator_steps (line 232) | def generator_steps(self) -> int:
method discriminator_steps (line 238) | def discriminator_steps(self) -> int:
method device (line 244) | def device(self) -> torch.device:
method with_ema_gen (line 253) | def with_ema_gen(self) -> bool:
method _init_ema_model (line 262) | def _init_ema_model(self, ema_config: dict):
method _get_valid_model (line 277) | def _get_valid_model(self, batch_inputs: ForwardInputs) -> str:
method forward (line 315) | def forward(self,
method val_step (line 412) | def val_step(self, data: dict) -> SampleList:
method test_step (line 430) | def test_step(self, data: dict) -> SampleList:
method train_step (line 444) | def train_step(self, data: dict,
method _get_gen_loss (line 520) | def _get_gen_loss(self, out_dict):
method _get_disc_loss (line 543) | def _get_disc_loss(self, out_dict):
method train_generator (line 572) | def train_generator(self, inputs: dict, data_samples: List[DataSample],
method train_discriminator (line 605) | def train_discriminator(self, inputs: dict, data_samples: List[DataSam...
FILE: mmagic/models/base_models/base_mattor.py
function _pad (line 18) | def _pad(batch_image: torch.Tensor,
function _interpolate (line 38) | def _interpolate(batch_image: torch.Tensor,
class BaseMattor (line 56) | class BaseMattor(BaseModel, metaclass=ABCMeta):
method __init__ (line 87) | def __init__(self,
method resize_inputs (line 105) | def resize_inputs(self, batch_inputs: torch.Tensor) -> torch.Tensor:
method restore_size (line 129) | def restore_size(self, pred_alpha: torch.Tensor,
method postprocess (line 159) | def postprocess(
method forward (line 212) | def forward(self,
method convert_to_datasample (line 256) | def convert_to_datasample(self, predictions: List[DataSample],
FILE: mmagic/models/base_models/base_translation_model.py
class BaseTranslationModel (line 14) | class BaseTranslationModel(BaseModel, metaclass=ABCMeta):
method __init__ (line 47) | def __init__(self,
method init_weights (line 87) | def init_weights(self):
method get_module (line 125) | def get_module(self, module):
method forward (line 141) | def forward(self, img, test_mode=False, **kwargs):
method forward_train (line 154) | def forward_train(self, img, target_domain, **kwargs):
method forward_test (line 169) | def forward_test(self, img, target_domain, **kwargs):
method is_domain_reachable (line 184) | def is_domain_reachable(self, domain):
method get_other_domains (line 188) | def get_other_domains(self, domain):
method _get_target_generator (line 192) | def _get_target_generator(self, domain):
method _get_target_discriminator (line 201) | def _get_target_discriminator(self, domain):
method translation (line 210) | def translation(self, image, target_domain=None, **kwargs):
FILE: mmagic/models/base_models/basic_interpolator.py
class BasicInterpolator (line 14) | class BasicInterpolator(BaseEditModel):
method __init__ (line 39) | def __init__(self,
method split_frames (line 62) | def split_frames(self, input_tensors: torch.Tensor) -> torch.Tensor:
method merge_frames (line 85) | def merge_frames(input_tensors: torch.Tensor,
FILE: mmagic/models/base_models/one_stage.py
class OneStageInpaintor (line 19) | class OneStageInpaintor(BaseModel):
method __init__ (line 51) | def __init__(self,
method forward (line 107) | def forward(self,
method train_step (line 156) | def train_step(self, data: List[dict],
method forward_train (line 256) | def forward_train(self, *args, **kwargs) -> None:
method forward_train_d (line 265) | def forward_train_d(self, data_batch: torch.Tensor, is_real: bool,
method generator_loss (line 298) | def generator_loss(self, fake_res: torch.Tensor, fake_img: torch.Tensor,
method forward_tensor (line 364) | def forward_tensor(self, inputs: torch.Tensor, data_samples: SampleList
method forward_test (line 385) | def forward_test(self, inputs: torch.Tensor,
method convert_to_datasample (line 409) | def convert_to_datasample(self, predictions: DataSample,
method forward_dummy (line 437) | def forward_dummy(self, x: torch.Tensor) -> torch.Tensor:
FILE: mmagic/models/base_models/two_stage.py
class TwoStageInpaintor (line 15) | class TwoStageInpaintor(OneStageInpaintor):
method __init__ (line 55) | def __init__(
method forward_tensor (line 100) | def forward_tensor(self, inputs: torch.Tensor, data_samples: SampleList
method two_stage_loss (line 123) | def two_stage_loss(self, stage1_data: dict, stage2_data: dict,
method calculate_loss_with_type (line 172) | def calculate_loss_with_type(self,
method train_step (line 222) | def train_step(self, data: List[dict],
FILE: mmagic/models/data_preprocessors/data_preprocessor.py
class DataPreprocessor (line 21) | class DataPreprocessor(ImgDataPreprocessor):
method __init__ (line 74) | def __init__(self,
method cast_data (line 128) | def cast_data(self, data: CastData) -> CastData:
method _parse_channel_index (line 142) | def _parse_channel_index(inputs) -> int:
method _parse_channel_order (line 161) | def _parse_channel_order(self,
method _parse_batch_channel_order (line 213) | def _parse_batch_channel_order(self, key: str, inputs: Sequence,
method _update_metainfo (line 233) | def _update_metainfo(self,
method _do_conversion (line 284) | def _do_conversion(self,
method _do_norm (line 329) | def _do_norm(self,
method _preprocess_image_tensor (line 358) | def _preprocess_image_tensor(self,
method _preprocess_image_list (line 407) | def _preprocess_image_list(self,
method _preprocess_dict_inputs (line 479) | def _preprocess_dict_inputs(self,
method _preprocess_data_sample (line 549) | def _preprocess_data_sample(self, data_samples: SampleList,
method forward (line 606) | def forward(self, data: dict, training: bool = False) -> dict:
method destruct (line 656) | def destruct(self,
method _destruct_norm_and_conversion (line 701) | def _destruct_norm_and_conversion(self, batch_tensor: Tensor,
method _destruct_padding (line 746) | def _destruct_padding(self,
FILE: mmagic/models/data_preprocessors/mattor_preprocessor.py
class MattorPreprocessor (line 21) | class MattorPreprocessor(DataPreprocessor):
method __init__ (line 50) | def __init__(self,
method _proc_batch_trimap (line 68) | def _proc_batch_trimap(self, batch_trimaps: torch.Tensor):
method _preprocess_data_sample (line 80) | def _preprocess_data_sample(self, data_samples: SampleList,
method forward (line 137) | def forward(self,
FILE: mmagic/models/diffusion_schedulers/__init__.py
class SchedulerWrapper (line 10) | class SchedulerWrapper:
method __init__ (line 43) | def __init__(self,
method __getattr__ (line 62) | def __getattr__(self, name: str) -> Any:
method __repr__ (line 80) | def __repr__(self):
function register_diffusers_schedulers (line 93) | def register_diffusers_schedulers() -> List[str]:
FILE: mmagic/models/diffusion_schedulers/ddim_scheduler.py
class EditDDIMScheduler (line 12) | class EditDDIMScheduler:
method __init__ (line 30) | def __init__(
method set_timesteps (line 87) | def set_timesteps(self, num_inference_steps, offset=0):
method scale_model_input (line 96) | def scale_model_input(self,
method _get_variance (line 112) | def _get_variance(self, timestep, prev_timestep):
method step (line 124) | def step(
method add_noise (line 248) | def add_noise(self, original_samples, noise, timesteps):
method __len__ (line 258) | def __len__(self):
FILE: mmagic/models/diffusion_schedulers/ddpm_scheduler.py
class EditDDPMScheduler (line 12) | class EditDDPMScheduler:
method __init__ (line 14) | def __init__(self,
method set_timesteps (line 80) | def set_timesteps(self, num_inference_steps):
method _get_variance (line 90) | def _get_variance(self, t, predicted_variance=None, variance_type=None):
method step (line 132) | def step(self,
method add_noise (line 214) | def add_noise(self, original_samples, noise, timesteps):
method training_loss (line 224) | def training_loss(self, model, x_0, t):
method sample_timestep (line 229) | def sample_timestep(self):
method __len__ (line 232) | def __len__(self):
FILE: mmagic/models/editors/animatediff/animatediff.py
class AnimateDiff (line 31) | class AnimateDiff(BaseModel):
method __init__ (line 76) | def __init__(
method set_xformers (line 143) | def set_xformers(self, module: Optional[nn.Module] = None) -> nn.Module:
method set_tomesd (line 155) | def set_tomesd(self) -> nn.Module:
method device (line 165) | def device(self):
method init_motion_module (line 169) | def init_motion_module(self, motion_module_cfg):
method init_dreambooth_lora (line 181) | def init_dreambooth_lora(self, dream_booth_lora_cfg):
method _encode_prompt (line 204) | def _encode_prompt(self, prompt, device, num_videos_per_prompt,
method decode_latents (line 308) | def decode_latents(self, latents):
method prepare_extra_step_kwargs (line 326) | def prepare_extra_step_kwargs(self, generator, eta):
method check_inputs (line 350) | def check_inputs(self, prompt, height, width):
method convert_lora (line 373) | def convert_lora(self,
method prepare_latents (line 464) | def prepare_latents(self,
method prepare_model (line 515) | def prepare_model(self):
method set_lora (line 535) | def set_lora(self):
method val_step (line 541) | def val_step(self, data: dict) -> SampleList:
method test_step (line 571) | def test_step(self, data: dict) -> SampleList:
method infer (line 600) | def infer(self,
method forward (line 768) | def forward(self,
FILE: mmagic/models/editors/animatediff/animatediff_utils.py
function shave_segments (line 18) | def shave_segments(path, n_shave_prefix_segments=1):
function renew_resnet_paths (line 29) | def renew_resnet_paths(old_list, n_shave_prefix_segments=0):
function renew_vae_resnet_paths (line 51) | def renew_vae_resnet_paths(old_list, n_shave_prefix_segments=0):
function renew_attention_paths (line 67) | def renew_attention_paths(old_list, n_shave_prefix_segments=0):
function renew_vae_attention_paths (line 79) | def renew_vae_attention_paths(old_list, n_shave_prefix_segments=0):
function assign_to_checkpoint (line 109) | def assign_to_checkpoint(paths,
function conv_attn_to_linear (line 168) | def conv_attn_to_linear(checkpoint):
function create_unet_diffusers_config (line 180) | def create_unet_diffusers_config(original_config,
function create_vae_diffusers_config (line 269) | def create_vae_diffusers_config(original_config, image_size: int):
function convert_ldm_unet_checkpoint (line 293) | def convert_ldm_unet_checkpoint(checkpoint,
function convert_ldm_vae_checkpoint (line 611) | def convert_ldm_vae_checkpoint(checkpoint, config):
function convert_ldm_clip_checkpoint (line 815) | def convert_ldm_clip_checkpoint(checkpoint):
function convert_paint_by_example_checkpoint (line 867) | def convert_paint_by_example_checkpoint(checkpoint):
function convert_open_clip_checkpoint (line 934) | def convert_open_clip_checkpoint(checkpoint):
function stable_unclip_image_encoder (line 994) | def stable_unclip_image_encoder(original_config):
function stable_unclip_image_noising_components (line 1031) | def stable_unclip_image_noising_components(
function save_videos_grid (line 1083) | def save_videos_grid(videos: torch.Tensor,
FILE: mmagic/models/editors/animatediff/attention_3d.py
class Transformer3DModelOutput (line 22) | class Transformer3DModelOutput(BaseOutput):
class Transformer3DModel (line 38) | class Transformer3DModel(ModelMixin, ConfigMixin):
method __init__ (line 102) | def __init__(
method forward (line 165) | def forward(self,
class BasicTransformerBlock (line 252) | class BasicTransformerBlock(nn.Module):
method __init__ (line 278) | def __init__(
method forward (line 371) | def forward(self,
class CrossAttention (line 422) | class CrossAttention(nn.Module):
method __init__ (line 442) | def __init__(
method reshape_heads_to_batch_dim (line 497) | def reshape_heads_to_batch_dim(self, tensor):
method reshape_batch_dim_to_heads (line 506) | def reshape_batch_dim_to_heads(self, tensor):
method set_attention_slice (line 515) | def set_attention_slice(self, slice_size):
method forward (line 522) | def forward(self,
method _attention (line 606) | def _attention(self, query, key, value, attention_mask=None):
method _sliced_attention (line 642) | def _sliced_attention(self, query, key, value, sequence_length, dim,
method _memory_efficient_attention_xformers (line 693) | def _memory_efficient_attention_xformers(self, query, key, value,
FILE: mmagic/models/editors/animatediff/motion_module.py
function zero_module (line 19) | def zero_module(module):
class TemporalTransformer3DModelOutput (line 27) | class TemporalTransformer3DModelOutput(BaseOutput):
function get_motion_module (line 39) | def get_motion_module(in_channels, motion_module_type: str,
class VanillaTemporalModule (line 51) | class VanillaTemporalModule(nn.Module):
method __init__ (line 54) | def __init__(
method forward (line 84) | def forward(self,
class TemporalTransformer3DModel (line 100) | class TemporalTransformer3DModel(nn.Module):
method __init__ (line 103) | def __init__(
method forward (line 153) | def forward(self,
class TemporalTransformerBlock (line 194) | class TemporalTransformerBlock(nn.Module):
method __init__ (line 197) | def __init__(
method forward (line 246) | def forward(self,
class PositionalEncoding (line 268) | class PositionalEncoding(nn.Module):
method __init__ (line 271) | def __init__(self, d_model, dropout=0., max_len=24):
method forward (line 282) | def forward(self, x):
class VersatileAttention (line 288) | class VersatileAttention(CrossAttention):
method __init__ (line 291) | def __init__(self,
method extra_repr (line 313) | def extra_repr(self):
method reshape_heads_to_batch_dim (line 318) | def reshape_heads_to_batch_dim(self, tensor):
method reshape_batch_dim_to_heads (line 328) | def reshape_batch_dim_to_heads(self, tensor):
method _memory_efficient_attention_xformers (line 338) | def _memory_efficient_attention_xformers(self, query, key, value,
method forward (line 350) | def forward(self,
class FeedForward (line 432) | class FeedForward(nn.Module):
method __init__ (line 448) | def __init__(
method forward (line 475) | def forward(self, hidden_states):
class GELU (line 481) | class GELU(nn.Module):
method __init__ (line 486) | def __init__(self, dim_in: int, dim_out: int):
method gelu (line 490) | def gelu(self, gate):
method forward (line 496) | def forward(self, hidden_states):
FILE: mmagic/models/editors/animatediff/resnet_3d.py
class InflatedConv3d (line 11) | class InflatedConv3d(nn.Conv2d):
method forward (line 14) | def forward(self, x):
class InflatedGroupNorm (line 25) | class InflatedGroupNorm(nn.GroupNorm):
method forward (line 27) | def forward(self, x):
class Upsample3D (line 37) | class Upsample3D(nn.Module):
method __init__ (line 47) | def __init__(self,
method forward (line 66) | def forward(self, hidden_states, output_size=None):
class Downsample3D (line 107) | class Downsample3D(nn.Module):
method __init__ (line 117) | def __init__(self,
method forward (line 141) | def forward(self, hidden_states):
class ResnetBlock3D (line 153) | class ResnetBlock3D(nn.Module):
method __init__ (line 172) | def __init__(
method forward (line 265) | def forward(self, input_tensor, temb):
class Mish (line 301) | class Mish(torch.nn.Module):
method forward (line 304) | def forward(self, hidden_states):
FILE: mmagic/models/editors/animatediff/unet_3d.py
class UNet3DConditionOutput (line 32) | class UNet3DConditionOutput(BaseOutput):
class UNet3DConditionMotionModel (line 38) | class UNet3DConditionMotionModel(ModelMixin, ConfigMixin):
method __init__ (line 43) | def __init__(
method init_weights (line 269) | def init_weights(self, subfolder=None, from_pretrained=None):
method set_attention_slice (line 325) | def set_attention_slice(self, slice_size):
method _set_gradient_checkpointing (line 403) | def _set_gradient_checkpointing(self, module, value=False):
method forward (line 409) | def forward(
method from_pretrained_2d (line 578) | def from_pretrained_2d(cls,
FILE: mmagic/models/editors/animatediff/unet_block.py
function get_down_block (line 13) | def get_down_block(
function get_up_block (line 90) | def get_up_block(
class UNetMidBlock3DCrossAttn (line 167) | class UNetMidBlock3DCrossAttn(nn.Module):
method __init__ (line 170) | def __init__(
method forward (line 262) | def forward(self,
class CrossAttnDownBlock3D (line 286) | class CrossAttnDownBlock3D(nn.Module):
method __init__ (line 289) | def __init__(
method forward (line 383) | def forward(self,
class DownBlock3D (line 443) | class DownBlock3D(nn.Module):
method __init__ (line 446) | def __init__(
method forward (line 510) | def forward(self, hidden_states, temb=None, encoder_hidden_states=None):
class CrossAttnUpBlock3D (line 553) | class CrossAttnUpBlock3D(nn.Module):
method __init__ (line 556) | def __init__(
method forward (line 650) | def forward(
class UpBlock3D (line 714) | class UpBlock3D(nn.Module):
method __init__ (line 717) | def __init__(
method forward (line 781) | def forward(
FILE: mmagic/models/editors/aotgan/aot_decoder.py
class AOTDecoder (line 11) | class AOTDecoder(BaseModule):
method __init__ (line 28) | def __init__(self,
method forward (line 60) | def forward(self, x):
FILE: mmagic/models/editors/aotgan/aot_encoder.py
class AOTEncoder (line 10) | class AOTEncoder(BaseModule):
method __init__ (line 27) | def __init__(self,
method forward (line 56) | def forward(self, x):
FILE: mmagic/models/editors/aotgan/aot_encoder_decoder.py
class AOTEncoderDecoder (line 8) | class AOTEncoderDecoder(GLEncoderDecoder):
method __init__ (line 22) | def __init__(self,
FILE: mmagic/models/editors/aotgan/aot_inpaintor.py
class AOTInpaintor (line 12) | class AOTInpaintor(OneStageInpaintor):
method forward_train_d (line 19) | def forward_train_d(self, data_batch, is_real, is_disc, mask):
method generator_loss (line 53) | def generator_loss(self, fake_res, fake_img, gt, mask, masked_img):
method forward_tensor (line 101) | def forward_tensor(self, inputs, data_samples):
method train_step (line 123) | def train_step(self, data: List[dict], optim_wrapper):
FILE: mmagic/models/editors/aotgan/aot_neck.py
class AOTBlockNeck (line 11) | class AOTBlockNeck(BaseModule):
method __init__ (line 28) | def __init__(self,
method forward (line 44) | def forward(self, x):
class AOTBlock (line 49) | class AOTBlock(BaseModule):
method __init__ (line 72) | def __init__(self,
method normalize (line 98) | def normalize(self, x):
method forward (line 105) | def forward(self, x):
FILE: mmagic/models/editors/arcface/arcface_modules.py
class Flatten (line 15) | class Flatten(Module):
method forward (line 18) | def forward(self, input):
function l2_norm (line 22) | def l2_norm(input, axis=1):
class Bottleneck (line 38) | class Bottleneck(namedtuple('Block', ['in_channel', 'depth', 'stride'])):
function get_block (line 42) | def get_block(in_channel, depth, num_units, stride=2):
function get_blocks (line 58) | def get_blocks(num_layers):
class SEModule (line 98) | class SEModule(Module):
method __init__ (line 106) | def __init__(self, channels, reduction):
method forward (line 124) | def forward(self, x):
class bottleneck_IR (line 135) | class bottleneck_IR(Module):
method __init__ (line 144) | def __init__(self, in_channel, depth, stride):
method forward (line 165) | def forward(self, x):
class bottleneck_IR_SE (line 172) | class bottleneck_IR_SE(Module):
method __init__ (line 181) | def __init__(self, in_channel, depth, stride):
method forward (line 195) | def forward(self, x):
FILE: mmagic/models/editors/arcface/id_loss.py
class IDLossModel (line 11) | class IDLossModel(nn.Module):
method __init__ (line 21) | def __init__(self, ir_se50_weights=None):
method extract_feats (line 35) | def extract_feats(self, x):
method forward (line 51) | def forward(self, pred=None, gt=None):
FILE: mmagic/models/editors/arcface/model_irse.py
class Backbone (line 15) | class Backbone(Module):
method __init__ (line 31) | def __init__(self,
method forward (line 67) | def forward(self, x):
function IR_50 (line 75) | def IR_50(input_size):
function IR_101 (line 82) | def IR_101(input_size):
function IR_152 (line 89) | def IR_152(input_size):
function IR_SE_50 (line 96) | def IR_SE_50(input_size):
function IR_SE_101 (line 103) | def IR_SE_101(input_size):
function IR_SE_152 (line 110) | def IR_SE_152(input_size):
FILE: mmagic/models/editors/basicvsr/basicvsr.py
class BasicVSR (line 10) | class BasicVSR(BaseEditModel):
method __init__ (line 31) | def __init__(self,
method check_if_mirror_extended (line 67) | def check_if_mirror_extended(self, lrs):
method forward_train (line 85) | def forward_train(self, inputs, data_samples=None, **kwargs):
method forward_inference (line 117) | def forward_inference(self, inputs, data_samples=None, **kwargs):
FILE: mmagic/models/editors/basicvsr/basicvsr_net.py
class BasicVSRNet (line 18) | class BasicVSRNet(BaseModule):
method __init__ (line 36) | def __init__(self, mid_channels=64, num_blocks=30, spynet_pretrained=N...
method check_if_mirror_extended (line 68) | def check_if_mirror_extended(self, lrs):
method compute_flow (line 84) | def compute_flow(self, lrs):
method forward (line 113) | def forward(self, lrs):
class ResidualBlocksWithInputConv (line 179) | class ResidualBlocksWithInputConv(BaseModule):
method __init__ (line 189) | def __init__(self, in_channels, out_channels=64, num_blocks=30):
method forward (line 205) | def forward(self, feat):
class SPyNet (line 217) | class SPyNet(BaseModule):
method __init__ (line 231) | def __init__(self, pretrained):
method compute_flow (line 251) | def compute_flow(self, ref, supp):
method forward (line 311) | def forward(self, ref, supp):
class SPyNetBasicModule (line 350) | class SPyNetBasicModule(BaseModule):
method __init__ (line 357) | def __init__(self):
method forward (line 402) | def forward(self, tensor_input):
FILE: mmagic/models/editors/basicvsr_plusplus_net/basicvsr_plusplus_net.py
class BasicVSRPlusPlusNet (line 16) | class BasicVSRPlusPlusNet(BaseModule):
method __init__ (line 44) | def __init__(self,
method check_if_mirror_extended (line 101) | def check_if_mirror_extended(self, lqs):
method compute_flow (line 119) | def compute_flow(self, lqs):
method propagate (line 153) | def propagate(self, feats, flows, module_name):
method upsample (line 242) | def upsample(self, lqs, feats):
method forward (line 285) | def forward(self, lqs):
class SecondOrderDeformableAlignment (line 356) | class SecondOrderDeformableAlignment(ModulatedDeformConv2d):
method __init__ (line 374) | def __init__(self, *args, **kwargs):
method init_offset (line 391) | def init_offset(self):
method forward (line 395) | def forward(self, x, extra_feat, flow_1, flow_2):
FILE: mmagic/models/editors/biggan/biggan.py
class BigGAN (line 20) | class BigGAN(BaseConditionalGAN):
method __init__ (line 47) | def __init__(self,
method disc_loss (line 60) | def disc_loss(self, disc_pred_fake: Tensor,
method gen_loss (line 87) | def gen_loss(self, disc_pred_fake):
method train_discriminator (line 107) | def train_discriminator(self, inputs: dict, data_samples: DataSample,
method train_generator (line 141) | def train_generator(self, inputs: dict, data_samples: DataSample,
FILE: mmagic/models/editors/biggan/biggan_deep_discriminator.py
class BigGANDeepDiscriminator (line 19) | class BigGANDeepDiscriminator(nn.Module):
method __init__ (line 87) | def __init__(self,
method _get_default_arch_cfg (line 179) | def _get_default_arch_cfg(self, input_scale, base_channels):
method forward (line 228) | def forward(self, x, label=None):
method init_weights (line 251) | def init_weights(self, pretrained=None, init_type='ortho'):
FILE: mmagic/models/editors/biggan/biggan_deep_generator.py
class BigGANDeepGenerator (line 20) | class BigGANDeepGenerator(nn.Module):
method __init__ (line 108) | def __init__(self,
method _get_default_arch_cfg (line 248) | def _get_default_arch_cfg(self, output_scale, base_channels):
method forward (line 298) | def forward(self,
method init_weights (line 423) | def init_weights(self, pretrained=None, init_type='ortho'):
FILE: mmagic/models/editors/biggan/biggan_discriminator.py
class BigGANDiscriminator (line 16) | class BigGANDiscriminator(BaseModule):
method __init__ (line 76) | def __init__(self,
method _get_default_arch_cfg (line 150) | def _get_default_arch_cfg(self, input_scale, in_channels, base_channels):
method forward (line 202) | def forward(self, x, label=None):
method init_weights (line 225) | def init_weights(self):
FILE: mmagic/models/editors/biggan/biggan_generator.py
class BigGANGenerator (line 17) | class BigGANGenerator(BaseModule):
method __init__ (line 96) | def __init__(self,
method _get_default_arch_cfg (line 226) | def _get_default_arch_cfg(self, output_scale, base_channels):
method forward (line 276) | def forward(self,
method init_weights (line 403) | def init_weights(self):
FILE: mmagic/models/editors/biggan/biggan_modules.py
class SNConvModule (line 17) | class SNConvModule(ConvModule):
method __init__ (line 31) | def __init__(self,
class BigGANGenResBlock (line 64) | class BigGANGenResBlock(nn.Module):
method __init__ (line 92) | def __init__(self,
method forward (line 161) | def forward(self, x, y):
class BigGANConditionBN (line 187) | class BigGANConditionBN(nn.Module):
method __init__ (line 214) | def __init__(self,
method forward (line 268) | def forward(self, x, y):
class SelfAttentionBlock (line 291) | class SelfAttentionBlock(nn.Module):
method __init__ (line 308) | def __init__(self,
method forward (line 355) | def forward(self, x):
class BigGANDiscResBlock (line 382) | class BigGANDiscResBlock(nn.Module):
method __init__ (line 406) | def __init__(self,
method forward_sc (line 453) | def forward_sc(self, x):
method forward (line 474) | def forward(self, x):
class BigGANDeepGenResBlock (line 497) | class BigGANDeepGenResBlock(nn.Module):
method __init__ (line 529) | def __init__(self,
method forward (line 634) | def forward(self, x, y):
class BigGANDeepDiscResBlock (line 671) | class BigGANDeepDiscResBlock(nn.Module):
method __init__ (line 695) | def __init__(self,
method forward_sc (line 769) | def forward_sc(self, x):
method forward (line 785) | def forward(self, x):
FILE: mmagic/models/editors/biggan/biggan_snmodule.py
function proj (line 13) | def proj(x, y):
function gram_schmidt (line 26) | def gram_schmidt(x, ys):
function power_iteration (line 43) | def power_iteration(weight, u_list, update=True, eps=1e-12):
class SpectralNorm (line 76) | class SpectralNorm(object):
method __init__ (line 90) | def __init__(self,
method u (line 106) | def u(self):
method sv (line 111) | def sv(self):
method sn_weight (line 115) | def sn_weight(self):
class SNConv2d (line 132) | class SNConv2d(nn.Conv2d, SpectralNorm):
method __init__ (line 154) | def __init__(self,
method forward (line 170) | def forward(self, x):
class SNLinear (line 176) | class SNLinear(nn.Linear, SpectralNorm):
method __init__ (line 190) | def __init__(self,
method forward (line 200) | def forward(self, x):
class SNEmbedding (line 207) | class SNEmbedding(nn.Embedding, SpectralNorm):
method __init__ (line 238) | def __init__(self,
method forward (line 256) | def forward(self, x):
FILE: mmagic/models/editors/cain/cain.py
class CAIN (line 7) | class CAIN(BasicInterpolator):
method forward_inference (line 32) | def forward_inference(self, inputs, data_samples=None):
FILE: mmagic/models/editors/cain/cain_net.py
class CAINNet (line 13) | class CAINNet(BaseModule):
method __init__ (line 33) | def __init__(self,
method forward (line 65) | def forward(self, imgs, padding_flag=False):
function get_padding_functions (line 107) | def get_padding_functions(x, padding=7):
class ConvNormWithReflectionPad (line 150) | class ConvNormWithReflectionPad(BaseModule):
method __init__ (line 162) | def __init__(self, in_channels, out_channels, kernel_size, norm=None):
method forward (line 179) | def forward(self, x):
class ChannelAttentionLayer (line 196) | class ChannelAttentionLayer(BaseModule):
method __init__ (line 204) | def __init__(self, mid_channels, reduction=16):
method forward (line 224) | def forward(self, x):
class ResidualChannelAttention (line 239) | class ResidualChannelAttention(BaseModule):
method __init__ (line 251) | def __init__(self,
method forward (line 266) | def forward(self, x):
class ResidualGroup (line 280) | class ResidualGroup(BaseModule):
method __init__ (line 295) | def __init__(self,
method forward (line 316) | def forward(self, x):
FILE: mmagic/models/editors/controlnet/controlnet.py
class ControlStableDiffusion (line 28) | class ControlStableDiffusion(StableDiffusion):
method __init__ (line 60) | def __init__(self,
method init_weights (line 99) | def init_weights(self):
method train_step (line 187) | def train_step(self, data: dict,
method val_step (line 264) | def val_step(self, data: dict) -> SampleList:
method test_step (line 295) | def test_step(self, data: dict) -> SampleList:
method prepare_control (line 328) | def prepare_control(image: Tuple[Image.Image, List[Image.Image], Tensor,
method train (line 381) | def train(self, mode: bool = True):
method infer (line 403) | def infer(self,
method forward (line 593) | def forward(self, *args, **kwargs):
class ControlStableDiffusionImg2Img (line 600) | class ControlStableDiffusionImg2Img(ControlStableDiffusion):
method _default_height_width (line 602) | def _default_height_width(self, height, width, image):
method get_timesteps (line 624) | def get_timesteps(self, num_inference_steps, strength, device):
method prepare_latents (line 634) | def prepare_latents(self,
method prepare_latent_image (line 690) | def prepare_latent_image(self, image, dtype):
method infer (line 714) | def infer(
FILE: mmagic/models/editors/controlnet/controlnet_utils.py
function change_base_model (line 10) | def change_base_model(controlnet: nn.Module,
FILE: mmagic/models/editors/cyclegan/cyclegan.py
class CycleGAN (line 16) | class CycleGAN(BaseTranslationModel):
method __init__ (line 24) | def __init__(self,
method forward_test (line 38) | def forward_test(self, img, target_domain, **kwargs):
method _get_disc_loss (line 56) | def _get_disc_loss(self, outputs):
method _get_gen_loss (line 89) | def _get_gen_loss(self, outputs):
method _get_opposite_domain (line 136) | def _get_opposite_domain(self, domain):
method train_step (line 150) | def train_step(self, data: dict, optim_wrapper: OptimWrapperDict):
method test_step (line 215) | def test_step(self, data: dict) -> SampleList:
method val_step (line 255) | def val_step(self, data: dict) -> SampleList:
FILE: mmagic/models/editors/cyclegan/cyclegan_generator.py
class ResnetGenerator (line 12) | class ResnetGenerator(BaseModule):
method __init__ (line 33) | def __init__(self,
method forward (line 123) | def forward(self, x):
method init_weights (line 134) | def init_weights(self):
FILE: mmagic/models/editors/cyclegan/cyclegan_modules.py
class ResidualBlockWithDropout (line 8) | class ResidualBlockWithDropout(nn.Module):
method __init__ (line 26) | def __init__(self,
method forward (line 67) | def forward(self, x):
class GANImageBuffer (line 80) | class GANImageBuffer:
method __init__ (line 95) | def __init__(self, buffer_size, buffer_ratio=0.5):
method query (line 103) | def query(self, images):
FILE: mmagic/models/editors/dcgan/dcgan.py
class DCGAN (line 15) | class DCGAN(BaseGAN):
method disc_loss (line 28) | def disc_loss(self, disc_pred_fake: Tensor,
method gen_loss (line 51) | def gen_loss(self, disc_pred_fake: Tensor) -> Tuple:
method train_discriminator (line 67) | def train_discriminator(self, inputs: dict, data_samples: DataSample,
method train_generator (line 95) | def train_generator(self, inputs: dict, data_samples: DataSample,
FILE: mmagic/models/editors/dcgan/dcgan_discriminator.py
class DCGANDiscriminator (line 12) | class DCGANDiscriminator(BaseModule):
method __init__ (line 43) | def __init__(self,
method forward (line 95) | def forward(self, x):
method init_weights (line 112) | def init_weights(self):
FILE: mmagic/models/editors/dcgan/dcgan_generator.py
class DCGANGenerator (line 14) | class DCGANGenerator(BaseModule):
method __init__ (line 55) | def __init__(self,
method forward (line 117) | def forward(self, noise, num_batches=0, return_noise=False):
method init_weights (line 167) | def init_weights(self):
FILE: mmagic/models/editors/ddpm/attention.py
class Transformer2DModel (line 10) | class Transformer2DModel(nn.Module):
method __init__ (line 65) | def __init__(
method _set_attention_slice (line 147) | def _set_attention_slice(self, slice_size):
method forward (line 153) | def forward(self,
class BasicTransformerBlock (line 232) | class BasicTransformerBlock(nn.Module):
method __init__ (line 252) | def __init__(
method _set_attention_slice (line 290) | def _set_attention_slice(self, slice_size):
method forward (line 295) | def forward(self, hidden_states, context=None, timestep=None):
class CrossAttention (line 317) | class CrossAttention(nn.Module):
method __init__ (line 337) | def __init__(
method reshape_heads_to_batch_dim (line 365) | def reshape_heads_to_batch_dim(self, tensor):
method reshape_batch_dim_to_heads (line 375) | def reshape_batch_dim_to_heads(self, tensor):
method forward (line 385) | def forward(self, hidden_states, context=None, mask=None):
method _attention (line 416) | def _attention(self, query, key, value):
method _sliced_attention (line 439) | def _sliced_attention(self, query, key, value, sequence_length, dim):
class FeedForward (line 473) | class FeedForward(nn.Module):
method __init__ (line 490) | def __init__(
method forward (line 515) | def forward(self, hidden_states):
class GEGLU (line 523) | class GEGLU(nn.Module):
method __init__ (line 533) | def __init__(self, dim_in: int, dim_out: int):
method gelu (line 537) | def gelu(self, gate):
method forward (line 541) | def forward(self, hidden_states):
class ApproximateGELU (line 547) | class ApproximateGELU(nn.Module):
method __init__ (line 553) | def __init__(self, dim_in: int, dim_out: int):
method forward (line 557) | def forward(self, x):
FILE: mmagic/models/editors/ddpm/denoising_unet.py
class EmbedSequential (line 27) | class EmbedSequential(nn.Sequential):
method forward (line 35) | def forward(self, x, y, encoder_out=None):
class GroupNorm32 (line 49) | class GroupNorm32(nn.GroupNorm):
method __init__ (line 51) | def __init__(self, num_channels, num_groups=32, **kwargs):
method forward (line 54) | def forward(self, x):
function convert_module_to_f16 (line 58) | def convert_module_to_f16(layer):
function convert_module_to_f32 (line 66) | def convert_module_to_f32(layer):
class SiLU (line 76) | class SiLU(BaseModule):
method __init__ (line 84) | def __init__(self, inplace=False):
method forward (line 92) | def forward(self, x):
class MultiHeadAttention (line 108) | class MultiHeadAttention(BaseModule):
method __init__ (line 121) | def __init__(self,
method QKVAttention (line 133) | def QKVAttention(qkv):
method forward (line 142) | def forward(self, x):
method init_weights (line 159) | def init_weights(self):
class MultiHeadAttentionBlock (line 164) | class MultiHeadAttentionBlock(BaseModule):
method __init__ (line 172) | def __init__(self,
method forward (line 202) | def forward(self, x, encoder_out=None):
class QKVAttentionLegacy (line 216) | class QKVAttentionLegacy(BaseModule):
method __init__ (line 222) | def __init__(self, n_heads):
method forward (line 226) | def forward(self, qkv, encoder_kv=None):
class QKVAttention (line 253) | class QKVAttention(BaseModule):
method __init__ (line 257) | def __init__(self, n_heads):
method forward (line 261) | def forward(self, qkv):
class TimeEmbedding (line 284) | class TimeEmbedding(BaseModule):
method __init__ (line 299) | def __init__(self,
method sinusodial_embedding (line 322) | def sinusodial_embedding(timesteps, dim, max_period=10000):
method forward (line 348) | def forward(self, t):
class DenoisingResBlock (line 361) | class DenoisingResBlock(BaseModule):
method __init__ (line 382) | def __init__(self,
method forward_shortcut (line 450) | def forward_shortcut(self, x):
method forward (line 455) | def forward(self, x, y):
method init_weights (line 479) | def init_weights(self):
class NormWithEmbedding (line 485) | class NormWithEmbedding(BaseModule):
method __init__ (line 505) | def __init__(self,
method forward (line 520) | def forward(self, x, y):
class DenoisingDownsample (line 542) | class DenoisingDownsample(BaseModule):
method __init__ (line 553) | def __init__(self, in_channels, with_conv=True):
method forward (line 560) | def forward(self, x):
class DenoisingUpsample (line 572) | class DenoisingUpsample(BaseModule):
method __init__ (line 584) | def __init__(self, in_channels, with_conv=True):
method forward (line 590) | def forward(self, x):
function build_down_block_resattn (line 604) | def build_down_block_resattn(resblocks_per_downsample, resblock_cfg,
function build_mid_blocks_resattn (line 651) | def build_mid_blocks_resattn(resblock_cfg, attention_cfg, in_channels_):
function build_up_blocks_resattn (line 662) | def build_up_blocks_resattn(
class DenoisingUnet (line 719) | class DenoisingUnet(BaseModule):
method __init__ (line 840) | def __init__(self,
method forward (line 1145) | def forward(self,
method init_weights (line 1288) | def init_weights(self, pretrained=None):
method convert_to_fp16 (line 1317) | def convert_to_fp16(self):
method convert_to_fp32 (line 1323) | def convert_to_fp32(self):
FILE: mmagic/models/editors/ddpm/embeddings.py
class TimestepEmbedding (line 11) | class TimestepEmbedding(nn.Module):
method __init__ (line 14) | def __init__(self,
method forward (line 38) | def forward(self, sample):
class Timesteps (line 50) | class Timesteps(nn.Module):
method __init__ (line 53) | def __init__(self,
method forward (line 64) | def forward(self, timesteps):
FILE: mmagic/models/editors/ddpm/res_blocks.py
class ResnetBlock2D (line 10) | class ResnetBlock2D(nn.Module):
method __init__ (line 31) | def __init__(
method forward (line 107) | def forward(self, input_tensor, temb):
class Upsample2D (line 148) | class Upsample2D(nn.Module):
method __init__ (line 158) | def __init__(self,
method forward (line 179) | def forward(self, hidden_states, output_size=None):
class Downsample2D (line 200) | class Downsample2D(nn.Module):
method __init__ (line 210) | def __init__(self,
method forward (line 237) | def forward(self, hidden_states):
FILE: mmagic/models/editors/ddpm/unet_blocks.py
function get_down_block (line 9) | def get_down_block(
function get_up_block (line 62) | def get_up_block(
class UNetMidBlock2DCrossAttn (line 115) | class UNetMidBlock2DCrossAttn(nn.Module):
method __init__ (line 118) | def __init__(
method set_attention_slice (line 189) | def set_attention_slice(self, slice_size):
method forward (line 203) | def forward(self, hidden_states, temb=None, encoder_hidden_states=None):
class CrossAttnDownBlock2D (line 214) | class CrossAttnDownBlock2D(nn.Module):
method __init__ (line 217) | def __init__(
method set_attention_slice (line 290) | def set_attention_slice(self, slice_size):
method forward (line 304) | def forward(self, hidden_states, temb=None, encoder_hidden_states=None):
class DownBlock2D (line 326) | class DownBlock2D(nn.Module):
method __init__ (line 329) | def __init__(
method forward (line 380) | def forward(self, hidden_states, temb=None):
class CrossAttnUpBlock2D (line 399) | class CrossAttnUpBlock2D(nn.Module):
method __init__ (line 402) | def __init__(
method set_attention_slice (line 475) | def set_attention_slice(self, slice_size):
method forward (line 491) | def forward(
class UpBlock2D (line 520) | class UpBlock2D(nn.Module):
method __init__ (line 523) | def __init__(
method forward (line 574) | def forward(self,
FILE: mmagic/models/editors/deblurganv2/deblurganv2.py
class DeblurGanV2 (line 18) | class DeblurGanV2(BaseModel):
method __init__ (line 20) | def __init__(self,
method forward (line 70) | def forward(self,
method convert_to_datasample (line 154) | def convert_to_datasample(self, predictions: DataSample,
method forward_tensor (line 183) | def forward_tensor(self,
method forward_inference (line 204) | def forward_inference(self,
method forward_train (line 227) | def forward_train(self, inputs, data_samples=None, **kwargs):
method val_step (line 243) | def val_step(self, data: Union[tuple, dict, list]) -> list:
method test_step (line 260) | def test_step(self, data: Union[dict, tuple, list]) -> list:
method _run_forward (line 272) | def _run_forward(self, data: Union[dict, tuple, list],
method train_step (line 292) | def train_step(self, data: List[dict],
method g_step (line 341) | def g_step(self, batch_outputs: torch.Tensor, batch_gt_data: torch.Ten...
method d_step (line 382) | def d_step(self, batch_outputs: torch.Tensor, batch_gt_data: torch.Ten...
method g_step_with_optim (line 402) | def g_step_with_optim(self, batch_outputs: torch.Tensor,
method d_step_with_optim (line 429) | def d_step_with_optim(self, batch_outputs: torch.Tensor,
method extract_gt_data (line 461) | def extract_gt_data(self, data_samples):
FILE: mmagic/models/editors/deblurganv2/deblurganv2_discriminator.py
class NLayerDiscriminator (line 13) | class NLayerDiscriminator(nn.Module):
method __init__ (line 16) | def __init__(self,
method forward (line 77) | def forward(self, input):
class DicsriminatorTail (line 89) | class DicsriminatorTail(nn.Module):
method __init__ (line 91) | def __init__(self,
method forward (line 128) | def forward(self, input):
class MultiScaleDiscriminator (line 140) | class MultiScaleDiscriminator(nn.Module):
method __init__ (line 144) | def __init__(self,
method forward (line 206) | def forward(self, input):
function get_fullD (line 224) | def get_fullD(norm_layer):
class DoubleGan (line 237) | class DoubleGan(nn.Module):
method __init__ (line 240) | def __init__(self, norm_layer='instance', d_layers=3):
method forward (line 248) | def forward(self, x):
class PatchGan (line 264) | class PatchGan(nn.Module):
method __init__ (line 267) | def __init__(self, norm_layer='instance', d_layers=3):
method forward (line 274) | def forward(self, x):
class MultiScale (line 287) | class MultiScale(nn.Module):
method __init__ (line 290) | def __init__(self, norm_layer='instance', d_layers=3):
method forward (line 295) | def forward(self, x):
class DeblurGanV2Discriminator (line 309) | class DeblurGanV2Discriminator:
method __new__ (line 316) | def __new__(cls, backbone, *args, **kwargs):
FILE: mmagic/models/editors/deblurganv2/deblurganv2_generator.py
class FPNHead (line 12) | class FPNHead(nn.Module):
method __init__ (line 15) | def __init__(self, num_in, num_mid, num_out):
method forward (line 23) | def forward(self, x):
class FPN_inception (line 37) | class FPN_inception(nn.Module):
method __init__ (line 39) | def __init__(self, norm_layer, num_filter=256, pretrained='imagenet'):
method unfreeze (line 91) | def unfreeze(self):
method forward (line 96) | def forward(self, x):
class FPNInception (line 140) | class FPNInception(nn.Module):
method __init__ (line 144) | def __init__(self,
method unfreeze (line 177) | def unfreeze(self):
method forward (line 181) | def forward(self, x):
class FPN_inceptionsimple (line 214) | class FPN_inceptionsimple(nn.Module):
method __init__ (line 216) | def __init__(self, norm_layer, num_filters=256):
method unfreeze (line 260) | def unfreeze(self):
method forward (line 265) | def forward(self, x):
class FPNInceptionSimple (line 306) | class FPNInceptionSimple(nn.Module):
method __init__ (line 310) | def __init__(self,
method unfreeze (line 343) | def unfreeze(self):
method forward (line 347) | def forward(self, x):
class FPN_mobilenet (line 380) | class FPN_mobilenet(nn.Module):
method __init__ (line 382) | def __init__(self, norm_layer, num_filters=128, pretrained=None):
method unfreeze (line 429) | def unfreeze(self):
method forward (line 434) | def forward(self, x):
class FPNMobileNet (line 476) | class FPNMobileNet(nn.Module):
method __init__ (line 478) | def __init__(self,
method unfreeze (line 516) | def unfreeze(self):
method forward (line 520) | def forward(self, x):
class DeblurGanV2Generator (line 554) | class DeblurGanV2Generator:
method __new__ (line 561) | def __new__(cls, backbone, *args, **kwargs):
FILE: mmagic/models/editors/deblurganv2/deblurganv2_util.py
class BasicConv2d (line 39) | class BasicConv2d(nn.Module):
method __init__ (line 41) | def __init__(self, in_planes, out_planes, kernel_size, stride, padding...
method forward (line 57) | def forward(self, x):
class Mixed_5b (line 72) | class Mixed_5b(nn.Module):
method __init__ (line 74) | def __init__(self):
method forward (line 92) | def forward(self, x):
class Block35 (line 109) | class Block35(nn.Module):
method __init__ (line 111) | def __init__(self, scale=1.0):
method forward (line 130) | def forward(self, x):
class Mixed_6a (line 149) | class Mixed_6a(nn.Module):
method __init__ (line 151) | def __init__(self):
method forward (line 163) | def forward(self, x):
class Block17 (line 179) | class Block17(nn.Module):
method __init__ (line 181) | def __init__(self, scale=1.0):
method forward (line 198) | def forward(self, x):
class Mixed_7a (line 216) | class Mixed_7a(nn.Module):
method __init__ (line 218) | def __init__(self):
method forward (line 236) | def forward(self, x):
class Block8 (line 253) | class Block8(nn.Module):
method __init__ (line 255) | def __init__(self, scale=1.0, noReLU=False):
method forward (line 274) | def forward(self, x):
class InceptionResNetV2 (line 293) | class InceptionResNetV2(nn.Module):
method __init__ (line 296) | def __init__(self, num_classes=1001):
method features (line 337) | def features(self, input):
method logits (line 360) | def logits(self, features):
method forward (line 372) | def forward(self, input):
function inceptionresnetv2 (line 386) | def inceptionresnetv2(num_classes=1000, pretrained='imagenet'):
function conv_bn (line 410) | def conv_bn(inp, oup, stride):
function conv_1x1_bn (line 416) | def conv_1x1_bn(inp, oup):
class InvertedResidual (line 422) | class InvertedResidual(nn.Module):
method __init__ (line 424) | def __init__(self, inp, oup, stride, expand_ratio):
method forward (line 471) | def forward(self, x):
class MobileNetV2 (line 486) | class MobileNetV2(nn.Module):
method __init__ (line 488) | def __init__(self, n_class=1000, input_size=224, width_mult=1.):
method forward (line 536) | def forward(self, x):
method _initialize_weights (line 550) | def _initialize_weights(self):
function get_norm_layer (line 566) | def get_norm_layer(norm_type='instance'):
FILE: mmagic/models/editors/deepfillv1/contextual_attention.py
class ContextualAttentionModule (line 10) | class ContextualAttentionModule(BaseModule):
method __init__ (line 41) | def __init__(self,
method forward (line 76) | def forward(self, x, context, mask=None):
method patch_correlation (line 147) | def patch_correlation(self, x, kernel):
method patch_copy_deconv (line 169) | def patch_copy_deconv(self, attention_score, context_filter):
method fuse_correlation_map (line 190) | def fuse_correlation_map(self, correlation_map, h_unfold, w_unfold):
method calculate_unfold_hw (line 239) | def calculate_unfold_hw(self,
method calculate_overlap_factor (line 261) | def calculate_overlap_factor(self, attention_score):
method mask_correlation_map (line 287) | def mask_correlation_map(self, correlation_map, mask):
method im2col (line 321) | def im2col(self,
FILE: mmagic/models/editors/deepfillv1/contextual_attention_neck.py
class ContextualAttentionNeck (line 12) | class ContextualAttentionNeck(BaseModule):
method __init__ (line 30) | def __init__(self,
method forward (line 61) | def forward(self, x, mask):
FILE: mmagic/models/editors/deepfillv1/deepfill_decoder.py
class DeepFillDecoder (line 16) | class DeepFillDecoder(BaseModule):
method __init__ (line 37) | def __init__(self,
method forward (line 80) | def forward(self, input_dict):
FILE: mmagic/models/editors/deepfillv1/deepfill_disc.py
class DeepFillv1Discriminators (line 10) | class DeepFillv1Discriminators(BaseModule):
method __init__ (line 26) | def __init__(self, global_disc_cfg, local_disc_cfg):
method forward (line 31) | def forward(self, x):
method init_weights (line 49) | def init_weights(self):
FILE: mmagic/models/editors/deepfillv1/deepfill_encoder.py
class DeepFillEncoder (line 10) | class DeepFillEncoder(BaseModule):
method __init__ (line 31) | def __init__(self,
method forward (line 65) | def forward(self, x):
FILE: mmagic/models/editors/deepfillv1/deepfill_refiner.py
class DeepFillRefiner (line 10) | class DeepFillRefiner(BaseModule):
method __init__ (line 29) | def __init__(self,
method forward (line 48) | def forward(self, x, mask):
FILE: mmagic/models/editors/deepfillv1/deepfillv1.py
class DeepFillv1Inpaintor (line 13) | class DeepFillv1Inpaintor(TwoStageInpaintor):
method __init__ (line 68) | def __init__(self,
method forward_train_d (line 106) | def forward_train_d(self, data_batch, is_real, is_disc):
method two_stage_loss (line 146) | def two_stage_loss(self, stage1_data, stage2_data, gt, mask, masked_img):
method calculate_loss_with_type (line 199) | def calculate_loss_with_type(self,
method train_step (line 254) | def train_step(self, data: List[dict], optim_wrapper):
FILE: mmagic/models/editors/deepfillv2/two_stage_encoder_decoder.py
class DeepFillEncoderDecoder (line 12) | class DeepFillEncoderDecoder(BaseModule):
method __init__ (line 27) | def __init__(self,
method forward (line 47) | def forward(self, x):
method init_weights (line 75) | def init_weights(self):
FILE: mmagic/models/editors/dic/dic.py
class DIC (line 13) | class DIC(SRGAN):
method __init__ (line 34) | def __init__(self,
method forward_tensor (line 62) | def forward_tensor(self, inputs, data_samples=None, training=False):
method if_run_g (line 84) | def if_run_g(self):
method if_run_d (line 89) | def if_run_d(self):
method g_step (line 94) | def g_step(self, batch_outputs, batch_gt_data):
method train_step (line 132) | def train_step(self, data: List[dict],
method extract_gt_data (line 190) | def extract_gt_data(data_samples):
FILE: mmagic/models/editors/dic/dic_net.py
class DICNet (line 12) | class DICNet(BaseModule):
method __init__ (line 38) | def __init__(self,
method forward (line 84) | def forward(self, x):
class FeedbackBlock (line 125) | class FeedbackBlock(nn.Module):
method __init__ (line 144) | def __init__(self,
method forward (line 196) | def forward(self, x):
class FeedbackBlockCustom (line 240) | class FeedbackBlockCustom(FeedbackBlock):
method __init__ (line 250) | def __init__(self, in_channels, mid_channels, num_blocks, upscale_fact...
method forward (line 258) | def forward(self, x):
class GroupResBlock (line 294) | class GroupResBlock(nn.Module):
method __init__ (line 306) | def __init__(self,
method forward (line 320) | def forward(self, x):
class FeatureHeatmapFusingBlock (line 334) | class FeatureHeatmapFusingBlock(nn.Module):
method __init__ (line 345) | def __init__(self,
method forward (line 369) | def forward(self, feature, heatmap):
class FeedbackBlockHeatmapAttention (line 396) | class FeedbackBlockHeatmapAttention(FeedbackBlock):
method __init__ (line 408) | def __init__(self,
method forward (line 427) | def forward(self, x, heatmap):
FILE: mmagic/models/editors/dic/feedback_hour_glass.py
class FeedbackHourglass (line 10) | class FeedbackHourglass(BaseModule):
method __init__ (line 26) | def __init__(self, mid_channels, num_keypoints):
method forward (line 49) | def forward(self, x, last_hidden=None):
class ResBlock (line 75) | class ResBlock(nn.Module):
method __init__ (line 95) | def __init__(self, in_channels, out_channels):
method forward (line 108) | def forward(self, x):
class Hourglass (line 124) | class Hourglass(nn.Module):
method __init__ (line 134) | def __init__(self, depth, mid_channels):
method forward (line 145) | def forward(self, x):
function reduce_to_five_heatmaps (line 164) | def reduce_to_five_heatmaps(ori_heatmap, detach):
FILE: mmagic/models/editors/dic/light_cnn.py
class LightCNN (line 12) | class LightCNN(BaseModule):
method __init__ (line 21) | def __init__(self, in_channels):
method forward (line 43) | def forward(self, x):
method init_weights (line 58) | def init_weights(self, pretrained=None, strict=True):
class MaxFeature (line 75) | class MaxFeature(nn.Module):
method __init__ (line 92) | def __init__(self,
method forward (line 115) | def forward(self, x):
FILE: mmagic/models/editors/dim/dim.py
class DIM (line 13) | class DIM(BaseMattor):
method __init__ (line 44) | def __init__(self,
method init_weights (line 93) | def init_weights(self):
method with_refiner (line 100) | def with_refiner(self):
method train (line 104) | def train(self, mode=True):
method freeze_backbone (line 115) | def freeze_backbone(self):
method _forward (line 121) | def _forward(self,
method _forward_test (line 149) | def _forward_test(self, inputs):
method _forward_train (line 157) | def _forward_train(self, inputs, data_samples):
FILE: mmagic/models/editors/disco_diffusion/clip_wrapper.py
class ClipWrapper (line 12) | class ClipWrapper(nn.Module):
method __init__ (line 78) | def __init__(self, clip_type, *args, **kwargs):
method get_embedding_layer (line 117) | def get_embedding_layer(self):
method add_embedding (line 136) | def add_embedding(self, embeddings: Union[dict, List[dict]]):
method set_only_embedding_trainable (line 148) | def set_only_embedding_trainable(self):
method set_embedding_layer (line 164) | def set_embedding_layer(self):
method unset_embedding_layer (line 175) | def unset_embedding_layer(self):
method forward (line 182) | def forward(self, *args, **kwargs):
class EmbeddingLayerWithFixes (line 187) | class EmbeddingLayerWithFixes(nn.Module):
method __init__ (line 199) | def __init__(self,
method weight (line 214) | def weight(self):
method check_duplicate_names (line 218) | def check_duplicate_names(self, embeddings: List[dict]):
method check_ids_overlap (line 230) | def check_ids_overlap(self, embeddings):
method add_embeddings (line 246) | def add_embeddings(self, embeddings: Optional[Union[dict, List[dict]]]):
method replace_input_ids (line 316) | def replace_input_ids(self, input_ids: torch.Tensor) -> torch.Tensor:
method replace_embeddings (line 329) | def replace_embeddings(self, input_ids: torch.Tensor,
method forward (line 386) | def forward(self,
FILE: mmagic/models/editors/disco_diffusion/disco.py
class DiscoDiffusion (line 22) | class DiscoDiffusion(nn.Module):
method __init__ (line 48) | def __init__(self,
method load_pretrained_models (line 83) | def load_pretrained_models(self, pretrained_cfgs):
method device (line 106) | def device(self):
method infer (line 115) | def infer(self,
FILE: mmagic/models/editors/disco_diffusion/guider.py
function sinc (line 27) | def sinc(x):
function lanczos (line 44) | def lanczos(x, a):
function ramp (line 51) | def ramp(ratio, width):
function resample (line 70) | def resample(input, size, align_corners=True):
function range_loss (line 104) | def range_loss(input):
function spherical_dist_loss (line 109) | def spherical_dist_loss(x, y):
class MakeCutouts (line 116) | class MakeCutouts(nn.Module):
method __init__ (line 129) | def __init__(self, cut_size, cutn):
method forward (line 144) | def forward(self, input, skip_augs=False):
class MakeCutoutsDango (line 170) | class MakeCutoutsDango(nn.Module):
method __init__ (line 200) | def __init__(self,
method forward (line 231) | def forward(self, input, skip_augs=False):
function parse_prompt (line 278) | def parse_prompt(prompt):
function split_prompts (line 289) | def split_prompts(prompts, max_frames=1):
class ImageTextGuider (line 299) | class ImageTextGuider(nn.Module):
method __init__ (line 312) | def __init__(self, clip_models):
method frame_prompt_from_text (line 322) | def frame_prompt_from_text(self, text_prompts, frame_num=0):
method compute_prompt_stats (line 333) | def compute_prompt_stats(self,
method cond_fn (line 385) | def cond_fn(self,
method device (line 503) | def device(self):
method forward (line 511) | def forward(self, x):
FILE: mmagic/models/editors/disco_diffusion/secondary_model.py
function append_dims (line 14) | def append_dims(x, n):
function expand_to_planes (line 19) | def expand_to_planes(x, shape):
function alpha_sigma_to_t (line 24) | def alpha_sigma_to_t(alpha, sigma):
function t_to_alpha_sigma (line 29) | def t_to_alpha_sigma(t):
class ConvBlock (line 34) | class ConvBlock(nn.Sequential):
method __init__ (line 42) | def __init__(self, c_in, c_out):
class SkipBlock (line 49) | class SkipBlock(nn.Module):
method __init__ (line 59) | def __init__(self, main, skip=None):
method forward (line 64) | def forward(self, input):
class FourierFeatures (line 69) | class FourierFeatures(nn.Module):
method __init__ (line 78) | def __init__(self, in_features, out_features, std=1.):
method forward (line 84) | def forward(self, input):
class SecondaryDiffusionImageNet2 (line 91) | class SecondaryDiffusionImageNet2(nn.Module):
method __init__ (line 98) | def __init__(self):
method forward (line 156) | def forward(self, input, t):
FILE: mmagic/models/editors/dreambooth/dreambooth.py
class DreamBooth (line 21) | class DreamBooth(StableDiffusion):
method __init__ (line 66) | def __init__(self,
method generate_class_prior_images (line 114) | def generate_class_prior_images(self, num_batches=None):
method prepare_model (line 151) | def prepare_model(self):
method set_lora (line 169) | def set_lora(self):
method val_step (line 175) | def val_step(self, data: dict) -> SampleList:
method test_step (line 205) | def test_step(self, data: dict) -> SampleList:
method train_step (line 233) | def train_step(self, data, optim_wrapper):
method forward (line 311) | def forward(self,
FILE: mmagic/models/editors/duf/duf.py
class DynamicUpsamplingFilter (line 8) | class DynamicUpsamplingFilter(BaseModule):
method __init__ (line 20) | def __init__(self, filter_size=(5, 5)):
method forward (line 36) | def forward(self, x, filters):
FILE: mmagic/models/editors/edsr/edsr_net.py
class EDSRNet (line 14) | class EDSRNet(BaseModule):
method __init__ (line 36) | def __init__(self,
method forward (line 66) | def forward(self, x):
class UpsampleModule (line 90) | class UpsampleModule(nn.Sequential):
method __init__ (line 98) | def __init__(self, scale, mid_channels):
FILE: mmagic/models/editors/edvr/edvr.py
class EDVR (line 9) | class EDVR(BaseEditModel):
method __init__ (line 25) | def __init__(self,
method forward_train (line 46) | def forward_train(self, inputs, data_samples=None):
FILE: mmagic/models/editors/edvr/edvr_net.py
class EDVRNet (line 16) | class EDVRNet(BaseModule):
method __init__ (line 40) | def __init__(self,
method forward (line 103) | def forward(self, x):
method init_weights (line 163) | def init_weights(self):
class ModulatedDCNPack (line 187) | class ModulatedDCNPack(ModulatedDeformConv2d):
method __init__ (line 207) | def __init__(self, *args, **kwargs):
method init_offset (line 219) | def init_offset(self):
method forward (line 223) | def forward(self, x, extra_feat):
class PCDAlignment (line 235) | class PCDAlignment(BaseModule):
method __init__ (line 247) | def __init__(self,
method forward (line 310) | def forward(self, neighbor_feats, ref_feats):
class TSAFusion (line 364) | class TSAFusion(BaseModule):
method __init__ (line 376) | def __init__(self,
method forward (line 418) | def forward(self, aligned_feat):
FILE: mmagic/models/editors/eg3d/camera.py
class BaseCamera (line 16) | class BaseCamera(object):
method __init__ (line 42) | def __init__(self,
method _sample_in_range (line 68) | def _sample_in_range(self, mean: float, std: float,
method sample_intrinsic (line 91) | def sample_intrinsic(self,
method fov_to_intrinsic (line 130) | def fov_to_intrinsic(self,
method focal_to_instrinsic (line 156) | def focal_to_instrinsic(self,
method sample_theta (line 180) | def sample_theta(self, mean: float, std: float,
method sample_phi (line 195) | def sample_phi(self, mean: float, std: float,
method sample_camera2world (line 219) | def sample_camera2world(self,
method interpolation_cam2world (line 286) | def interpolation_cam2world(self,
method __repr__ (line 353) | def __repr__(self):
class GaussianCamera (line 367) | class GaussianCamera(BaseCamera):
method __init__ (line 387) | def __init__(self,
class UniformCamera (line 403) | class UniformCamera(BaseCamera):
method __init__ (line 423) | def __init__(self,
function create_cam2world_matrix (line 438) | def create_cam2world_matrix(forward_vector: torch.Tensor, origin: torch....
FILE: mmagic/models/editors/eg3d/dual_discriminator.py
class DualDiscriminator (line 18) | class DualDiscriminator(StyleGAN2Discriminator):
method __init__ (line 35) | def __init__(self,
method forward (line 47) | def forward(self,
FILE: mmagic/models/editors/eg3d/eg3d.py
class EG3D (line 21) | class EG3D(BaseConditionalGAN):
method __init__ (line 55) | def __init__(self,
method label_fn (line 76) | def label_fn(self,
method data_sample_to_label (line 102) | def data_sample_to_label(self, data_sample: SampleList
method pack_to_data_sample (line 119) | def pack_to_data_sample(
method forward (line 151) | def forward(self,
method interpolation (line 231) | def interpolation(self,
FILE: mmagic/models/editors/eg3d/eg3d_generator.py
class TriplaneGenerator (line 17) | class TriplaneGenerator(BaseModule):
method __init__ (line 73) | def __init__(self,
method sample_ray (line 147) | def sample_ray(self, cond: torch.Tensor) -> Tuple[Tensor]:
method forward (line 163) | def forward(self,
FILE: mmagic/models/editors/eg3d/eg3d_modules.py
class TriPlaneBackbone (line 15) | class TriPlaneBackbone(StyleGAN2Generator):
method __init__ (line 42) | def __init__(self,
method mapping (line 68) | def mapping(self,
method synthesis (line 128) | def synthesis(self, styles: torch.Tensor, *args, **kwargs) -> torch.Te...
class SuperResolutionModule (line 143) | class SuperResolutionModule(BaseModule):
method __init__ (line 161) | def __init__(self,
method forward (line 210) | def forward(self,
class SynthesisBlock (line 247) | class SynthesisBlock(BaseModule):
method __init__ (line 261) | def __init__(self,
method forward (line 296) | def forward(self,
FILE: mmagic/models/editors/eg3d/eg3d_utils.py
function get_ray_limits_box (line 7) | def get_ray_limits_box(rays_o: torch.Tensor, rays_d: torch.Tensor,
function inverse_transform_sampling (line 87) | def inverse_transform_sampling(bins: torch.Tensor,
function linspace_batch (line 146) | def linspace_batch(start: torch.Tensor, stop: torch.Tensor,
FILE: mmagic/models/editors/eg3d/ray_sampler.py
function sample_rays (line 7) | def sample_rays(cam2world: torch.Tensor, intrinsics: torch.Tensor,
FILE: mmagic/models/editors/eg3d/renderer.py
class EG3DRenderer (line 19) | class EG3DRenderer(BaseModule):
method __init__ (line 49) | def __init__(self,
method get_value (line 74) | def get_value(self,
method forward (line 91) | def forward(self,
method sample_stratified (line 197) | def sample_stratified(self, ray_origins: torch.Tensor,
method neural_rendering (line 242) | def neural_rendering(self, planes: torch.Tensor, sample_coordinates: f...
method sample_from_planes (line 268) | def sample_from_planes(self,
method project_onto_planes (line 307) | def project_onto_planes(self, coordinates: torch.Tensor) -> torch.Tensor:
method unify_samples (line 355) | def unify_samples(self, depths_c: torch.Tensor, colors_c: torch.Tensor,
method volume_rendering (line 392) | def volume_rendering(self, colors: torch.Tensor, densities: torch.Tensor,
method sample_importance (line 451) | def sample_importance(self, z_vals: torch.Tensor, weights: torch.Tensor,
class EG3DDecoder (line 483) | class EG3DDecoder(BaseModule):
method __init__ (line 496) | def __init__(self,
method forward (line 512) | def forward(self, sampled_features: torch.Tensor) -> dict:
FILE: mmagic/models/editors/esrgan/esrgan.py
class ESRGAN (line 9) | class ESRGAN(SRGAN):
method g_step (line 36) | def g_step(self, batch_outputs: torch.Tensor, batch_gt_data: torch.Ten...
method d_step_real (line 78) | def d_step_real(self, batch_outputs: torch.Tensor,
method d_step_fake (line 104) | def d_step_fake(self, batch_outputs: torch.Tensor, batch_gt_data):
FILE: mmagic/models/editors/esrgan/rrdb_net.py
class RRDBNet (line 13) | class RRDBNet(BaseModule):
method __init__ (line 34) | def __init__(self,
method forward (line 66) | def forward(self, x):
method init_weights (line 93) | def init_weights(self):
class ResidualDenseBlock (line 108) | class ResidualDenseBlock(nn.Module):
method __init__ (line 119) | def __init__(self, mid_channels=64, growth_channels=32):
method init_weights (line 131) | def init_weights(self):
method forward (line 141) | def forward(self, x):
class RRDB (line 159) | class RRDB(nn.Module):
method __init__ (line 169) | def __init__(self, mid_channels, growth_channels=32):
method forward (line 175) | def forward(self, x):
FILE: mmagic/models/editors/fastcomposer/fastcomposer.py
class FastComposer (line 21) | class FastComposer(StableDiffusion):
method __init__ (line 23) | def __init__(self,
method _tokenize_and_mask_noun_phrases_ends (line 89) | def _tokenize_and_mask_noun_phrases_ends(self, caption):
method _encode_augmented_prompt (line 126) | def _encode_augmented_prompt(self, prompt: str,
method infer (line 170) | def infer(self,
FILE: mmagic/models/editors/fastcomposer/fastcomposer_util.py
class FastComposerModel (line 24) | class FastComposerModel(nn.Module):
method __init__ (line 28) | def __init__(self, text_encoder, image_encoder, vae, unet, cfg):
method _clear_cross_attention_scores (line 60) | def _clear_cross_attention_scores(self):
method from_pretrained (line 70) | def from_pretrained(cfg, vae, unet):
method forward (line 98) | def forward(self, batch, noise_scheduler):
class FastComposerTextEncoder (line 203) | class FastComposerTextEncoder(CLIPPreTrainedModel):
method from_pretrained (line 207) | def from_pretrained(model_name_or_path, **kwargs):
method __init__ (line 213) | def __init__(self, text_model):
method forward (line 221) | def forward(
class FastComposerCLIPImageEncoder (line 314) | class FastComposerCLIPImageEncoder(CLIPPreTrainedModel):
method from_pretrained (line 318) | def from_pretrained(global_model_name_or_path):
method __init__ (line 334) | def __init__(
method forward (line 347) | def forward(self, object_pixel_values):
function get_object_transforms (line 375) | def get_object_transforms(cfg):
class FastComposerPostfuseModule (line 428) | class FastComposerPostfuseModule(nn.Module):
method __init__ (line 431) | def __init__(self, embed_dim):
method fuse_fn (line 438) | def fuse_fn(self, text_embeds, object_embeds):
method forward (line 457) | def forward(
function unet_store_cross_attention_scores (line 486) | def unet_store_cross_attention_scores(unet, attention_scores, layers=5):
class BalancedL1Loss (line 530) | class BalancedL1Loss(nn.Module):
method __init__ (line 533) | def __init__(self, threshold=1.0, normalize=False):
method forward (line 538) | def forward(self, object_token_attn_prob, object_segmaps):
function get_object_localization_loss (line 566) | def get_object_localization_loss(
function get_object_localization_loss_for_one_layer (line 585) | def get_object_localization_loss_for_one_layer(
class RandomZoomIn (line 635) | class RandomZoomIn(nn.Module):
method __init__ (line 638) | def __init__(self, min_zoom=1.0, max_zoom=1.5):
method forward (line 643) | def forward(self, image: torch.Tensor):
class PadToSquare (line 663) | class PadToSquare(nn.Module):
method __init__ (line 667) | def __init__(self, fill=0, padding_mode='constant'):
method forward (line 672) | def forward(self, image: torch.Tensor):
class CropTopSquare (line 703) | class CropTopSquare(nn.Module):
method __init__ (line 707) | def __init__(self):
method forward (line 710) | def forward(self, image: torch.Tensor):
class MLP (line 725) | class MLP(nn.Module):
method __init__ (line 728) | def __init__(self, in_dim, out_dim, hidden_dim, use_residual=True):
method forward (line 738) | def forward(self, x):
function fuse_object_embeddings (line 757) | def fuse_object_embeddings(
function build_causal_attention_mask (line 795) | def build_causal_attention_mask(bsz, seq_len, dtype, device=None):
FILE: mmagic/models/editors/fba/fba_decoder.py
class FBADecoder (line 14) | class FBADecoder(nn.Module):
method __init__ (line 28) | def __init__(self,
method init_weights (line 138) | def init_weights(self, pretrained=None):
method forward (line 158) | def forward(self, inputs):
FILE: mmagic/models/editors/fba/fba_encoder.py
class FBAResnetDilated (line 7) | class FBAResnetDilated(ResNet):
method forward (line 10) | def forward(self, x):
FILE: mmagic/models/editors/flavr/flavr.py
class FLAVR (line 10) | class FLAVR(BasicInterpolator):
method merge_frames (line 38) | def merge_frames(input_tensors, output_tensors):
FILE: mmagic/models/editors/flavr/flavr_net.py
class FLAVRNet (line 11) | class FLAVRNet(BaseModule):
method __init__ (line 37) | def __init__(self,
method forward (line 82) | def forward(self, images: torch.Tensor):
class Encoder (line 120) | class Encoder(nn.Module):
method __init__ (line 134) | def __init__(self, block, layers, stem_layer, mid_channels_list, norm_...
method forward (line 174) | def forward(self, x):
method _make_layer (line 192) | def _make_layer(self,
method _initialize_weights (line 239) | def _initialize_weights(self):
class Decoder (line 255) | class Decoder(nn.Module):
method __init__ (line 268) | def __init__(self,
method forward (line 318) | def forward(self, xs):
method _join_tensors (line 345) | def _join_tensors(self, x1, x2):
class UpConv3d (line 359) | class UpConv3d(nn.Module):
method __init__ (line 378) | def __init__(self,
method forward (line 417) | def forward(self, x):
class Conv3d (line 422) | class Conv3d(nn.Module):
method __init__ (line 441) | def __init__(self,
method forward (line 467) | def forward(self, x):
class BasicStem (line 472) | class BasicStem(ConvModule):
method __init__ (line 483) | def __init__(self, out_channels=64, bias=False, norm_cfg=None):
class BasicBlock (line 496) | class BasicBlock(nn.Module):
method __init__ (line 514) | def __init__(
method forward (line 549) | def forward(self, x):
class SEGating (line 572) | class SEGating(nn.Module):
method __init__ (line 579) | def __init__(self, in_channels):
method forward (line 589) | def forward(self, x):
FILE: mmagic/models/editors/gca/gca.py
class GCA (line 10) | class GCA(BaseMattor):
method __init__ (line 28) | def __init__(self,
method _forward (line 44) | def _forward(self, inputs):
method _forward_test (line 57) | def _forward_test(self, inputs):
method _forward_train (line 68) | def _forward_train(self, inputs, data_samples):
FILE: mmagic/models/editors/gca/gca_module.py
class GCAModule (line 9) | class GCAModule(nn.Module):
method __init__ (line 49) | def __init__(self,
method init_weights (line 81) | def init_weights(self):
method forward (line 87) | def forward(self, img_feat, alpha_feat, unknown=None, softmax_scale=1.):
method extract_feature_maps_patches (line 160) | def extract_feature_maps_patches(self, img_feat, alpha_feat, unknown):
method compute_similarity_map (line 198) | def compute_similarity_map(self, img_feat, img_ps):
method compute_guided_attention_score (line 220) | def compute_guided_attention_score(self, similarity_map, unknown_ps, s...
method propagate_alpha_feature (line 252) | def propagate_alpha_feature(self, gca_score, alpha_ps):
method process_unknown_mask (line 276) | def process_unknown_mask(self, unknown, img_feat, softmax_scale):
method extract_patches (line 317) | def extract_patches(self, x, kernel_size, stride):
method pad (line 339) | def pad(self, x, kernel_size, stride):
method get_self_correlation_mask (line 355) | def get_self_correlation_mask(self, img_feat):
method l2_norm (line 375) | def l2_norm(x):
FILE: mmagic/models/editors/gca/resgca_dec.py
class BasicBlockDec (line 14) | class BasicBlockDec(BasicBlock):
method build_conv1 (line 22) | def build_conv1(self, in_channels, out_channels, kernel_size, stride,
method build_conv2 (line 60) | def build_conv2(self, in_channels, out_channels, kernel_size, conv_cfg,
class ResNetDec (line 88) | class ResNetDec(BaseModule):
method __init__ (line 110) | def __init__(self,
method init_weights (line 160) | def init_weights(self):
method _make_layer (line 178) | def _make_layer(self, block, planes, num_blocks, conv_cfg, norm_cfg,
method forward (line 217) | def forward(self, x):
class ResShortcutDec (line 237) | class ResShortcutDec(ResNetDec):
method forward (line 268) | def forward(self, inputs):
class ResGCADecoder (line 302) | class ResGCADecoder(ResShortcutDec):
method __init__ (line 337) | def __init__(self,
method forward (line 353) | def forward(self, inputs):
FILE: mmagic/models/editors/gca/resgca_enc.py
class BasicBlock (line 14) | class BasicBlock(nn.Module):
method __init__ (line 33) | def __init__(self,
method build_conv1 (line 60) | def build_conv1(self, in_channels, out_channels, kernel_size, stride,
method build_conv2 (line 91) | def build_conv2(self, in_channels, out_channels, kernel_size, conv_cfg,
method forward (line 122) | def forward(self, x):
class ResNetEnc (line 146) | class ResNetEnc(BaseModule):
method __init__ (line 170) | def __init__(self,
method init_weights (line 235) | def init_weights(self):
method _make_layer (line 257) | def _make_layer(self, block, planes, num_blocks, stride, conv_cfg,
method forward (line 296) | def forward(self, x):
class ResShortcutEnc (line 318) | class ResShortcutEnc(ResNetEnc):
method __init__ (line 356) | def __init__(self,
method _make_shortcut (line 390) | def _make_shortcut(self, in_channels, out_channels, conv_cfg, norm_cfg,
method forward (line 414) | def forward(self, x):
class ResGCAEncoder (line 449) | class ResGCAEncoder(ResShortcutEnc):
method __init__ (line 490) | def __init__(self,
method forward (line 541) | def forward(self, x):
FILE: mmagic/models/editors/ggan/ggan.py
class GGAN (line 15) | class GGAN(BaseGAN):
method disc_loss (line 21) | def disc_loss(self, disc_pred_fake: Tensor,
method gen_loss (line 48) | def gen_loss(self, disc_pred_fake):
method train_discriminator (line 68) | def train_discriminator(self, inputs: dict, data_samples: List[DataSam...
method train_generator (line 97) | def train_generator(self, inputs: dict, data_samples: List[DataSample],
FILE: mmagic/models/editors/glean/glean_styleganv2.py
class GLEANStyleGANv2 (line 14) | class GLEANStyleGANv2(BaseModule):
method __init__ (line 88) | def __init__(self,
method forward (line 196) | def forward(self, lq):
class RRDBFeatureExtractor (line 274) | class RRDBFeatureExtractor(nn.Module):
method __init__ (line 287) | def __init__(self,
method forward (line 303) | def forward(self, x):
FILE: mmagic/models/editors/global_local/gl_decoder.py
class GLDecoder (line 13) | class GLDecoder(BaseModule):
method __init__ (line 27) | def __init__(self,
method forward (line 100) | def forward(self, x):
FILE: mmagic/models/editors/global_local/gl_dilation.py
class GLDilationNeck (line 11) | class GLDilationNeck(BaseModule):
method __init__ (line 28) | def __init__(self,
method forward (line 52) | def forward(self, x):
FILE: mmagic/models/editors/global_local/gl_disc.py
class GLDiscs (line 11) | class GLDiscs(BaseModule):
method __init__ (line 23) | def __init__(self, global_disc_cfg, local_disc_cfg):
method forward (line 30) | def forward(self, x):
method init_weights (line 49) | def init_weights(self):
FILE: mmagic/models/editors/global_local/gl_encoder.py
class GLEncoder (line 9) | class GLEncoder(BaseModule):
method __init__ (line 20) | def __init__(self, norm_cfg=None, act_cfg=dict(type='ReLU')):
method forward (line 42) | def forward(self, x):
FILE: mmagic/models/editors/global_local/gl_encoder_decoder.py
class GLEncoderDecoder (line 8) | class GLEncoderDecoder(BaseModule):
method __init__ (line 23) | def __init__(self,
method forward (line 35) | def forward(self, x):
FILE: mmagic/models/editors/global_local/gl_inpaintor.py
class GLInpaintor (line 13) | class GLInpaintor(OneStageInpaintor):
method __init__ (line 68) | def __init__(self,
method generator_loss (line 102) | def generator_loss(self, fake_res, fake_img, fake_local, gt, mask,
method train_step (line 150) | def train_step(self, data: List[dict], optim_wrapper):
FILE: mmagic/models/editors/guided_diffusion/adm.py
function classifier_grad (line 20) | def classifier_grad(classifier, x, t, y=None, classifier_scale=1.0):
class AblatedDiffusionModel (line 35) | class AblatedDiffusionModel(BaseModel):
method __init__ (line 51) | def __init__(self,
method load_pretrained_models (line 78) | def load_pretrained_models(self, pretrained_cfgs):
method device (line 98) | def device(self):
method infer (line 107) | def infer(self,
method forward (line 190) | def forward(self,
method val_step (line 241) | def val_step(self, data: dict) -> SampleList:
method test_step (line 259) | def test_step(self, data: dict) -> SampleList:
method train_step (line 273) | def train_step(self, data: dict, optim_wrapper: OptimWrapperDict):
method get_module (line 315) | def get_module(self, model: nn.Module, module_name: str) -> nn.Module:
FILE: mmagic/models/editors/guided_diffusion/classifier.py
function checkpoint (line 16) | def checkpoint(func, inputs, params, flag):
class CheckpointFunction (line 33) | class CheckpointFunction(torch.autograd.Function):
method forward (line 36) | def forward(ctx, run_function, length, *args):
method backward (line 45) | def backward(ctx, *output_grads):
function timestep_embedding (line 67) | def timestep_embedding(timesteps, dim, max_period=10000):
function zero_module (line 89) | def zero_module(module):
class Upsample (line 96) | class Upsample(nn.Module):
method __init__ (line 105) | def __init__(self, channels, use_conv, dims=2, out_channels=None):
method forward (line 115) | def forward(self, x):
class TimestepBlock (line 136) | class TimestepBlock(nn.Module):
method forward (line 141) | def forward(self, x, emb):
class AttentionBlock (line 145) | class AttentionBlock(nn.Module):
method __init__ (line 153) | def __init__(
method forward (line 183) | def forward(self, x):
method _forward (line 195) | def _forward(self, x):
class TimestepEmbedSequential (line 212) | class TimestepEmbedSequential(nn.Sequential, TimestepBlock):
method forward (line 216) | def forward(self, x, emb):
class GroupNorm32 (line 235) | class GroupNorm32(nn.GroupNorm):
method forward (line 237) | def forward(self, x):
function normalization (line 249) | def normalization(channels):
class Downsample (line 258) | class Downsample(nn.Module):
method __init__ (line 267) | def __init__(self, channels, use_conv, dims=2, out_channels=None):
method forward (line 281) | def forward(self, x):
class ResBlock (line 294) | class ResBlock(TimestepBlock):
method __init__ (line 310) | def __init__(
method forward (line 373) | def forward(self, x, emb):
method _forward (line 383) | def _forward(self, x, emb):
class AttentionPool2d (line 415) | class AttentionPool2d(nn.Module):
method __init__ (line 421) | def __init__(
method forward (line 436) | def forward(self, x):
class EncoderUNetModel (line 456) | class EncoderUNetModel(nn.Module):
method __init__ (line 462) | def __init__(
method convert_to_fp16 (line 623) | def convert_to_fp16(self):
method convert_to_fp32 (line 628) | def convert_to_fp32(self):
method forward (line 633) | def forward(self, x, timesteps):
FILE: mmagic/models/editors/iconvsr/iconvsr_net.py
class IconVSRNet (line 20) | class IconVSRNet(BaseModule):
method __init__ (line 45) | def __init__(self,
method spatial_padding (line 93) | def spatial_padding(self, lrs):
method check_if_mirror_extended (line 117) | def check_if_mirror_extended(self, lrs):
method compute_refill_features (line 133) | def compute_refill_features(self, lrs, keyframe_idx):
method compute_flow (line 157) | def compute_flow(self, lrs):
method forward (line 186) | def forward(self, lrs):
class EDVRFeatureExtractor (line 265) | class EDVRFeatureExtractor(BaseModule):
method __init__ (line 290) | def __init__(self,
method forward (line 346) | def forward(self, x):
FILE: mmagic/models/editors/indexnet/indexnet.py
class IndexNet (line 8) | class IndexNet(BaseMattor):
method __init__ (line 27) | def __init__(self,
method _forward (line 47) | def _forward(self, inputs):
method _forward_test (line 59) | def _forward_test(self, inputs):
method _forward_train (line 70) | def _forward_train(self, inputs, data_samples):
FILE: mmagic/models/editors/indexnet/indexnet_decoder.py
class IndexedUpsample (line 16) | class IndexedUpsample(BaseModule):
method __init__ (line 31) | def __init__(self,
method init_weights (line 48) | def init_weights(self):
method forward (line 57) | def forward(self, x, shortcut, dec_idx_feat=None):
class IndexNetDecoder (line 79) | class IndexNetDecoder(BaseModule):
method __init__ (line 94) | def __init__(self,
method init_weights (line 131) | def init_weights(self):
method forward (line 142) | def forward(self, inputs):
FILE: mmagic/models/editors/indexnet/indexnet_encoder.py
function build_index_block (line 17) | def build_index_block(in_channels,
class HolisticIndexBlock (line 81) | class HolisticIndexBlock(BaseModule):
method __init__ (line 96) | def __init__(self,
method forward (line 123) | def forward(self, x):
class DepthwiseIndexBlock (line 144) | class DepthwiseIndexBlock(BaseModule):
method __init__ (line 162) | def __init__(self,
method forward (line 194) | def forward(self, x):
class InvertedResidual (line 222) | class InvertedResidual(BaseModule):
method __init__ (line 241) | def __init__(self,
method pad (line 285) | def pad(self, inputs, kernel_size, dilation):
method forward (line 301) | def forward(self, x):
class IndexNetEncoder (line 319) | class IndexNetEncoder(BaseModule):
method __init__ (line 357) | def __init__(self,
method _make_layer (line 462) | def _make_layer(self, layer_setting, norm_cfg):
method train (line 489) | def train(self, mode=True):
method init_weights (line 497) | def init_weights(self):
method forward (line 516) | def forward(self, x):
FILE: mmagic/models/editors/inst_colorization/color_utils.py
function xyz2rgb (line 6) | def xyz2rgb(xyz):
function lab2xyz (line 35) | def lab2xyz(lab):
function lab2rgb (line 68) | def lab2rgb(lab_rs, color_data_opt):
function encode_ab_ind (line 87) | def encode_ab_ind(data_ab, color_data_opt):
function rgb2xyz (line 105) | def rgb2xyz(rgb):
function xyz2lab (line 136) | def xyz2lab(xyz):
function rgb2lab (line 169) | def rgb2lab(rgb, color_opt):
function get_colorization_data (line 187) | def get_colorization_data(data_raw, color_opt, num_points=None):
function add_color_patches_rand_gt (line 224) | def add_color_patches_rand_gt(data,
FILE: mmagic/models/editors/inst_colorization/colorization_net.py
class ColorizationNet (line 12) | class ColorizationNet(BaseModule):
method __init__ (line 30) | def __init__(self,
method forward (line 258) | def forward(self, input_A, input_B, mask_B):
FILE: mmagic/models/editors/inst_colorization/fusion_net.py
class FusionNet (line 11) | class FusionNet(BaseModule):
method __init__ (line 29) | def __init__(self,
method forward (line 285) | def forward(self, input_A, input_B, mask_B, instance_feature,
FILE: mmagic/models/editors/inst_colorization/inst_colorization.py
class InstColorization (line 15) | class InstColorization(BaseModel):
method __init__ (line 39) | def __init__(self,
method forward (line 70) | def forward(self,
method convert_to_datasample (line 135) | def convert_to_datasample(self, inputs, data_samples):
method forward_train (line 152) | def forward_train(self, inputs, data_samples=None, **kwargs):
method train_step (line 157) | def train_step(self, data: List[dict],
method forward_inference (line 172) | def forward_inference(self, inputs, data_samples=None, **kwargs):
method forward_tensor (line 195) | def forward_tensor(self, inputs, data_samples):
FILE: mmagic/models/editors/inst_colorization/weight_layer.py
function get_norm_layer (line 11) | def get_norm_layer(norm_type='instance'):
class WeightLayer (line 34) | class WeightLayer(BaseModule):
method __init__ (line 45) | def __init__(self, input_ch, inner_ch=16):
method resize_and_pad (line 67) | def resize_and_pad(self, feauture_maps, info_array):
method forward (line 88) | def forward(self, instance_feature, bg_feature, box_info):
FILE: mmagic/models/editors/liif/liif.py
class LIIF (line 12) | class LIIF(BaseEditModel):
method forward_tensor (line 26) | def forward_tensor(self, inputs, data_samples=None, **kwargs):
method forward_inference (line 46) | def forward_inference(self, inputs, data_samples=None, **kwargs):
FILE: mmagic/models/editors/liif/liif_net.py
class LIIFNet (line 11) | class LIIFNet(BaseModule):
method __init__ (line 31) | def __init__(self,
method forward (line 56) | def forward(self, x, coord, cell, test_mode=False):
method query_rgb (line 77) | def query_rgb(self, feature, coord, cell=None):
method batched_predict (line 172) | def batched_predict(self, x, coord, cell):
method gen_feature (line 197) | def gen_feature(self, x):
class LIIFEDSRNet (line 209) | class LIIFEDSRNet(LIIFNet):
method __init__ (line 224) | def __init__(self,
method gen_feature (line 244) | def gen_feature(self, x):
class LIIFRDNNet (line 263) | class LIIFRDNNet(LIIFNet):
method __init__ (line 278) | def __init__(self,
method gen_feature (line 300) | def gen_feature(self, x):
FILE: mmagic/models/editors/liif/mlp_refiner.py
class MLPRefiner (line 9) | class MLPRefiner(BaseModule):
method __init__ (line 18) | def __init__(self, in_dim, out_dim, hidden_list):
method forward (line 30) | def forward(self, x):
FILE: mmagic/models/editors/lsgan/lsgan.py
class LSGAN (line 15) | class LSGAN(BaseGAN):
method disc_loss (line 26) | def disc_loss(self, disc_pred_fake: Tensor,
method gen_loss (line 54) | def gen_loss(self, disc_pred_fake: Tensor) -> Tuple:
method train_discriminator (line 74) | def train_discriminator(self, inputs: dict, data_samples: DataSample,
method train_generator (line 103) | def train_generator(self, inputs: dict, data_samples: List[DataSample],
FILE: mmagic/models/editors/lsgan/lsgan_discriminator.py
class LSGANDiscriminator (line 11) | class LSGANDiscriminator(BaseModule):
method __init__ (line 47) | def __init__(self,
method forward (line 105) | def forward(self, x):
FILE: mmagic/models/editors/lsgan/lsgan_generator.py
class LSGANGenerator (line 13) | class LSGANGenerator(BaseModule):
method __init__ (line 51) | def __init__(self,
method forward (line 137) | def forward(self, noise, num_batches=0, return_noise=False):
FILE: mmagic/models/editors/mspie/mspie_stylegan2.py
class MSPIEStyleGAN2 (line 26) | class MSPIEStyleGAN2(StyleGAN2):
method __init__ (line 38) | def __init__(self, *args, train_settings=dict(), **kwargs):
method train_step (line 52) | def train_step(self, data: dict,
method train_generator (line 128) | def train_generator(self, inputs: dict, data_samples: DataSample,
method train_discriminator (line 154) | def train_discriminator(self, inputs: dict, data_samples: DataSample,
FILE: mmagic/models/editors/mspie/mspie_stylegan2_discriminator.py
class MSStyleGAN2Discriminator (line 12) | class MSStyleGAN2Discriminator(BaseModule):
method __init__ (line 29) | def __init__(self,
method forward (line 81) | def forward(self, x):
FILE: mmagic/models/editors/mspie/mspie_stylegan2_generator.py
class MSStyleGANv2Generator (line 22) | class MSStyleGANv2Generator(BaseModule):
method __init__ (line 49) | def __init__(self,
method train (line 192) | def train(self, mode=True):
method make_injected_noise (line 212) | def make_injected_noise(self, chosen_scale=0):
method get_mean_latent (line 242) | def get_mean_latent(self, num_samples=4096, **kwargs):
method style_mixing (line 254) | def style_mixing(self,
method forward (line 289) | def forward(self,
FILE: mmagic/models/editors/mspie/mspie_stylegan2_modules.py
class ModulatedPEConv2d (line 22) | class ModulatedPEConv2d(BaseModule):
method __init__ (line 62) | def __init__(self,
method forward (line 138) | def forward(self, x, style):
class ModulatedPEStyleConv (line 207) | class ModulatedPEStyleConv(BaseModule):
method __init__ (line 235) | def __init__(self,
method forward (line 263) | def forward(self, x, style, noise=None, return_noise=False):
FILE: mmagic/models/editors/mspie/pe_singan.py
class PESinGAN (line 17) | class PESinGAN(SinGAN):
method __init__ (line 24) | def __init__(self,
method construct_fixed_noises (line 45) | def construct_fixed_noises(self):
FILE: mmagic/models/editors/mspie/pe_singan_generator.py
class SinGANMSGeneratorPE (line 16) | class SinGANMSGeneratorPE(SinGANMultiScaleGenerator):
method __init__ (line 61) | def __init__(self,
method forward (line 133) | def forward(self,
FILE: mmagic/models/editors/mspie/positional_encoding.py
class SinusoidalPositionalEmbedding (line 11) | class SinusoidalPositionalEmbedding(BaseModule):
method __init__ (line 35) | def __init__(self,
method get_embedding (line 55) | def get_embedding(num_embeddings,
method forward (line 85) | def forward(self, input, **kwargs):
method make_positions (line 111) | def make_positions(self, input, padding_idx):
method make_grid2d (line 127) | def make_grid2d(self, height, width, num_batches=1, center_shift=None):
method make_grid2d_like (line 188) | def make_grid2d_like(self, x, center_shift=None):
class CatersianGrid (line 205) | class CatersianGrid(BaseModule):
method forward (line 214) | def forward(self, x, **kwargs):
method make_grid2d (line 218) | def make_grid2d(self, height, width, num_batches=1, requires_grad=False):
method make_grid2d_like (line 231) | def make_grid2d_like(self, x, requires_grad=False):
FILE: mmagic/models/editors/nafnet/naf_avgpool2d.py
class NAFAvgPool2d (line 9) | class NAFAvgPool2d(BaseModule):
method __init__ (line 19) | def __init__(self,
method extra_repr (line 37) | def extra_repr(self) -> str:
method forward (line 41) | def forward(self, x):
function replace_layers (line 103) | def replace_layers(model, base_size, train_size, fast_imp, **kwargs):
class Local_Base (line 117) | class Local_Base():
method convert (line 124) | def convert(self, *args, train_size, **kwargs):
FILE: mmagic/models/editors/nafnet/naf_layerNorm2d.py
class LayerNormFunction (line 7) | class LayerNormFunction(torch.autograd.Function):
method forward (line 11) | def forward(ctx, x, weight, bias, eps):
method backward (line 22) | def backward(ctx, grad_output):
class LayerNorm2d (line 36) | class LayerNorm2d(nn.Module):
method __init__ (line 45) | def __init__(self, channels, eps=1e-6):
method forward (line 51) | def forward(self, x):
FILE: mmagic/models/editors/nafnet/nafbaseline_net.py
class NAFBaseline (line 14) | class NAFBaseline(BaseModule):
method __init__ (line 26) | def __init__(self,
method forward (line 89) | def forward(self, inp):
method check_image_size (line 119) | def check_image_size(self, x):
class NAFBaselineLocal (line 136) | class NAFBaselineLocal(Local_Base, NAFBaseline):
method __init__ (line 148) | def __init__(self,
class BaselineBlock (line 166) | class BaselineBlock(BaseModule):
method __init__ (line 176) | def __init__(self,
method forward (line 262) | def forward(self, inp):
FILE: mmagic/models/editors/nafnet/nafnet_net.py
class NAFNet (line 14) | class NAFNet(BaseModule):
method __init__ (line 27) | def __init__(self,
method forward (line 81) | def forward(self, inp):
method check_image_size (line 111) | def check_image_size(self, x):
class NAFNetLocal (line 128) | class NAFNetLocal(Local_Base, NAFNet):
method __init__ (line 142) | def __init__(self,
class NAFBlock (line 162) | class NAFBlock(BaseModule):
method __init__ (line 176) | def __init__(self,
method forward (line 264) | def forward(self, inp):
class SimpleGate (line 294) | class SimpleGate(BaseModule):
method forward (line 305) | def forward(self, x):
FILE: mmagic/models/editors/pconv/mask_conv_module.py
class MaskConvModule (line 5) | class MaskConvModule(ConvModule):
method __init__ (line 38) | def __init__(self, *args, **kwargs):
method forward (line 44) | def forward(self,
FILE: mmagic/models/editors/pconv/partial_conv.py
class PartialConv2d (line 11) | class PartialConv2d(nn.Conv2d):
method __init__ (line 24) | def __init__(self, *args, multi_channel=False, eps=1e-8, **kwargs):
method forward (line 44) | def forward(self, input, mask=None, return_mask=True):
FILE: mmagic/models/editors/pconv/pconv_decoder.py
class PConvDecoder (line 11) | class PConvDecoder(BaseModule):
method __init__ (line 26) | def __init__(self,
method forward (line 89) | def forward(self, input_dict):
FILE: mmagic/models/editors/pconv/pconv_encoder.py
class PConvEncoder (line 10) | class PConvEncoder(BaseModule):
method __init__ (line 28) | def __init__(self,
method train (line 92) | def train(self, mode=True):
method forward (line 101) | def forward(self, x, mask):
FILE: mmagic/models/editors/pconv/pconv_encoder_decoder.py
class PConvEncoderDecoder (line 8) | class PConvEncoderDecoder(BaseModule):
method __init__ (line 16) | def __init__(self, encoder, decoder):
method forward (line 24) | def forward(self, x, mask_in):
FILE: mmagic/models/editors/pconv/pconv_inpaintor.py
class PConvInpaintor (line 9) | class PConvInpaintor(OneStageInpaintor):
method forward_tensor (line 16) | def forward_tensor(self, inputs, data_samples):
method train_step (line 35) | def train_step(self, data: List[dict], optim_wrapper):
FILE: mmagic/models/editors/pggan/pggan.py
class ProgressiveGrowingGAN (line 29) | class ProgressiveGrowingGAN(BaseGAN):
method __init__ (line 57) | def __init__(self,
method forward (line 113) | def forward(self,
method train_discriminator (line 205) | def train_discriminator(self, inputs: Tensor,
method disc_loss (line 246) | def disc_loss(self, disc_pred_fake: Tensor, disc_pred_real: Tensor,
method train_generator (line 306) | def train_generator(self, inputs: Tensor, data_samples: List[DataSample],
method gen_loss (line 338) | def gen_loss(self, disc_pred_fake: Tensor) -> Tuple[Tensor, dict]:
method train_step (line 359) | def train_step(self, data: dict, optim_wrapper: OptimWrapperDict):
FILE: mmagic/models/editors/pggan/pggan_discriminator.py
class PGGANDiscriminator (line 16) | class PGGANDiscriminator(BaseModule):
method __init__ (line 69) | def __init__(self,
method _num_out_channels (line 147) | def _num_out_channels(self, log_scale: int) -> int:
method _get_fromrgb_layer (line 161) | def _get_fromrgb_layer(self, in_channels: int,
method _get_convdown_block (line 176) | def _get_convdown_block(self, in_channels: int,
method forward (line 211) | def forward(self, x, transition_weight=1., curr_scale=-1):
FILE: mmagic/models/editors/pggan/pggan_generator.py
class PGGANGenerator (line 16) | class PGGANGenerator(BaseModule):
method __init__ (line 61) | def __init__(self,
method _get_torgb_layer (line 118) | def _get_torgb_layer(self, in_channels: int):
method _num_out_channels (line 137) | def _num_out_channels(self, log_scale: int):
method _get_upconv_block (line 151) | def _get_upconv_block(self, in_channels, log_scale):
method forward (line 190) | def forward(self,
FILE: mmagic/models/editors/pggan/pggan_modules.py
class EqualizedLR (line 16) | class EqualizedLR:
method __init__ (line 36) | def __init__(self, name='weight', gain=2**0.5, mode='fan_in', lr_mul=1...
method compute_weight (line 42) | def compute_weight(self, module):
method __call__ (line 64) | def __call__(self, module, inputs):
method apply (line 69) | def apply(module, name, gain=2**0.5, mode='fan_in', lr_mul=1.):
function equalized_lr (line 112) | def equalized_lr(module, name='weight', gain=2**0.5, mode='fan_in', lr_m...
function pixel_norm (line 140) | def pixel_norm(x, eps=1e-6):
class PixelNorm (line 165) | class PixelNorm(BaseModule):
method __init__ (line 177) | def __init__(self, in_channels=None, eps=1e-6):
method forward (line 181) | def forward(self, x):
class EqualizedLRConvModule (line 194) | class EqualizedLRConvModule(ConvModule):
method __init__ (line 210) | def __init__(self, *args, equalized_lr_cfg=dict(mode='fan_in'), **kwar...
method _init_conv_weights (line 218) | def _init_conv_weights(self):
class EqualizedLRConvUpModule (line 224) | class EqualizedLRConvUpModule(EqualizedLRConvModule):
method __init__ (line 242) | def __init__(self,
method forward (line 256) | def forward(self, x, **kwargs):
method fused_nn_hook (line 270) | def fused_nn_hook(module, inputs):
class EqualizedLRConvDownModule (line 281) | class EqualizedLRConvDownModule(EqualizedLRConvModule):
method __init__ (line 300) | def __init__(self, *args, downsample=dict(type='fused_pool'), **kwargs):
method forward (line 318) | def forward(self, x, **kwargs):
method fused_avgpool_hook (line 333) | def fused_avgpool_hook(module, inputs):
class EqualizedLRLinearModule (line 344) | class EqualizedLRLinearModule(nn.Linear):
method __init__ (line 360) | def __init__(self, *args, equalized_lr_cfg=dict(mode='fan_in'), **kwar...
method _init_linear_weights (line 373) | def _init_linear_weights(self):
class PGGANNoiseTo2DFeat (line 381) | class PGGANNoiseTo2DFeat(BaseModule):
method __init__ (line 383) | def __init__(self,
method forward (line 417) | def forward(self, x):
class PGGANDecisionHead (line 443) | class PGGANDecisionHead(BaseModule):
method __init__ (line 445) | def __init__(self,
method forward (line 484) | def forward(self, x):
class MiniBatchStddevLayer (line 508) | class MiniBatchStddevLayer(BaseModule):
method __init__ (line 520) | def __init__(self, group_size=4, eps=1e-8, gather_all_batch=False):
method forward (line 529) | def forward(self, x):
FILE: mmagic/models/editors/pix2pix/pix2pix.py
class Pix2Pix (line 14) | class Pix2Pix(BaseTranslationModel):
method __init__ (line 21) | def __init__(self, *args, **kwargs):
method forward_test (line 25) | def forward_test(self, img, target_domain, **kwargs):
method _get_disc_loss (line 43) | def _get_disc_loss(self, outputs):
method _get_gen_loss (line 74) | def _get_gen_loss(self, outputs):
method train_step (line 105) | def train_step(self, data, optim_wrapper=None):
method test_step (line 168) | def test_step(self, data: dict) -> SampleList:
method val_step (line 198) | def val_step(self, data: dict) -> SampleList:
FILE: mmagic/models/editors/pix2pix/pix2pix_generator.py
class UnetGenerator (line 10) | class UnetGenerator(BaseModule):
method __init__ (line 31) | def __init__(self,
method forward (line 96) | def forward(self, x):
method init_weights (line 107) | def init_weights(self):
FILE: mmagic/models/editors/pix2pix/pix2pix_modules.py
class UnetSkipConnectionBlock (line 7) | class UnetSkipConnectionBlock(nn.Module):
method __init__ (line 28) | def __init__(self,
method forward (line 110) | def forward(self, x):
FILE: mmagic/models/editors/plain/plain_decoder.py
class MaxUnpool2dop (line 16) | class MaxUnpool2dop(Function):
method forward (line 24) | def forward(ctx, input, indices, kernel_size, stride, padding,
method symbolic (line 42) | def symbolic(g, input, indices, kernel_size, stride, padding, output_s...
class MaxUnpool2d (line 121) | class MaxUnpool2d(_MaxUnpoolNd):
method __init__ (line 132) | def __init__(self, kernel_size, stride=None, padding=0):
method forward (line 138) | def forward(self, input, indices, output_size=None):
class PlainDecoder (line 154) | class PlainDecoder(BaseModule):
method __init__ (line 162) | def __init__(self, in_channels, init_cfg: Optional[dict] = None):
method init_weights (line 178) | def init_weights(self):
method forward (line 188) | def forward(self, inputs):
FILE: mmagic/models/editors/plain/plain_refiner.py
class PlainRefiner (line 11) | class PlainRefiner(BaseModule):
method __init__ (line 20) | def __init__(self, conv_channels=64, init_cfg=None):
method init_weights (line 36) | def init_weights(self):
method forward (line 42) | def forward(self, x, raw_alpha):
FILE: mmagic/models/editors/rdn/rdn_net.py
class RDNNet (line 9) | class RDNNet(BaseModule):
method __init__ (line 37) | def __init__(self,
method forward (line 101) | def forward(self, x):
class DenseLayer (line 127) | class DenseLayer(BaseModule):
method __init__ (line 135) | def __init__(self, in_channels, out_channels):
method forward (line 141) | def forward(self, x):
class RDB (line 153) | class RDB(BaseModule):
method __init__ (line 162) | def __init__(self, in_channels, channel_growth, num_layers):
method forward (line 175) | def forward(self, x):
FILE: mmagic/models/editors/real_basicvsr/real_basicvsr.py
class RealBasicVSR (line 14) | class RealBasicVSR(RealESRGAN):
method __init__ (line 54) | def __init__(self,
method extract_gt_data (line 88) | def extract_gt_data(self, data_samples):
method g_step (line 117) | def g_step(self, batch_outputs, batch_gt_data):
method train_step (line 141) | def train_step(self, data: List[dict],
method forward_train (line 199) | def forward_train(self, batch_inputs, data_samples=None):
FILE: mmagic/models/editors/real_basicvsr/real_basicvsr_net.py
class RealBasicVSRNet (line 11) | class RealBasicVSRNet(BaseModule):
method __init__ (line 37) | def __init__(self,
method forward (line 65) | def forward(self, lqs, return_lqs=False):
FILE: mmagic/models/editors/real_esrgan/real_esrgan.py
class RealESRGAN (line 11) | class RealESRGAN(SRGAN):
method __init__ (line 54) | def __init__(self,
method forward_tensor (line 95) | def forward_tensor(self, inputs, data_samples=None, training=False):
method g_step (line 116) | def g_step(self, batch_outputs, batch_gt_data):
method d_step_real (line 151) | def d_step_real(self, batch_outputs, batch_gt_data: torch.Tensor):
method d_step_fake (line 171) | def d_step_fake(self, batch_outputs, batch_gt_data):
method extract_gt_data (line 189) | def extract_gt_data(self, data_samples):
FILE: mmagic/models/editors/real_esrgan/unet_disc.py
class UNetDiscriminatorWithSpectralNorm (line 10) | class UNetDiscriminatorWithSpectralNorm(BaseModule):
method __init__ (line 21) | def __init__(self, in_channels, mid_channels=64, skip_connection=True):
method forward (line 57) | def forward(self, img):
FILE: mmagic/models/editors/restormer/restormer_net.py
function to_3d (line 14) | def to_3d(x):
function to_4d (line 19) | def to_4d(x, h, w):
class BiasFree_LayerNorm (line 24) | class BiasFree_LayerNorm(BaseModule):
method __init__ (line 31) | def __init__(self, normalized_shape):
method forward (line 42) | def forward(self, x):
class WithBias_LayerNorm (line 55) | class WithBias_LayerNorm(BaseModule):
method __init__ (line 62) | def __init__(self, normalized_shape):
method forward (line 74) | def forward(self, x):
class LayerNorm (line 88) | class LayerNorm(BaseModule):
method __init__ (line 98) | def __init__(self, dim, LayerNorm_type):
method forward (line 105) | def forward(self, x):
class FeedForward (line 118) | class FeedForward(BaseModule):
method __init__ (line 130) | def __init__(self, dim, ffn_expansion_factor, bias):
method forward (line 150) | def forward(self, x):
class Attention (line 166) | class Attention(BaseModule):
method __init__ (line 178) | def __init__(self, dim, num_heads, bias):
method forward (line 194) | def forward(self, x):
class TransformerBlock (line 234) | class TransformerBlock(BaseModule):
method __init__ (line 248) | def __init__(self, dim, num_heads, ffn_expansion_factor, bias,
method forward (line 257) | def forward(self, x):
class OverlapPatchEmbed (line 272) | class OverlapPatchEmbed(BaseModule):
method __init__ (line 281) | def __init__(self, in_c=3, embed_dim=48, bias=False):
method forward (line 287) | def forward(self, x):
class Downsample (line 301) | class Downsample(BaseModule):
method __init__ (line 308) | def __init__(self, n_feat):
method forward (line 320) | def forward(self, x):
class Upsample (line 332) | class Upsample(BaseModule):
method __init__ (line 339) | def __init__(self, n_feat):
method forward (line 351) | def forward(self, x):
class Restormer (line 364) | class Restormer(BaseModule):
method __init__ (line 391) | def __init__(self,
method forward (line 506) | def forward(self, inp_img):
FILE: mmagic/models/editors/sagan/sagan.py
class SAGAN (line 21) | class SAGAN(BaseConditionalGAN):
method __init__ (line 52) | def __init__(self,
method disc_loss (line 65) | def disc_loss(self, disc_pred_fake: Tensor,
method gen_loss (line 92) | def gen_loss(self, disc_pred_fake: Tensor) -> Tuple[Tensor, dict]:
method train_discriminator (line 112) | def train_discriminator(self, inputs: dict, data_samples: DataSample,
method train_generator (line 146) | def train_generator(self, inputs: dict, data_samples: DataSample,
FILE: mmagic/models/editors/sagan/sagan_discriminator.py
class ProjDiscriminator (line 19) | class ProjDiscriminator(BaseModule):
method __init__ (line 120) | def __init__(self,
method forward (line 248) | def forward(self, x, label=None):
method init_weights (line 273) | def init_weights(self, pretrained=None, strict=True):
FILE: mmagic/models/editors/sagan/sagan_generator.py
class SNGANGenerator (line 23) | class SNGANGenerator(BaseModule):
method __init__ (line 122) | def __init__(self,
method forward (line 240) | def forward(self, noise, num_batches=0, label=None, return_noise=False):
method init_weights (line 320) | def init_weights(self, pretrained=None, strict=True):
FILE: mmagic/models/editors/sagan/sagan_modules.py
class SNGANGenResBlock (line 19) | class SNGANGenResBlock(BaseModule):
method __init__ (line 68) | def __init__(self,
method forward (line 144) | def forward(self, x, y=None):
method forward_shortcut (line 169) | def forward_shortcut(self, x):
method init_weights (line 185) | def init_weights(self):
class SNGANDiscResBlock (line 216) | class SNGANDiscResBlock(BaseModule):
method __init__ (line 247) | def __init__(self,
method forward (line 302) | def forward(self, x):
method forward_shortcut (line 322) | def forward_shortcut(self, x: Tensor) -> Tensor:
method init_weights (line 338) | def init_weights(self):
class SNGANDiscHeadResBlock (line 369) | class SNGANDiscHeadResBlock(BaseModule):
method __init__ (line 398) | def __init__(self,
method forward (line 445) | def forward(self, x: Tensor) -> Tensor:
method forward_shortcut (line 462) | def forward_shortcut(self, x: Tensor) -> Tensor:
method init_weights (line 475) | def init_weights(self):
class SNConditionNorm (line 499) | class SNConditionNorm(BaseModule):
method __init__ (line 538) | def __init__(self,
method forward (line 599) | def forward(self, x, y=None):
method init_weights (line 621) | def init_weights(self):
FILE: mmagic/models/editors/singan/singan.py
class SinGAN (line 28) | class SinGAN(BaseGAN):
method __init__ (line 79) | def __init__(self,
method load_test_pkl (line 111) | def load_test_pkl(self):
method _from_numpy (line 123) | def _from_numpy(self,
method get_module (line 146) | def get_module(self, model: nn.Module, module_name: str) -> nn.Module:
method construct_fixed_noises (line 162) | def construct_fixed_noises(self):
method forward (line 173) | def forward(self,
method gen_loss (line 323) | def gen_loss(self, disc_pred_fake: Tensor,
method disc_loss (line 348) | def disc_loss(self, disc_pred_fake: Tensor, disc_pred_real: Tensor,
method train_generator (line 402) | def train_generator(self, inputs: dict, data_samples: List[DataSample],
method train_discriminator (line 436) | def train_discriminator(self, inputs: dict, data_samples: List[DataSam...
method train_gan (line 467) | def train_gan(self, inputs_dict: dict, data_sample: List[DataSample],
method train_step (line 543) | def train_step(self, data: dict,
method test_step (line 640) | def test_step(self, data: dict) -> SampleList:
FILE: mmagic/models/editors/singan/singan_discriminator.py
class SinGANMultiScaleDiscriminator (line 12) | class SinGANMultiScaleDiscriminator(BaseModule):
method __init__ (line 36) | def __init__(self,
method forward (line 63) | def forward(self, x, curr_scale):
method check_and_load_prev_weight (line 77) | def check_and_load_prev_weight(self, curr_scale):
FILE: mmagic/models/editors/singan/singan_generator.py
class SinGANMultiScaleGenerator (line 17) | class SinGANMultiScaleGenerator(BaseModule):
method __init__ (line 50) | def __init__(self,
method forward (line 91) | def forward(self,
method check_and_load_prev_weight (line 169) | def check_and_load_prev_weight(self, curr_scale):
FILE: mmagic/models/editors/singan/singan_modules.py
class GeneratorBlock (line 10) | class GeneratorBlock(nn.Module):
method __init__ (line 36) | def __init__(self,
method forward (line 94) | def forward(self, x, prev):
method init_weights (line 114) | def init_weights(self, pretrained=None):
class DiscriminatorBlock (line 129) | class DiscriminatorBlock(nn.Module):
method __init__ (line 149) | def __init__(self,
method forward (line 202) | def forward(self, x):
method init_weights (line 218) | def init_weights(self, pretrained=None):
FILE: mmagic/models/editors/srcnn/srcnn_net.py
class SRCNNNet (line 9) | class SRCNNNet(BaseModule):
method __init__ (line 27) | def __init__(self,
method forward (line 61) | def forward(self, x):
FILE: mmagic/models/editors/srgan/modified_vgg.py
class ModifiedVGG (line 9) | class ModifiedVGG(BaseModule):
method __init__ (line 20) | def __init__(self, in_channels, mid_channels):
method forward (line 62) | def forward(self, x):
FILE: mmagic/models/editors/srgan/sr_resnet.py
class MSRResNet (line 11) | class MSRResNet(BaseModule):
method __init__ (line 31) | def __init__(self,
method forward (line 83) | def forward(self, x):
method init_weights (line 107) | def init_weights(self):
FILE: mmagic/models/editors/srgan/srgan.py
class SRGAN (line 13) | class SRGAN(BaseEditModel):
method __init__ (line 35) | def __init__(self,
method forward_train (line 76) | def forward_train(self, inputs, data_samples=None, **kwargs):
method forward_tensor (line 92) | def forward_tensor(self, inputs, data_samples=None, training=False):
method if_run_g (line 110) | def if_run_g(self):
method if_run_d (line 116) | def if_run_d(self):
method g_step (line 121) | def g_step(self, batch_outputs: torch.Tensor, batch_gt_data: torch.Ten...
method d_step_real (line 155) | def d_step_real(self, batch_outputs, batch_gt_data: torch.Tensor):
method d_step_fake (line 173) | def d_step_fake(self, batch_outputs: torch.Tensor, batch_gt_data):
method g_step_with_optim (line 191) | def g_step_with_optim(self, batch_outputs: torch.Tensor,
Copy disabled (too large)
Download .json
Condensed preview — 1687 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (20,088K chars).
[
{
"path": ".circleci/config.yml",
"chars": 1462,
"preview": "version: 2.1\n\n# this allows you to use CircleCI's dynamic configuration feature\nsetup: true\n\n# the path-filtering orb is"
},
{
"path": ".circleci/docker/Dockerfile",
"chars": 531,
"preview": "ARG PYTORCH=\"1.8.1\"\nARG CUDA=\"10.2\"\nARG CUDNN=\"7\"\n\nFROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel\n\n# To"
},
{
"path": ".circleci/test.yml",
"chars": 5521,
"preview": "version: 2.1\n\n# the default pipeline parameters, which will be updated according to\n# the results of the path-filtering "
},
{
"path": ".dele.yml",
"chars": 1128,
"preview": "dele_rules:\n issue:\n create:\n - name: \"english needs\"\n conditions:\n - \"issue.title ~= ANSI\"\n "
},
{
"path": ".dev_scripts/README.md",
"chars": 8469,
"preview": "# Scripts for developing MMagic\n\n- [1. Check UT](#1-check-ut)\n- [2. Test all the models](#2-test-all-the-models)\n- [3. T"
},
{
"path": ".dev_scripts/create_ceph_configs.py",
"chars": 13197,
"preview": "import glob\nimport os.path as osp\nimport shutil\nfrom argparse import ArgumentParser\nfrom copy import deepcopy\n\nfrom mmen"
},
{
"path": ".dev_scripts/doc_link_checker.py",
"chars": 3487,
"preview": "# Copyright (c) MegFlow. All rights reserved.\n# Copyright (c) OpenMMLab. All rights reserved.\n# /bin/python3\n\nimport arg"
},
{
"path": ".dev_scripts/download_models.py",
"chars": 5443,
"preview": "#!/usr/bin/env python\n# Copyright (c) OpenMMLab. All rights reserved.\n\nimport argparse\nimport os\nimport platform\nimport "
},
{
"path": ".dev_scripts/inference_benchmark.sh",
"chars": 5061,
"preview": "python demo/download_inference_resources.py\n\n# Text-to-Image\npython demo/mmagic_inference_demo.py \\\n --model-name"
},
{
"path": ".dev_scripts/job_watcher.py",
"chars": 5689,
"preview": "import os\nimport os.path as osp\nimport time\nfrom argparse import ArgumentParser\nfrom functools import partial\n\nfrom pret"
},
{
"path": ".dev_scripts/metric_mapping.py",
"chars": 4529,
"preview": "# key-in-metafile: key-in-results.pkl\nMETRICS_MAPPING = {\n 'FID': {\n 'keys': ['FID-Full-50k/fid'],\n 'to"
},
{
"path": ".dev_scripts/task_mapping.py",
"chars": 680,
"preview": "TASK_MAPPING = {\n 'Inpainting': [\n 'aot-gan',\n 'deepfillv1',\n 'deepfillv2',\n 'global_loca"
},
{
"path": ".dev_scripts/test_benchmark.py",
"chars": 14872,
"preview": "import argparse\nimport os\nimport os.path as osp\nimport pickle\nimport re\nfrom collections import OrderedDict, defaultdict"
},
{
"path": ".dev_scripts/test_benchmark.yml",
"chars": 2996,
"preview": "cases:\n- name: controlnet-1xb1-fill50k\n params:\n config: configs/controlnet/controlnet-1xb1-fill50k.py\n cpus_per_"
},
{
"path": ".dev_scripts/train_benchmark.py",
"chars": 15834,
"preview": "import argparse\nimport os\nimport os.path as osp\nimport pickle\nimport re\nfrom collections import OrderedDict\nfrom datetim"
},
{
"path": ".dev_scripts/train_benchmark.yml",
"chars": 2997,
"preview": "cases:\n- name: controlnet-1xb1-fill50k\n params:\n config: configs/controlnet/controlnet-1xb1-fill50k.py\n cpus_per_"
},
{
"path": ".dev_scripts/update_config_readme.py",
"chars": 2384,
"preview": "#!/usr/bin/env python\n# Copyright (c) OpenMMLab. All rights reserved.\n\n# This tool is used to update README.md and READM"
},
{
"path": ".dev_scripts/update_model_index.py",
"chars": 10870,
"preview": "#!/usr/bin/env python\n# Copyright (c) OpenMMLab. All rights reserved.\n\"\"\"This tool is used to update model-index.yml whi"
},
{
"path": ".dev_scripts/update_ut.py",
"chars": 2302,
"preview": "import os\nimport os.path as osp\nfrom argparse import ArgumentParser\nfrom fnmatch import fnmatch\nfrom glob import glob\n\nf"
},
{
"path": ".dev_scripts/utils/__init__.py",
"chars": 448,
"preview": "from .job_util import (filter_jobs, get_info_from_id, parse_job_list,\n parse_job_list_from_file)\nf"
},
{
"path": ".dev_scripts/utils/job_util.py",
"chars": 3973,
"preview": "import os\nimport os.path as osp\nfrom typing import Tuple\n\nfrom rich import print as pprint\nfrom rich.table import Table\n"
},
{
"path": ".dev_scripts/utils/modelindex.py",
"chars": 2405,
"preview": "import os.path as osp\n\nimport mmengine\nfrom modelindex.models.Collection import Collection\nfrom modelindex.models.Model "
},
{
"path": ".github/CODE_OF_CONDUCT.md",
"chars": 3355,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": ".github/CONTRIBUTING.md",
"chars": 2265,
"preview": "# Contributing to MMagic\n\nAll kinds of contributions are welcome, including but not limited to the following.\n\n- Fix typ"
},
{
"path": ".github/ISSUE_TEMPLATE/1-bug-report.yml",
"chars": 3891,
"preview": "name: \"🐞 Bug report\"\ndescription: \"Create a report to help us reproduce and fix the bug\"\nlabels: \"kind/bug,status/unconf"
},
{
"path": ".github/ISSUE_TEMPLATE/2-feature-request.yml",
"chars": 1072,
"preview": "name: 🚀 Feature request\ndescription: Suggest an idea for this project\nlabels: \"kind/enhancement,status/unconfirmed\"\ntitl"
},
{
"path": ".github/ISSUE_TEMPLATE/3-new-model.yml",
"chars": 1084,
"preview": "name: \"\\U0001F31F New model/dataset/scheduler addition\"\ndescription: Submit a proposal/request to implement a new model "
},
{
"path": ".github/ISSUE_TEMPLATE/4-documentation.yml",
"chars": 822,
"preview": "name: 📚 Documentation\ndescription: Report an issue related to the documentation.\nlabels: \"kind/doc,status/unconfirmed\"\nt"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 313,
"preview": "blank_issues_enabled: false\n\ncontact_links:\n - name: 💬 Forum\n url: https://github.com/open-mmlab/mmagic/discussions\n"
},
{
"path": ".github/pull_request_template.md",
"chars": 1862,
"preview": "Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more he"
},
{
"path": ".github/workflows/lint.yml",
"chars": 731,
"preview": "name: lint\n\non: [push, pull_request]\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in-progres"
},
{
"path": ".github/workflows/merge_stage_test.yml",
"chars": 8227,
"preview": "name: merge_stage_test\n\non:\n push:\n paths-ignore:\n - 'README.md'\n - 'README_zh-CN.md'\n - 'docs/**'\n "
},
{
"path": ".github/workflows/pr_stage_test.yml",
"chars": 5013,
"preview": "name: pr_stage_test\n\non:\n pull_request:\n paths-ignore:\n - 'README.md'\n - 'README_zh-CN.md'\n - '.owner"
},
{
"path": ".github/workflows/publish-to-pypi.yml",
"chars": 767,
"preview": "name: deploy\n\non: push\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in-progress: true\n\njobs:"
},
{
"path": ".github/workflows/test_mim.yml",
"chars": 1169,
"preview": "name: test-mim\n\non:\n push:\n paths:\n - 'model-index.yml'\n - 'configs/**'\n\n pull_request:\n paths:\n "
},
{
"path": ".gitignore",
"chars": 1669,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n**/*.pyc\n\n# C extensions\n*.so\n\n# Distribution "
},
{
"path": ".owners.yml",
"chars": 435,
"preview": "# assign issues to owners automatically\nassign:\n issues: enabled # or disabled\n pull_requests: enabled # or disabled\n "
},
{
"path": ".pre-commit-config.yaml",
"chars": 2472,
"preview": "exclude: ^tests/data/\nrepos:\n - repo: https://github.com/PyCQA/flake8\n rev: 4.0.1\n hooks:\n - id: flake8\n - "
},
{
"path": ".pylintrc",
"chars": 18931,
"preview": "[MASTER]\n\n# A comma-separated list of package or module names from where C extensions may\n# be loaded. Extensions are lo"
},
{
"path": ".readthedocs.yml",
"chars": 198,
"preview": "version: 2\n\nformats: [pdf, epub]\n\nbuild:\n os: ubuntu-22.04\n tools:\n python: \"3.7\"\n\npython:\n install:\n - require"
},
{
"path": "CITATION.cff",
"chars": 343,
"preview": "cff-version: 1.2.0\nmessage: \"If you use this software, please cite it as below.\"\nauthors:\n - family-names: MMagic\n g"
},
{
"path": "LICENSE",
"chars": 12024,
"preview": "Copyright (c) OpenMMLab. All rights reserved.\n\n Apache License\n "
},
{
"path": "MANIFEST.in",
"chars": 281,
"preview": "include requirements/*.txt\ninclude mmagic/.mim/VERSION\ninclude mmagic/.mim/model-index.yml\ninclude mmagic/evaluation/met"
},
{
"path": "README.md",
"chars": 22919,
"preview": "<div id=\"top\" align=\"center\">\n <img src=\"docs/en/_static/image/mmagic-logo.png\" width=\"500px\"/>\n <div> </div>\n <"
},
{
"path": "README_zh-CN.md",
"chars": 18840,
"preview": "<div id=\"top\" align=\"center\">\n <img src=\"docs/zh_cn/_static/image/mmagic-logo.png\" width=\"500px\"/>\n <div> </div>\n"
},
{
"path": "configs/_base_/datasets/basicvsr_test_config.py",
"chars": 5616,
"preview": "# configs for REDS4\nreds_data_root = 'data/REDS'\n\nreds_pipeline = [\n dict(type='GenerateSegmentIndices', interval_lis"
},
{
"path": "configs/_base_/datasets/celeba.py",
"chars": 1080,
"preview": "# Base config for CelebA-HQ dataset\n\n# dataset settings\ndataset_type = 'BasicImageDataset'\ndata_root = 'data/CelebA-HQ'\n"
},
{
"path": "configs/_base_/datasets/cifar10_noaug.py",
"chars": 692,
"preview": "cifar_pipeline = [dict(type='PackInputs')]\ncifar_dataset = dict(\n type='CIFAR10',\n data_root='./data',\n data_pr"
},
{
"path": "configs/_base_/datasets/cifar10_nopad.py",
"chars": 1017,
"preview": "cifar_pipeline = [\n dict(type='Flip', keys=['gt'], flip_ratio=0.5, direction='horizontal'),\n dict(type='PackInputs"
},
{
"path": "configs/_base_/datasets/comp1k.py",
"chars": 925,
"preview": "# Base config for Composition-1K dataset\n\n# dataset settings\ndataset_type = 'AdobeComp1kDataset'\ndata_root = 'data/adobe"
},
{
"path": "configs/_base_/datasets/deblurring-defocus_test_config.py",
"chars": 2847,
"preview": "test_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n cha"
},
{
"path": "configs/_base_/datasets/deblurring-motion_test_config.py",
"chars": 2858,
"preview": "test_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n cha"
},
{
"path": "configs/_base_/datasets/decompression_test_config.py",
"chars": 1732,
"preview": "quality = 10\ntest_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color'"
},
{
"path": "configs/_base_/datasets/denoising-gaussian_color_test_config.py",
"chars": 2927,
"preview": "sigma = 15\ntest_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n"
},
{
"path": "configs/_base_/datasets/denoising-gaussian_gray_test_config.py",
"chars": 2399,
"preview": "sigma = 15\ntest_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n"
},
{
"path": "configs/_base_/datasets/denoising-real_test_config.py",
"chars": 1618,
"preview": "test_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n cha"
},
{
"path": "configs/_base_/datasets/deraining_test_config.py",
"chars": 3579,
"preview": "test_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n cha"
},
{
"path": "configs/_base_/datasets/ffhq_flip.py",
"chars": 1246,
"preview": "dataset_type = 'BasicImageDataset'\n\ntrain_pipeline = [\n dict(type='LoadImageFromFile', key='gt'),\n dict(type='Flip"
},
{
"path": "configs/_base_/datasets/grow_scale_imgs_ffhq_styleganv1.py",
"chars": 1180,
"preview": "dataset_type = 'GrowScaleImgDataset'\n\npipeline = [\n dict(type='LoadImageFromFile', key='gt'),\n dict(type='Flip', k"
},
{
"path": "configs/_base_/datasets/imagenet_128.py",
"chars": 1382,
"preview": "# dataset settings\ndataset_type = 'ImageNet'\n\n# different from mmcls, we adopt the setting used in BigGAN.\n# We use `Ran"
},
{
"path": "configs/_base_/datasets/imagenet_256.py",
"chars": 1387,
"preview": "# dataset settings\ndataset_type = 'ImageNet'\n\n# different from mmcls, we adopt the setting used in BigGAN.\n# We use `Ran"
},
{
"path": "configs/_base_/datasets/imagenet_512.py",
"chars": 1384,
"preview": "# dataset settings\ndataset_type = 'ImageNet'\n\n# different from mmcls, we adopt the setting used in BigGAN.\n# We use `Ran"
},
{
"path": "configs/_base_/datasets/imagenet_64.py",
"chars": 1378,
"preview": "# dataset settings\ndataset_type = 'ImageNet'\n\n# different from mmcls, we adopt the setting used in BigGAN.\n# We use `Ran"
},
{
"path": "configs/_base_/datasets/imagenet_noaug_128.py",
"chars": 1321,
"preview": "# dataset settings\ndataset_type = 'ImageNet'\n\n# different from mmcls, we adopt the setting used in BigGAN.\n# Remove `Ran"
},
{
"path": "configs/_base_/datasets/liif_test_config.py",
"chars": 2830,
"preview": "scale_test_list = [2, 3, 4, 6, 18, 30]\n\ntest_pipelines = [[\n dict(\n type='LoadImageFromFile',\n key='gt'"
},
{
"path": "configs/_base_/datasets/lsun_stylegan.py",
"chars": 1162,
"preview": "dataset_type = 'BasicImageDataset'\n\ntrain_pipeline = [\n dict(type='LoadImageFromFile', key='gt'),\n dict(type='Pack"
},
{
"path": "configs/_base_/datasets/paired_imgs_256x256_crop.py",
"chars": 2930,
"preview": "dataset_type = 'PairedImageDataset'\n# domain_a = None # set by user\n# domain_b = None # set by user\n\ntrain_pipeline = "
},
{
"path": "configs/_base_/datasets/places.py",
"chars": 1229,
"preview": "# Base config for places365 dataset\n\n# dataset settings\ndataset_type = 'BasicImageDataset'\ndata_root = 'data/Places'\n\ntr"
},
{
"path": "configs/_base_/datasets/sisr_x2_test_config.py",
"chars": 2573,
"preview": "test_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n cha"
},
{
"path": "configs/_base_/datasets/sisr_x3_test_config.py",
"chars": 2522,
"preview": "test_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n cha"
},
{
"path": "configs/_base_/datasets/sisr_x4_test_config.py",
"chars": 2522,
"preview": "test_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n color_type='color',\n cha"
},
{
"path": "configs/_base_/datasets/tdan_test_config.py",
"chars": 3744,
"preview": "# configs for SPMCS-30\nSPMC_data_root = 'data/SPMCS'\n\nSPMC_pipeline = [\n dict(type='GenerateFrameIndiceswithPadding',"
},
{
"path": "configs/_base_/datasets/unconditional_imgs_128x128.py",
"chars": 1172,
"preview": "# dataset_type = 'BasicImageDataset'\ndataset_type = 'BasicImageDataset'\n\ntrain_pipeline = [\n dict(type='LoadImageFrom"
},
{
"path": "configs/_base_/datasets/unconditional_imgs_64x64.py",
"chars": 1133,
"preview": "dataset_type = 'BasicImageDataset'\n\ntrain_pipeline = [\n dict(type='LoadImageFromFile', key='gt'),\n dict(type='Resi"
},
{
"path": "configs/_base_/datasets/unconditional_imgs_flip_512x512.py",
"chars": 1212,
"preview": "dataset_type = 'BasicImageDataset'\n\n# TODO:\ntrain_pipeline = [\n dict(type='LoadImageFromFile', key='gt'),\n dict(ty"
},
{
"path": "configs/_base_/datasets/unconditional_imgs_flip_lanczos_resize_256x256.py",
"chars": 1279,
"preview": "dataset_type = 'BasicImageDataset'\n\ntrain_pipeline = [\n dict(type='LoadImageFromFile', key='gt'),\n dict(\n t"
},
{
"path": "configs/_base_/datasets/unpaired_imgs_256x256.py",
"chars": 3146,
"preview": "dataset_type = 'UnpairedImageDataset'\ndomain_a = None # set by user\ndomain_b = None # set by user\ntrain_pipeline = [\n "
},
{
"path": "configs/_base_/default_runtime.py",
"chars": 1030,
"preview": "default_scope = 'mmagic'\nsave_dir = './work_dirs'\n\ndefault_hooks = dict(\n timer=dict(type='IterTimerHook'),\n logge"
},
{
"path": "configs/_base_/gen_default_runtime.py",
"chars": 2027,
"preview": "default_scope = 'mmagic'\n\nrandomness = dict(seed=2022, diff_rank_seed=True)\n# env settings\ndist_params = dict(backend='n"
},
{
"path": "configs/_base_/inpaint_default_runtime.py",
"chars": 964,
"preview": "default_scope = 'mmagic'\nsave_dir = './work_dirs'\n\ndefault_hooks = dict(\n timer=dict(type='IterTimerHook'),\n logge"
},
{
"path": "configs/_base_/matting_default_runtime.py",
"chars": 989,
"preview": "default_scope = 'mmagic'\nsave_dir = './work_dirs'\n\ndefault_hooks = dict(\n timer=dict(type='IterTimerHook'),\n logge"
},
{
"path": "configs/_base_/models/base_cyclegan.py",
"chars": 779,
"preview": "_domain_a = None # set by user\n_domain_b = None # set by user\nmodel = dict(\n type='CycleGAN',\n data_preprocessor"
},
{
"path": "configs/_base_/models/base_deepfillv1.py",
"chars": 3206,
"preview": "# DistributedDataParallel\nmodel_wrapper_cfg = dict(type='MMSeparateDistributedDataParallel')\n\nmodel = dict(\n type='De"
},
{
"path": "configs/_base_/models/base_deepfillv2.py",
"chars": 3257,
"preview": "# DistributedDataParallel\nmodel_wrapper_cfg = dict(type='MMSeparateDistributedDataParallel')\n\nmodel = dict(\n type='Tw"
},
{
"path": "configs/_base_/models/base_edvr.py",
"chars": 3216,
"preview": "_base_ = '../default_runtime.py'\n\nscale = 4\n\ntrain_pipeline = [\n dict(type='GenerateFrameIndices', interval_list=[1],"
},
{
"path": "configs/_base_/models/base_gl.py",
"chars": 1510,
"preview": "# DistributedDataParallel\nmodel_wrapper_cfg = dict(type='MMSeparateDistributedDataParallel')\n\nmodel = dict(\n type='GL"
},
{
"path": "configs/_base_/models/base_glean.py",
"chars": 1366,
"preview": "_base_ = '../default_runtime.py'\n\n# DistributedDataParallel\nmodel_wrapper_cfg = dict(\n type='MMSeparateDistributedDat"
},
{
"path": "configs/_base_/models/base_liif.py",
"chars": 3518,
"preview": "_base_ = '../default_runtime.py'\nwork_dir = './work_dirs/liif'\nsave_dir = './work_dirs'\n\nscale_min, scale_max = 1, 4\nsca"
},
{
"path": "configs/_base_/models/base_pconv.py",
"chars": 1267,
"preview": "# DistributedDataParallel\nmodel_wrapper_cfg = dict(type='MMSeparateDistributedDataParallel')\n\nmodel = dict(\n type='PC"
},
{
"path": "configs/_base_/models/base_pix2pix.py",
"chars": 813,
"preview": "source_domain = None # set by user\ntarget_domain = None # set by user\n# model settings\nmodel = dict(\n type='Pix2Pix"
},
{
"path": "configs/_base_/models/base_styleganv1.py",
"chars": 275,
"preview": "model = dict(\n type='StyleGANv1',\n data_preprocessor=dict(type='DataPreprocessor'),\n style_channels=512,\n ge"
},
{
"path": "configs/_base_/models/base_styleganv2.py",
"chars": 797,
"preview": "# define GAN model\n\nd_reg_interval = 16\ng_reg_interval = 4\n\ng_reg_ratio = g_reg_interval / (g_reg_interval + 1)\nd_reg_ra"
},
{
"path": "configs/_base_/models/base_styleganv3.py",
"chars": 842,
"preview": "# define GAN model\n\nd_reg_interval = 16\ng_reg_interval = 4\n\ng_reg_ratio = g_reg_interval / (g_reg_interval + 1)\nd_reg_ra"
},
{
"path": "configs/_base_/models/base_tof.py",
"chars": 2828,
"preview": "_base_ = '../default_runtime.py'\n\ntrain_pipeline = [\n dict(\n type='LoadImageFromFile',\n key='img',\n "
},
{
"path": "configs/_base_/models/biggan/base_biggan_128x128.py",
"chars": 812,
"preview": "model = dict(\n type='BigGAN',\n num_classes=1000,\n data_preprocessor=dict(type='DataPreprocessor'),\n generato"
},
{
"path": "configs/_base_/models/dcgan/base_dcgan_128x128.py",
"chars": 349,
"preview": "# define GAN model\nmodel = dict(\n type='DCGAN',\n noise_size=100,\n data_preprocessor=dict(type='DataPreprocessor"
},
{
"path": "configs/_base_/models/dcgan/base_dcgan_64x64.py",
"chars": 336,
"preview": "# define GAN model\nmodel = dict(\n type='DCGAN',\n noise_size=100,\n data_preprocessor=dict(type='DataPreprocessor"
},
{
"path": "configs/_base_/models/sagan/base_sagan_128x128.py",
"chars": 621,
"preview": "model = dict(\n type='SAGAN',\n num_classes=1000,\n data_preprocessor=dict(type='DataPreprocessor'),\n generator"
},
{
"path": "configs/_base_/models/sagan/base_sagan_32x32.py",
"chars": 667,
"preview": "model = dict(\n type='SAGAN',\n data_preprocessor=dict(type='DataPreprocessor'),\n num_classes=10,\n generator=d"
},
{
"path": "configs/_base_/models/sngan_proj/base_sngan_proj_128x128.py",
"chars": 326,
"preview": "# define GAN model\nmodel = dict(\n type='SNGAN',\n num_classes=1000,\n data_preprocessor=dict(type='DataPreprocess"
},
{
"path": "configs/_base_/models/sngan_proj/base_sngan_proj_32x32.py",
"chars": 324,
"preview": "# define GAN model\nmodel = dict(\n type='SNGAN',\n num_classes=10,\n data_preprocessor=dict(type='DataPreprocessor"
},
{
"path": "configs/_base_/schedules/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "configs/animatediff/README.md",
"chars": 16588,
"preview": "# AnimateDiff (2023)\n\n> [AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning]("
},
{
"path": "configs/animatediff/README_zh-CN.md",
"chars": 15113,
"preview": "# AnimateDiff (2023)\n\n> [AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning]("
},
{
"path": "configs/animatediff/animatediff_Lyriel.py",
"chars": 2065,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\nmodels_path = '/home/AnimateDiff/models/'"
},
{
"path": "configs/animatediff/animatediff_MajicMix.py",
"chars": 2089,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\nmodels_path = '/home/AnimateDiff/models/'"
},
{
"path": "configs/animatediff/animatediff_RcnzCartoon.py",
"chars": 2072,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\nmodels_path = '/home/AnimateDiff/models/'"
},
{
"path": "configs/animatediff/animatediff_RealisticVision.py",
"chars": 2086,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\nmodels_path = '/home/AnimateDiff/models/'"
},
{
"path": "configs/animatediff/animatediff_RealisticVision_v2.py",
"chars": 2152,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\nmodels_path = '/home/AnimateDiff/models/'"
},
{
"path": "configs/animatediff/animatediff_ToonYou.py",
"chars": 2847,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\nmodels_path = '/home/AnimateDiff/models/'"
},
{
"path": "configs/animatediff/metafile.yml",
"chars": 2387,
"preview": "Collections:\n- Name: AnimateDiff\n Paper:\n Title: 'AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Mod"
},
{
"path": "configs/aot_gan/README.md",
"chars": 6475,
"preview": "# AOT-GAN (TVCG'2021)\n\n> [AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting](https://a"
},
{
"path": "configs/aot_gan/README_zh-CN.md",
"chars": 3876,
"preview": "# AOT-GAN (TVCG'2021)\n\n> [AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting](https://a"
},
{
"path": "configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py",
"chars": 3866,
"preview": "_base_ = [\n '../_base_/inpaint_default_runtime.py', '../_base_/datasets/places.py'\n]\n\nexperiment_name = 'aot-gan_smpg"
},
{
"path": "configs/aot_gan/metafile.yml",
"chars": 655,
"preview": "Collections:\n- Name: AOT-GAN\n Paper:\n Title: 'AOT-GAN: Aggregated Contextual Transformations for High-Resolution Ima"
},
{
"path": "configs/basicvsr/README.md",
"chars": 10685,
"preview": "# BasicVSR (CVPR'2021)\n\n> [BasicVSR: The Search for Essential Components in Video Super-Resolution and Beyond](https://a"
},
{
"path": "configs/basicvsr/README_zh-CN.md",
"chars": 3811,
"preview": "# BasicVSR (CVPR'2021)\n\n> **任务**: 视频超分辨率\n\n<!-- [ALGORITHM] -->\n\n<details>\n<summary align=\"right\">BasicVSR (CVPR'2021)</s"
},
{
"path": "configs/basicvsr/basicvsr_2xb4_reds4.py",
"chars": 3567,
"preview": "_base_ = [\n '../_base_/default_runtime.py',\n '../_base_/datasets/basicvsr_test_config.py'\n]\n\nexperiment_name = 'ba"
},
{
"path": "configs/basicvsr/basicvsr_2xb4_vimeo90k-bd.py",
"chars": 2548,
"preview": "_base_ = './basicvsr_2xb4_reds4.py'\n\nscale = 4\nexperiment_name = 'basicvsr_2xb4_vimeo90k-bd'\nwork_dir = f'./work_dirs/{e"
},
{
"path": "configs/basicvsr/basicvsr_2xb4_vimeo90k-bi.py",
"chars": 425,
"preview": "_base_ = './basicvsr_2xb4_vimeo90k-bd.py'\n\nexperiment_name = 'basicvsr_2xb4_vimeo90k-bi'\nwork_dir = f'./work_dirs/{exper"
},
{
"path": "configs/basicvsr/metafile.yml",
"chars": 3143,
"preview": "Collections:\n- Name: BasicVSR\n Paper:\n Title: 'BasicVSR: The Search for Essential Components in Video Super-Resoluti"
},
{
"path": "configs/basicvsr_pp/README.md",
"chars": 14837,
"preview": "# BasicVSR++ (CVPR'2022)\n\n> [BasicVSR++: Improving Video Super-Resolution with Enhanced Propagation and Alignment](https"
},
{
"path": "configs/basicvsr_pp/README_zh-CN.md",
"chars": 6085,
"preview": "# BasicVSR++ (CVPR'2022)\n\n> **任务**: 视频超分辨率\n\n<!-- [ALGORITHM] -->\n\n<details>\n<summary align=\"right\"><a href=\"https://arxi"
},
{
"path": "configs/basicvsr_pp/basicvsr-pp_c128n25_600k_ntire-decompress-track1.py",
"chars": 1881,
"preview": "_base_ = '../_base_/default_runtime.py'\n\nexperiment_name = 'basicvsr-pp_c128n25_600k_ntire-decompress-track1'\nwork_dir ="
},
{
"path": "configs/basicvsr_pp/basicvsr-pp_c128n25_600k_ntire-decompress-track2.py",
"chars": 384,
"preview": "_base_ = './basicvsr-pp_c128n25_600k_ntire-decompress-track1.py'\n\nexperiment_name = 'basicvsr-pp_c128n25_600k_ntire-deco"
},
{
"path": "configs/basicvsr_pp/basicvsr-pp_c128n25_600k_ntire-decompress-track3.py",
"chars": 384,
"preview": "_base_ = './basicvsr-pp_c128n25_600k_ntire-decompress-track1.py'\n\nexperiment_name = 'basicvsr-pp_c128n25_600k_ntire-deco"
},
{
"path": "configs/basicvsr_pp/basicvsr-pp_c128n25_600k_ntire-vsr.py",
"chars": 1776,
"preview": "experiment_name = 'basicvsr-pp_c128n25_600k_ntire-vsr'\n\n# model settings\nmodel = dict(\n type='BasicVSR',\n generato"
},
{
"path": "configs/basicvsr_pp/basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bd.py",
"chars": 1274,
"preview": "_base_ = '../basicvsr/basicvsr_2xb4_vimeo90k-bd.py'\n\nexperiment_name = 'basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bd'\nwork_di"
},
{
"path": "configs/basicvsr_pp/basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bi.py",
"chars": 1274,
"preview": "_base_ = '../basicvsr/basicvsr_2xb4_vimeo90k-bi.py'\n\nexperiment_name = 'basicvsr-pp_c64n7_4xb2-300k_vimeo90k-bi'\nwork_di"
},
{
"path": "configs/basicvsr_pp/basicvsr-pp_c64n7_8xb1-600k_reds4.py",
"chars": 1363,
"preview": "_base_ = '../basicvsr/basicvsr_2xb4_reds4.py'\n\nexperiment_name = 'basicvsr-pp_c64n7_8xb1-600k_reds4'\nwork_dir = f'./work"
},
{
"path": "configs/basicvsr_pp/metafile.yml",
"chars": 5065,
"preview": "Collections:\n- Name: BasicVSR++\n Paper:\n Title: 'BasicVSR++: Improving Video Super-Resolution with Enhanced Propagat"
},
{
"path": "configs/biggan/README.md",
"chars": 9198,
"preview": "# BigGAN (ICLR'2019)\n\n> [Large Scale GAN Training for High Fidelity Natural Image Synthesis](https://openreview.net/foru"
},
{
"path": "configs/biggan/README_zh-CN.md",
"chars": 8164,
"preview": "# BigGAN (ICLR'2019)\n\n> [Large Scale GAN Training for High Fidelity Natural Image Synthesis](https://openreview.net/foru"
},
{
"path": "configs/biggan/biggan-deep_cvt-hugging-face-rgb_imagenet1k-128x128.py",
"chars": 1577,
"preview": "_base_ = [\n '../_base_/datasets/imagenet_noaug_128.py',\n '../_base_/gen_default_runtime.py',\n]\n\nema_config = dict("
},
{
"path": "configs/biggan/biggan-deep_cvt-hugging-face_rgb_imagenet1k-256x256.py",
"chars": 1796,
"preview": "_base_ = [\n '../_base_/datasets/imagenet_noaug_128.py',\n '../_base_/gen_default_runtime.py',\n]\n\n# setting image si"
},
{
"path": "configs/biggan/biggan-deep_cvt-hugging-face_rgb_imagenet1k-512x512.py",
"chars": 1796,
"preview": "_base_ = [\n '../_base_/datasets/imagenet_noaug_128.py',\n '../_base_/gen_default_runtime.py',\n]\n\n# setting image si"
},
{
"path": "configs/biggan/biggan_2xb25-500kiters_cifar10-32x32.py",
"chars": 2325,
"preview": "_base_ = [\n '../_base_/datasets/cifar10_noaug.py',\n '../_base_/gen_default_runtime.py',\n]\n\n# define model\nema_conf"
},
{
"path": "configs/biggan/biggan_ajbrock-sn_8xb32-1500kiters_imagenet1k-128x128.py",
"chars": 1703,
"preview": "_base_ = [\n '../_base_/models/biggan/base_biggan_128x128.py',\n '../_base_/datasets/imagenet_noaug_128.py',\n '.."
},
{
"path": "configs/biggan/biggan_cvt-BigGAN-PyTorch-rgb_imagenet1k-128x128.py",
"chars": 1514,
"preview": "_base_ = [\n '../_base_/datasets/imagenet_noaug_128.py',\n '../_base_/gen_default_runtime.py',\n]\n\nema_config = dict("
},
{
"path": "configs/biggan/metafile.yml",
"chars": 2818,
"preview": "Collections:\n- Name: BigGAN\n Paper:\n Title: Large Scale GAN Training for High Fidelity Natural Image Synthesis\n U"
},
{
"path": "configs/cain/README.md",
"chars": 4521,
"preview": "# CAIN (AAAI'2020)\n\n> [Channel Attention Is All You Need for Video Frame Interpolation](https://aaai.org/ojs/index.php/A"
},
{
"path": "configs/cain/README_zh-CN.md",
"chars": 2704,
"preview": "# CAIN (AAAI'2020)\n\n> **任务**: 视频插帧\n\n<!-- [ALGORITHM] -->\n\n<details>\n<summary align=\"right\"><a href=\"https://aaai.org/ojs"
},
{
"path": "configs/cain/cain_g1b32_1xb5_vimeo90k-triplet.py",
"chars": 4132,
"preview": "_base_ = '../_base_/default_runtime.py'\n\nexperiment_name = 'cain_g1b32_1xb5_vimeo90k-triplet'\nwork_dir = f'./work_dirs/{"
},
{
"path": "configs/cain/metafile.yml",
"chars": 632,
"preview": "Collections:\n- Name: CAIN\n Paper:\n Title: Channel Attention Is All You Need for Video Frame Interpolation\n URL: h"
},
{
"path": "configs/controlnet/README.md",
"chars": 11088,
"preview": "# Control Net (2023)\n\n> [Adding Conditional Control to Text-to-Image Diffusion Models](https://arxiv.org/abs/2302.05543)"
},
{
"path": "configs/controlnet/controlnet-1xb1-fill50k.py",
"chars": 2446,
"preview": "_base_ = '../_base_/gen_default_runtime.py'\n\n# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1"
},
{
"path": "configs/controlnet/controlnet-canny.py",
"chars": 1113,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\ncontrolnet_canny_url = 'lllyasviel/sd-con"
},
{
"path": "configs/controlnet/controlnet-pose.py",
"chars": 1117,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\ncontrolnet_canny_url = 'lllyasviel/sd-con"
},
{
"path": "configs/controlnet/controlnet-seg.py",
"chars": 1111,
"preview": "# config for model\nstable_diffusion_v15_url = 'runwayml/stable-diffusion-v1-5'\ncontrolnet_canny_url = 'lllyasviel/sd-con"
},
{
"path": "configs/controlnet/metafile.yml",
"chars": 1208,
"preview": "Collections:\n- Name: Control Net\n Paper:\n Title: Adding Conditional Control to Text-to-Image Diffusion Models\n UR"
},
{
"path": "configs/controlnet_animation/README.md",
"chars": 4417,
"preview": "# Controlnet Animation (2023)\n\n> [Controlnet](https://github.com/lllyasviel/ControlNet) Application\n\n> **Task**: control"
},
{
"path": "configs/controlnet_animation/anythingv3_config.py",
"chars": 1331,
"preview": "# config for model\nstable_diffusion_v15_url = 'Linaqruf/anything-v3.0'\ncontrolnet_hed_url = 'lllyasviel/sd-controlnet-he"
},
{
"path": "configs/controlnet_animation/metafile.yml",
"chars": 492,
"preview": "Collections:\n- Name: Controlnet Animation\n Paper:\n Title: Controlnet\n URL: https://github.com/lllyasviel/ControlN"
},
{
"path": "configs/cyclegan/README.md",
"chars": 7956,
"preview": "# CycleGAN (ICCV'2017)\n\n> [CycleGAN: Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks](ht"
},
{
"path": "configs/cyclegan/cyclegan_lsgan-id0-resnet-in_1xb1-250kiters_summer2winter.py",
"chars": 3163,
"preview": "_base_ = [\n '../_base_/models/base_cyclegan.py',\n '../_base_/datasets/unpaired_imgs_256x256.py',\n '../_base_/ge"
},
{
"path": "configs/cyclegan/cyclegan_lsgan-id0-resnet-in_1xb1-270kiters_horse2zebra.py",
"chars": 3109,
"preview": "_base_ = [\n '../_base_/models/base_cyclegan.py',\n '../_base_/datasets/unpaired_imgs_256x256.py',\n '../_base_/ge"
},
{
"path": "configs/cyclegan/cyclegan_lsgan-id0-resnet-in_1xb1-80kiters_facades.py",
"chars": 2555,
"preview": "_base_ = [\n '../_base_/models/base_cyclegan.py',\n '../_base_/datasets/unpaired_imgs_256x256.py',\n '../_base_/ge"
},
{
"path": "configs/cyclegan/cyclegan_lsgan-resnet-in_1xb1-250kiters_summer2winter.py",
"chars": 3140,
"preview": "_base_ = [\n '../_base_/models/base_cyclegan.py',\n '../_base_/datasets/unpaired_imgs_256x256.py',\n '../_base_/ge"
},
{
"path": "configs/cyclegan/cyclegan_lsgan-resnet-in_1xb1-270kiters_horse2zebra.py",
"chars": 3110,
"preview": "_base_ = [\n '../_base_/models/base_cyclegan.py',\n '../_base_/datasets/unpaired_imgs_256x256.py',\n '../_base_/ge"
},
{
"path": "configs/cyclegan/cyclegan_lsgan-resnet-in_1xb1-80kiters_facades.py",
"chars": 2556,
"preview": "_base_ = [\n '../_base_/models/base_cyclegan.py',\n '../_base_/datasets/unpaired_imgs_256x256.py',\n '../_base_/ge"
},
{
"path": "configs/cyclegan/metafile.yml",
"chars": 3355,
"preview": "Collections:\n- Name: CycleGAN\n Paper:\n Title: 'CycleGAN: Unpaired Image-to-Image Translation Using Cycle-Consistent "
},
{
"path": "configs/dcgan/README.md",
"chars": 3497,
"preview": "# Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks (ICLR'2016)\n\n> [Unsupervi"
},
{
"path": "configs/dcgan/dcgan_1xb128-300kiters_celeba-cropped-64.py",
"chars": 1429,
"preview": "_base_ = [\n '../_base_/models/dcgan/base_dcgan_64x64.py',\n '../_base_/datasets/unconditional_imgs_64x64.py',\n '"
},
{
"path": "configs/dcgan/dcgan_1xb128-5epoches_lsun-bedroom-64x64.py",
"chars": 1386,
"preview": "_base_ = [\n '../_base_/models/dcgan/base_dcgan_64x64.py',\n '../_base_/datasets/unconditional_imgs_64x64.py',\n '"
},
{
"path": "configs/dcgan/dcgan_Glr4e-4_Dlr1e-4_1xb128-5kiters_mnist-64x64.py",
"chars": 1887,
"preview": "_base_ = [\n '../_base_/models/dcgan/base_dcgan_64x64.py',\n '../_base_/datasets/unconditional_imgs_64x64.py',\n '"
},
{
"path": "configs/dcgan/metafile.yml",
"chars": 1753,
"preview": "Collections:\n- Name: Unsupervised Representation Learning with Deep Convolutional Generative Adversarial\n Networks\n "
},
{
"path": "configs/deblurganv2/README.md",
"chars": 4755,
"preview": "# DeblurGAN-v2 (ICCV'2019)\n\n> [DeblurGAN-v2: Deblurring (Orders-of-Magnitude) Faster and Better](https://arxiv.org/abs/1"
},
{
"path": "configs/deblurganv2/README_zh-CN.md",
"chars": 3621,
"preview": "# DeblurGAN-v2 (ICCV'2019)\n\n> [DeblurGAN-v2: Deblurring (Orders-of-Magnitude) Faster and Better](https://arxiv.org/abs/1"
},
{
"path": "configs/deblurganv2/deblurganv2_fpn-inception_1xb1_gopro.py",
"chars": 5207,
"preview": "# Copyright (c) OpenMMLab. All rights reserved.\n_base_ = ['../_base_/default_runtime.py']\n\nsave_dir = './work_dir/'\n\nmod"
},
{
"path": "configs/deblurganv2/deblurganv2_fpn-mobilenet_1xb1_gopro.py",
"chars": 5206,
"preview": "# Copyright (c) OpenMMLab. All rights reserved.\n_base_ = ['../_base_/default_runtime.py']\n\nsave_dir = './work_dir/'\n\nmod"
},
{
"path": "configs/deblurganv2/metafile.yml",
"chars": 1029,
"preview": "Collections:\n- Name: DeblurGAN-v2\n Paper:\n Title: 'DeblurGAN-v2: Deblurring (Orders-of-Magnitude) Faster and Better'"
},
{
"path": "configs/deepfillv1/README.md",
"chars": 5444,
"preview": "# DeepFillv1 (CVPR'2018)\n\n> [Generative Image Inpainting with Contextual Attention](https://arxiv.org/abs/1801.07892)\n\n>"
},
{
"path": "configs/deepfillv1/README_zh-CN.md",
"chars": 3492,
"preview": "# DeepFillv1 (CVPR'2018)\n\n> **任务**: 图像修复\n\n<!-- [ALGORITHM] -->\n\n<details>\n<summary align=\"right\">DeepFillv1 (CVPR'2018)<"
},
{
"path": "configs/deepfillv1/deepfillv1_4xb4_celeba-256x256.py",
"chars": 1446,
"preview": "_base_ = [\n '../_base_/models/base_deepfillv1.py',\n '../_base_/inpaint_default_runtime.py', '../_base_/datasets/ce"
},
{
"path": "configs/deepfillv1/deepfillv1_8xb2_places-256x256.py",
"chars": 1439,
"preview": "_base_ = [\n '../_base_/models/base_deepfillv1.py',\n '../_base_/inpaint_default_runtime.py', '../_base_/datasets/pl"
},
{
"path": "configs/deepfillv1/metafile.yml",
"chars": 1003,
"preview": "Collections:\n- Name: DeepFillv1\n Paper:\n Title: Generative Image Inpainting with Contextual Attention\n URL: https"
},
{
"path": "configs/deepfillv2/README.md",
"chars": 5248,
"preview": "# DeepFillv2 (CVPR'2019)\n\n> [Free-Form Image Inpainting with Gated Convolution](https://arxiv.org/abs/1806.03589)\n\n> **T"
},
{
"path": "configs/deepfillv2/README_zh-CN.md",
"chars": 3468,
"preview": "# DeepFillv2 (CVPR'2019)\n\n> **任务**: 图像修复\n\n<!-- [ALGORITHM] -->\n\n<details>\n<summary align=\"right\">DeepFillv2 (CVPR'2019)<"
},
{
"path": "configs/deepfillv2/deepfillv2_8xb2_celeba-256x256.py",
"chars": 1493,
"preview": "_base_ = [\n '../_base_/models/base_deepfillv2.py',\n '../_base_/inpaint_default_runtime.py', '../_base_/datasets/ce"
},
{
"path": "configs/deepfillv2/deepfillv2_8xb2_places-256x256.py",
"chars": 1494,
"preview": "_base_ = [\n '../_base_/models/base_deepfillv2.py',\n '../_base_/inpaint_default_runtime.py', '../_base_/datasets/pl"
},
{
"path": "configs/deepfillv2/metafile.yml",
"chars": 998,
"preview": "Collections:\n- Name: DeepFillv2\n Paper:\n Title: Free-Form Image Inpainting with Gated Convolution\n URL: https://a"
},
{
"path": "configs/dic/README.md",
"chars": 5293,
"preview": "# DIC (CVPR'2020)\n\n> [Deep Face Super-Resolution with Iterative Collaboration between Attentive Recovery and Landmark Es"
},
{
"path": "configs/dic/README_zh-CN.md",
"chars": 3139,
"preview": "# DIC (CVPR'2020)\n\n> **任务**: 图像超分辨率\n\n<!-- [ALGORITHM] -->\n\n<details>\n\n<summary align=\"right\">DIC (CVPR'2020)</summary>\n\n"
},
{
"path": "configs/dic/dic_gan-x8c48b6_4xb2-500k_celeba-hq.py",
"chars": 1760,
"preview": "_base_ = './dic_x8c48b6_4xb2-150k_celeba-hq.py'\n\nexperiment_name = 'dic_gan-x8c48b6_4xb2-500k_celeba-hq'\nwork_dir = f'./"
},
{
"path": "configs/dic/dic_x8c48b6_4xb2-150k_celeba-hq.py",
"chars": 4392,
"preview": "_base_ = '../_base_/default_runtime.py'\n\nexperiment_name = 'dic_x8c48b6_4xb2-150k_celeba-hq'\nwork_dir = f'./work_dirs/{e"
},
{
"path": "configs/dic/metafile.yml",
"chars": 1006,
"preview": "Collections:\n- Name: DIC\n Paper:\n Title: Deep Face Super-Resolution with Iterative Collaboration between Attentive\n "
},
{
"path": "configs/diffusers_pipeline/README.md",
"chars": 1775,
"preview": "# Diffusers Pipeline (2023)\n\n> [Diffusers Pipeline](https://github.com/huggingface/diffusers)\n\n> **Task**: Diffusers Pip"
},
{
"path": "configs/diffusers_pipeline/metafile.yml",
"chars": 415,
"preview": "Collections:\n- Name: Diffusers Pipeline\n Paper:\n Title: Diffusers Pipeline\n URL: https://github.com/huggingface/d"
},
{
"path": "configs/diffusers_pipeline/sd_xl_pipeline.py",
"chars": 128,
"preview": "# config for model\n\nmodel = dict(\n type='DiffusionPipeline',\n from_pretrained='stabilityai/stable-diffusion-xl-bas"
},
{
"path": "configs/dim/README.md",
"chars": 7120,
"preview": "# DIM (CVPR'2017)\n\n> [Deep Image Matting](https://arxiv.org/abs/1703.03872)\n\n> **Task**: Matting\n\n<!-- [ALGORITHM] -->\n\n"
},
{
"path": "configs/dim/README_zh-CN.md",
"chars": 4850,
"preview": "# DIM (CVPR'2017)\n\n> **任务**: 图像抠图\n\n<!-- [ALGORITHM] -->\n\n<details>\n<summary align=\"right\">DIM (CVPR'2017)</summary>\n\n```"
},
{
"path": "configs/dim/dim_stage1-v16_1xb1-1000k_comp1k.py",
"chars": 2649,
"preview": "_base_ = [\n '../_base_/datasets/comp1k.py', '../_base_/matting_default_runtime.py'\n]\n\nsave_dir = './work_dirs/'\nexper"
},
{
"path": "configs/dim/dim_stage1-v16_1xb1-1000k_comp1k_online-merge.py",
"chars": 847,
"preview": "_base_ = ['./dim_stage1-v16_1xb1-1000k_comp1k.py']\nsave_dir = './work_dirs/'\nexperiment_name = 'dim_stage1-v16_1xb1-1000"
},
{
"path": "configs/dim/dim_stage2-v16-pln_1xb1-1000k_comp1k.py",
"chars": 505,
"preview": "_base_ = ['./dim_stage1-v16_1xb1-1000k_comp1k.py']\nsave_dir = './work_dirs/'\nexperiment_name = 'dim_stage2-v16-pln_1xb1-"
},
{
"path": "configs/dim/dim_stage3-v16-pln_1xb1-1000k_comp1k.py",
"chars": 508,
"preview": "_base_ = ['./dim_stage1-v16_1xb1-1000k_comp1k.py']\n\nsave_dir = './work_dirs'\nexperiment_name = 'dim_stage3-v16-pln_1xb1-"
},
{
"path": "configs/dim/metafile.yml",
"chars": 1595,
"preview": "Collections:\n- Name: DIM\n Paper:\n Title: Deep Image Matting\n URL: https://arxiv.org/abs/1703.03872\n README: conf"
},
{
"path": "configs/disco_diffusion/README.md",
"chars": 7415,
"preview": "# Disco Diffusion (2022)\n\n> [Disco Diffusion](https://github.com/alembics/disco-diffusion)\n\n> **Task**: Text2Image, Imag"
},
{
"path": "configs/disco_diffusion/README_zh-CN.md",
"chars": 6781,
"preview": "# Disco Diffusion (2022)\n\n> [Disco Diffusion](https://github.com/alembics/disco-diffusion)\n\n> **任务**: 图文生成, 图像到图像的翻译, 扩散"
},
{
"path": "configs/disco_diffusion/disco-diffusion_adm-u-finetuned_imagenet-256x256.py",
"chars": 1574,
"preview": "unet = dict(\n type='DenoisingUnet',\n image_size=256,\n in_channels=3,\n base_channels=256,\n resblocks_per_d"
},
{
"path": "configs/disco_diffusion/disco-diffusion_adm-u-finetuned_imagenet-512x512.py",
"chars": 1566,
"preview": "unet = dict(\n type='DenoisingUnet',\n image_size=512,\n in_channels=3,\n base_channels=256,\n resblocks_per_d"
}
]
// ... and 1487 more files (download for full content)
About this extraction
This page contains the full source code of the open-mmlab/mmagic GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1687 files (18.8 MB), approximately 5.0M tokens, and a symbol index with 5290 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.