GuoLanqing / ShadowDiffusion

ShadowDiffusion (CVPR2023), Pytorch implementation
133 stars 6 forks source link

error while training with istd dataset #8

Closed GIT-HYQ closed 9 months ago

GIT-HYQ commented 1 year ago

Can you help me with this error, thanks a lot. 1. train the network in colab,GPU: T4 python /content/drive/MyDrive/ShadowDiffusion/sr.py -p train -c /content/drive/MyDrive/ShadowDiffusion/config/shadow.json

2. key error log,full log is below Traceback (most recent call last): File "/content/drive/MyDrive/ShadowDiffusion/sr.py", line 138, in visuals = diffusion.get_current_visuals() File "/content/drive/MyDrive/ShadowDiffusion/model/model.py", line 147, in get_current_visuals out_dict['SR'] = self.SR.detach().float().cpu() AttributeError: 'tuple' object has no attribute 'detach'

3. shadow.json { "name": "istd_test1", "phase": "train", // train or val "gpu_ids": [ 0 ], "path": { //set the path "log": "/content/drive/MyDrive/ShadowDiffusion/logs", "tb_logger": "tb_logger", "results": "/content/drive/MyDrive/ShadowDiffusion/results", "checkpoint": "/content/drive/MyDrive/ShadowDiffusion/checkpoint", "resume_state": null //"resume_state": "/content/drive/MyDrive/ShadowDiffusion/checkpoint" //pretrain model or training state }, "datasets": { "train": { "name": "FFHQ", "mode": "HR", // whether need LR img "dataroot": "/content/drive/MyDrive/dataset/ISTD_Dataset/train", "datatype": "img", //lmdb or img, path of img files "l_resolution": "low", // low resolution need to super_resolution "r_resolution": "high", // high resolution "batch_size": 12, "num_workers": 8, "use_shuffle": true, "data_len": -1 // -1 represents all data used in train }, "val": { "name": "CelebaHQ", "mode": "LRHR", "dataroot": "/content/drive/MyDrive/dataset/ISTD_Dataset/test", "datatype": "img", //lmdb or img, path of img files "l_resolution": "test_low", "r_resolution": "test_high", "data_len": -1 } }, "model": { "which_model_G": "sr3", // use the ddpm or sr3 network structure "finetune_norm": false, "unet": { "in_channel": 7, "out_channel": 3, "inner_channel": 64, "norm_groups": 16, "channel_multiplier": [ 1, 2, 4, 8 // 8, // 16, ], "attn_res": [ 16 ], "res_blocks": 2, "dropout": 0 }, "beta_schedule": { // use munual beta_schedule for acceleration "train": { "schedule": "linear", "n_timestep": 1000, "linear_start": 1e-4, "linear_end": 0.02 }, "val": { "schedule": "linear", "n_timestep": 1000, "linear_start": 1e-4, "linear_end": 0.02 } }, "diffusion": { "image_size": 512, "channels": 3, //sample channel "conditional": true // unconditional generation or unconditional generation(super_resolution) } }, "train": { "n_iter": 1e8, "val_freq": 2000, "save_checkpoint_freq": 10000, "print_freq": 100, "optimizer": { "type": "adam", "lr": 3e-05 }, "ema_scheduler": { // not used now "step_start_ema": 5000, "update_ema_every": 1, "ema_decay": 0.9999 } }, "wandb": { "project": "distributed_high_sr_ffhq" } }

4. full logs ` 2023-08-09 09:46:29.706632: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-08-09 09:46:30.819111: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT export CUDA_VISIBLE_DEVICES=0 23-08-09 09:46:33.198 - INFO: name: istd_test1 phase: train gpu_ids: [0] path:[ log: /content/drive/MyDrive/ShadowDiffusion/logs tb_logger: experiments/istd_test1_230809_094633/tb_logger results: /content/drive/MyDrive/ShadowDiffusion/results checkpoint: /content/drive/MyDrive/ShadowDiffusion/checkpoint resume_state: None

    experiments_root: experiments/istd_test1_230809_094633
  ]
  datasets:[
    train:[
      name: FFHQ
      mode: HR
      dataroot: /content/drive/MyDrive/dataset/ISTD_Dataset/train
      datatype: img
      l_resolution: low
      r_resolution: high
      batch_size: 12
      num_workers: 8
      use_shuffle: True
      data_len: -1
    ]
    val:[
      name: CelebaHQ
      mode: LRHR
      dataroot: /content/drive/MyDrive/dataset/ISTD_Dataset/test
      datatype: img
      l_resolution: test_low
      r_resolution: test_high
      data_len: 3
    ]
  ]
  model:[
    which_model_G: sr3
    finetune_norm: False
    unet:[
      in_channel: 7
      out_channel: 3
      inner_channel: 64
      norm_groups: 16
      channel_multiplier: [1, 2, 4, 8]
      attn_res: [16]
      res_blocks: 2
      dropout: 0
    ]
    beta_schedule:[
      train:[
        schedule: linear
        n_timestep: 1000
        linear_start: 0.0001
        linear_end: 0.02
      ]
      val:[
        schedule: linear
        n_timestep: 1000
        linear_start: 0.0001
        linear_end: 0.02
      ]
    ]
    diffusion:[
      image_size: 512
      channels: 3
      conditional: True
    ]
  ]
  train:[
    n_iter: 100000000.0
    val_freq: 2000
    save_checkpoint_freq: 10000
    print_freq: 100
    optimizer:[
      type: adam
      lr: 3e-05
    ]
    ema_scheduler:[
      step_start_ema: 5000
      update_ema_every: 1
      ema_decay: 0.9999
    ]
  ]
  wandb:[
    project: distributed_high_sr_ffhq
  ]
  distributed: False
  log_wandb_ckpt: False
  log_eval: False
  enable_wandb: False

23-08-09 09:46:33.352 - INFO: Dataset [LRHRDataset - FFHQ] is created.
/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py:560: UserWarning: This DataLoader will create 8 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
  warnings.warn(_create_warning_msg(
23-08-09 09:46:33.380 - INFO: Dataset [LRHRDataset - CelebaHQ] is created.
23-08-09 09:46:33.380 - INFO: Initial Dataset Finished
23-08-09 09:46:33.860 - INFO: Initialization method [orthogonal]
23-08-09 09:46:37.653 - INFO: Network G structure: GaussianDiffusion, with parameters: 55,518,660
23-08-09 09:46:37.653 - INFO: GaussianDiffusion(
  (denoise_fn): UNet(
    (noise_level_mlp): Sequential(
      (0): PositionalEncoding()
      (1): Linear(in_features=64, out_features=256, bias=True)
      (2): Swish()
      (3): Linear(in_features=256, out_features=64, bias=True)
    )
    (downs): ModuleList(
      (0): Conv2d(7, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
      (1-2): 2 x ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=64, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 64, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 64, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Identity()
        )
      )
      (3): Downsample(
        (conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
      )
      (4): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=128, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 64, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(64, 128, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (5): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=128, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Identity()
        )
      )
      (6): Downsample(
        (conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
      )
      (7): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=256, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (8): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=256, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Identity()
        )
      )
      (9): Downsample(
        (conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
      )
      (10): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=512, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (11): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=512, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Identity()
        )
      )
    )
    (mid): ModuleList(
      (0): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=512, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Identity()
        )
        (attn): SelfAttention(
          (norm): GroupNorm(16, 512, eps=1e-05, affine=True)
          (qkv): Conv2d(512, 1536, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (out): Conv2d(512, 512, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (1): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=512, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Identity()
        )
      )
    )
    (ups): ModuleList(
      (0-1): 2 x ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=512, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 1024, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(1024, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(1024, 512, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (2): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=512, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 768, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(768, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(768, 512, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (3): Upsample(
        (up): Upsample(scale_factor=2.0, mode='nearest')
        (conv): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
      )
      (4): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=256, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 768, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(768, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(768, 256, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (5): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=256, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 512, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(512, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (6): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=256, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 384, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(384, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(384, 256, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (7): Upsample(
        (up): Upsample(scale_factor=2.0, mode='nearest')
        (conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
      )
      (8): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=128, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 384, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(384, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(384, 128, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (9): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=128, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 256, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(256, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (10): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=128, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 192, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(192, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(192, 128, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (11): Upsample(
        (up): Upsample(scale_factor=2.0, mode='nearest')
        (conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
      )
      (12): ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=64, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 192, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(192, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 64, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(192, 64, kernel_size=(1, 1), stride=(1, 1))
        )
      )
      (13-14): 2 x ResnetBlocWithAttn(
        (res_block): ResnetBlock(
          (noise_func): FeatureWiseAffine(
            (noise_func): Sequential(
              (0): Linear(in_features=64, out_features=64, bias=True)
            )
          )
          (block1): Block(
            (block): Sequential(
              (0): GroupNorm(16, 128, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(128, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (block2): Block(
            (block): Sequential(
              (0): GroupNorm(16, 64, eps=1e-05, affine=True)
              (1): Swish()
              (2): Identity()
              (3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
            )
          )
          (res_conv): Conv2d(128, 64, kernel_size=(1, 1), stride=(1, 1))
        )
      )
    )
    (final_conv): Block(
      (block): Sequential(
        (0): GroupNorm(16, 64, eps=1e-05, affine=True)
        (1): Swish()
        (2): Identity()
        (3): Conv2d(64, 3, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
      )
    )
    (mask_tail): FCN(
      (fcn): Sequential(
        (0): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
        (1): ReLU(inplace=True)
        (2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
        (3): ReLU(inplace=True)
        (4): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
        (5): ReLU(inplace=True)
        (6): Conv2d(64, 1, kernel_size=(1, 1), stride=(1, 1))
        (7): Sigmoid()
      )
    )
  )
  (loss_func): L1Loss()
)
23-08-09 09:46:37.680 - INFO: Model [DDPM] is created.
23-08-09 09:46:37.680 - INFO: Initial Model Finished
23-08-09 09:49:07.698 - INFO: <epoch:  1, iter:     100> l_pix: 3.2823e-01 
23-08-09 09:51:34.220 - INFO: <epoch:  2, iter:     200> l_pix: 2.2130e-01 
23-08-09 09:53:33.084 - INFO: <epoch:  3, iter:     300> l_pix: 2.1364e-01 
23-08-09 09:55:30.798 - INFO: <epoch:  4, iter:     400> l_pix: 1.6084e-01 
23-08-09 09:57:29.338 - INFO: <epoch:  5, iter:     500> l_pix: 1.1981e-01 
23-08-09 09:59:27.445 - INFO: <epoch:  6, iter:     600> l_pix: 1.0395e-01 
23-08-09 10:01:26.606 - INFO: <epoch:  7, iter:     700> l_pix: 1.4733e-01 
23-08-09 10:03:23.712 - INFO: <epoch:  8, iter:     800> l_pix: 1.4118e-01 
23-08-09 10:05:20.879 - INFO: <epoch:  9, iter:     900> l_pix: 1.2182e-01 
23-08-09 10:07:17.402 - INFO: <epoch: 10, iter:   1,000> l_pix: 1.3706e-01 
23-08-09 10:09:11.240 - INFO: <epoch: 10, iter:   1,100> l_pix: 9.8412e-02 
23-08-09 10:11:08.015 - INFO: <epoch: 11, iter:   1,200> l_pix: 1.2747e-01 
23-08-09 10:13:04.601 - INFO: <epoch: 12, iter:   1,300> l_pix: 8.0374e-02 
23-08-09 10:15:01.671 - INFO: <epoch: 13, iter:   1,400> l_pix: 9.7025e-02 
23-08-09 10:16:58.887 - INFO: <epoch: 14, iter:   1,500> l_pix: 8.9237e-02 
23-08-09 10:18:55.414 - INFO: <epoch: 15, iter:   1,600> l_pix: 1.1005e-01 
23-08-09 10:20:53.999 - INFO: <epoch: 16, iter:   1,700> l_pix: 1.0843e-01 
23-08-09 10:22:52.540 - INFO: <epoch: 17, iter:   1,800> l_pix: 9.9344e-02 
23-08-09 10:24:50.529 - INFO: <epoch: 18, iter:   1,900> l_pix: 8.4729e-02 
23-08-09 10:26:47.678 - INFO: <epoch: 19, iter:   2,000> l_pix: 8.1576e-02 
Traceback (most recent call last):
  File "/content/drive/MyDrive/ShadowDiffusion/sr.py", line 138, in <module>
    visuals = diffusion.get_current_visuals()
  File "/content/drive/MyDrive/ShadowDiffusion/model/model.py", line 147, in get_current_visuals
    out_dict['SR'] = self.SR.detach().float().cpu()
AttributeError: 'tuple' object has no attribute 'detach'

`

OPA067 commented 1 year ago

Have you solved this problem now? Can you tell me how to solve it? Thank you for contacting me: liuxin123450926@163.com

hzq2333 commented 10 months ago

@clair123456 @OPA067 @GuoLanqing Hello, have you solved this problem? Can you tell me how to solve it? Please contact me:huziqi0219@163.com

GIT-HYQ commented 9 months ago

Have you solved this problem now? Can you tell me how to solve it? Thank you for contacting me: liuxin123450926@163.com

try this model.py L147 out_dict['SR'] = self.SR[0].detach().float().cpu()

GIT-HYQ commented 9 months ago

@clair123456 @OPA067 @GuoLanqing Hello, have you solved this problem? Can you tell me how to solve it? Please contact me:huziqi0219@163.com

try this model.py L147 out_dict['SR'] = self.SR[0].detach().float().cpu()