Pedestrian-Synthesis-GAN icon indicating copy to clipboard operation
Pedestrian-Synthesis-GAN copied to clipboard

cuda() got an unexpected keyword argument '_id'

Open bilzard opened this issue 3 years ago • 3 comments

when training, the below error occurs:

python train.py \
    --dataroot /content/psgan_datasets/ \
    --name my_experiment_1 \
    --model pix2pix \
    --which_model_netG unet_256 \
    --batchSize 256 \
    --which_direction BtoA \
    --lambda_A 100 \
    --dataset_mode aligned \
    --use_spp --no_lsgan --norm batch

------------ Options -------------
batchSize: 256
beta1: 0.5
checkpoints_dir: ./checkpoints
continue_train: False
dataroot: /content/psgan_datasets/
dataset_mode: aligned
display_freq: 100
display_id: 1
display_port: 8097
display_single_pane_ncols: 0
display_winsize: 256
fineSize: 256
gpu_ids: [0]
identity: 0.0
input_nc: 3
isTrain: True
lambda_A: 100.0
lambda_B: 10.0
loadSize: 286
lr: 0.0002
max_dataset_size: inf
model: pix2pix
nThreads: 2
n_layers_D: 3
name: my_experiment_1
ndf: 64
ngf: 64
niter: 100
niter_decay: 100
no_dropout: False
no_flip: False
no_html: False
no_lsgan: True
norm: batch
output_nc: 3
phase: train
pool_size: 50
print_freq: 100
resize_or_crop: resize_and_crop
save_epoch_freq: 5
save_latest_freq: 5000
serial_batches: False
use_spp: True
which_direction: BtoA
which_epoch: latest
which_model_netD: basic
which_model_netG: unet_256
-------------- End ----------------
CustomDatasetDataLoader
dataset [AlignedDataset] was created
#training images = 1200
pix2pix
Traceback (most recent call last):
  File "train.py", line 13, in <module>
    model = create_model(opt)
  File "/content/Pedestrian-Synthesis-GAN/models/models.py", line 19, in create_model
    model.initialize(opt)
  File "/content/Pedestrian-Synthesis-GAN/models/pix2pix_model.py", line 43, in initialize
    self.netD_person = networks.define_person_D(opt.input_nc, opt.ndf, opt, use_sigmoid, self.gpu_ids)
  File "/content/Pedestrian-Synthesis-GAN/models/networks.py", line 91, in define_person_D
    _id=gpu_ids[0])
TypeError: cuda() got an unexpected keyword argument '_id'

The symptom is similar to this issue: https://github.com/KupynOrest/DeblurGAN/issues/26

bilzard avatar Dec 10 '21 11:12 bilzard

GPU info:

nvidia-smi

Fri Dec 10 11:42:36 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 495.44       Driver Version: 460.32.03    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla P100-PCIE...  Off  | 00000000:00:04.0 Off |                    0 |
| N/A   36C    P0    26W / 250W |      0MiB / 16280MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

bilzard avatar Dec 10 '21 11:12 bilzard

@bilzard change _id to device in networks.py it would work.

hamzakhalil798 avatar Dec 12 '22 06:12 hamzakhalil798

@hamzakhalil798 Sorry for asking around but did you ever manage to get this framework to actually generate images ? Because I cannot using the code posted on git. Model trains fantastic, it recreates training images (800) very well when running the test script the generated images are exceptionally bad. Like really bad? Just wondering if anyone got this to work apart from the authors ? Please let me know if you see this message :-) . Thx

Latzi avatar Nov 28 '23 11:11 Latzi