krishna veer
krishna veer

Reputation: 514

TypeError: _named_members() got an unexpected keyword argument 'remove_duplicate'

I'm working on Supper resolution using GAN project and I'm trying to train SRGAN but I'm getting one error:

[TLX] Linear  linear_1: 1 No Activation
[TLX] Conv2d conv1_1: out_channels : 64 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv1_2: out_channels : 64 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] MaxPool2d pool1: kernel_size: (2, 2) stride: (2, 2) padding: SAME return_mask: False
[TLX] Conv2d conv2_1: out_channels : 128 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv2_2: out_channels : 128 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] MaxPool2d pool2: kernel_size: (2, 2) stride: (2, 2) padding: SAME return_mask: False
[TLX] Conv2d conv3_1: out_channels : 256 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv3_2: out_channels : 256 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv3_3: out_channels : 256 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv3_4: out_channels : 256 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] MaxPool2d pool3: kernel_size: (2, 2) stride: (2, 2) padding: SAME return_mask: False
[TLX] Conv2d conv4_1: out_channels : 512 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv4_2: out_channels : 512 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv4_3: out_channels : 512 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] Conv2d conv4_4: out_channels : 512 kernel_size: (3, 3) stride: (1, 1) pad: SAME act: ReLU
[TLX] MaxPool2d pool4: kernel_size: (2, 2) stride: (2, 2) padding: SAME return_mask: False
[TLX] Restore pre-trained weights
[TLX]   Loading (3, 3, 3, 64) in conv1_1
[TLX]   Loading (64,) in conv1_1
Traceback (most recent call last):
  File "train.py", line 113, in <module>
    VGG = vgg.VGG19(pretrained=True, end_with='pool4', mode='dynamic')
  File "D:\E\MtechDAIICT\Sem3\ComputerVision\Project\SRGAN\vgg.py", line 261, in vgg19
    restore_model(model, layer_type='vgg19')
  File "D:\E\MtechDAIICT\Sem3\ComputerVision\Project\SRGAN\vgg.py", line 175, in restore_model
    if len(model.all_weights) == len(weights1):
  File "D:\E\anaconda\envs\opencv-env2\lib\site-packages\tensorlayerx\nn\core\core_torch.py", line 149, in all_weights
    for name, param in self.named_parameters(recurse=True):
  File "D:\E\anaconda\envs\opencv-env2\lib\site-packages\torch\nn\modules\module.py", line 2112, in named_parameters
    gen = self._named_members(
TypeError: _named_members() got an unexpected keyword argument 'remove_duplicate'

link: https://github.com/tensorlayer/SRGAN/blob/7444cc758ab493f5e29227663e37cb90034b64a1/train.py#L111

Could you please help me? Thank you.

Upvotes: 0

Views: 331

Answers (1)

ganesh malladi
ganesh malladi

Reputation: 1

If you have downloaded Tensorflow model weights, change the backend to tensorflow backend. os.environ['TL_BACKEND'] = 'tensorflow' By default it is set to torch in train.py file

Upvotes: 0

Related Questions