Closed wang-TJ-20 closed 2 years ago
(pytorch) SENSETIME\wangzitong@cn0614005786l:~/Desktop/pytorch-CycleGAN-and-pix2pix$ this is my command,how to solve this question python test.py --dataroot ./datasets/little/test --name little_fujian --norm instance --dataset_mode single --model test --netG resnet_9blocks ----------------- Options --------------- aspect_ratio: 1.0 batch_size: 1 checkpoints_dir: ./checkpoints crop_size: 256 dataroot: ./datasets/little/test [default: None] dataset_mode: single direction: AtoB display_winsize: 256 epoch: latest eval: False gpu_ids: 0 init_gain: 0.02 init_type: normal input_nc: 3 isTrain: False [default: None] load_iter: 0 [default: 0] load_size: 256 max_dataset_size: inf model: test model_suffix: n_layers_D: 3 name: little_fujian [default: experiment_name] ndf: 64 netD: basic netG: resnet_9blocks ngf: 64 no_dropout: False no_flip: False norm: instance num_test: 50 num_threads: 4 output_nc: 3 phase: test preprocess: resize_and_crop results_dir: ./results/ serial_batches: False suffix: use_wandb: False verbose: False wandb_project_name: CycleGAN-and-pix2pix ----------------- End ------------------- dataset [SingleDataset] was created initialize network with normal model [TestModel] was created loading the model from ./checkpoints/little_fujian/latest_net_G.pth Traceback (most recent call last): File "test.py", line 52, in model.setup(opt) # regular setup: load and print networks; create schedulers File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 88, in setup self.load_networks(load_suffix) File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 198, in load_networks self.patch_instance_norm_state_dict(state_dict, net, key.split('.')) File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 174, in patch_instance_norm_state_dict self.patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1) File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 174, in patch_instance_norm_state_dict self.__patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1) File "/home/SENSETIME/wangzitong/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1207, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Sequential' object has no attribute 'model'
@wang-TJ-20 Hello , I wonder if you solved the problem! I have exactly the same problem and would appreciate any help
see the solution here https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/issues/358
(pytorch) SENSETIME\wangzitong@cn0614005786l:~/Desktop/pytorch-CycleGAN-and-pix2pix$ this is my command,how to solve this question python test.py --dataroot ./datasets/little/test --name little_fujian --norm instance --dataset_mode single --model test --netG resnet_9blocks ----------------- Options --------------- aspect_ratio: 1.0
model.setup(opt) # regular setup: load and print networks; create schedulers
File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 88, in setup
self.load_networks(load_suffix)
File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 198, in load_networks
self.patch_instance_norm_state_dict(state_dict, net, key.split('.'))
File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 174, in patch_instance_norm_state_dict
self.patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1)
File "/home/SENSETIME/wangzitong/Desktop/pytorch-CycleGAN-and-pix2pix/models/base_model.py", line 174, in patch_instance_norm_state_dict
self.__patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1)
File "/home/SENSETIME/wangzitong/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1207, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Sequential' object has no attribute 'model'
batch_size: 1
checkpoints_dir: ./checkpoints
crop_size: 256
dataroot: ./datasets/little/test [default: None] dataset_mode: single
direction: AtoB
display_winsize: 256
epoch: latest
eval: False
gpu_ids: 0
init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: False [default: None] load_iter: 0 [default: 0] load_size: 256
max_dataset_size: inf
model: test
model_suffix:
n_layers_D: 3
name: little_fujian [default: experiment_name] ndf: 64
netD: basic
netG: resnet_9blocks
ngf: 64
no_dropout: False
no_flip: False
norm: instance
num_test: 50
num_threads: 4
output_nc: 3
phase: test
preprocess: resize_and_crop
results_dir: ./results/
serial_batches: False
suffix:
use_wandb: False
verbose: False
wandb_project_name: CycleGAN-and-pix2pix
----------------- End ------------------- dataset [SingleDataset] was created initialize network with normal model [TestModel] was created loading the model from ./checkpoints/little_fujian/latest_net_G.pth Traceback (most recent call last): File "test.py", line 52, in