简体   繁体   中英

An error with Omegaconf when running continuous image generation code

I found this author's PiggybackGAN code on Github (about continuous learning image generation) The link below: https://github.com/kaushik333/Piggyback-GAN-Pytorch The github issue has this problem,but no one has solved. I want to run this code in my Linux environment. After configuring the environment and data set, I get the following error:

initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
Length of loader is  10
learning rate 0.0002000 -> 0.0002000
save image!
Length of loader is  10
learning rate 0.0002000 -> 0.0002000
save image!
...
...
learning rate 0.0000040 -> 0.0000020
save image!
Length of loader is  10
learning rate 0.0000020 -> 0.0000000
save image!
Traceback (most recent call last):
  File "/opt/data/private/Pig/Piggyback-GAN-Pytorch-main/pb_cycleGAN.py", line 231, in main
    mp.spawn(train, nprocs=len(opt.gpu_ids), args=(opt,))
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 171, in spawn
    while not spawn_context.join():
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 118, in join
    raise Exception(msg)
Exception: 

-- Process 0 terminated with the following error:
Traceback (most recent call last):
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap
    fn(i, *args)
  File "/opt/data/private/Pig/Piggyback-GAN-Pytorch-main/pb_cycleGAN.py", line 88, in train
    opt.netG_A_filter_list.append([layer.unc_filt.detach().cpu()])
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/listconfig.py", line 228, in append
    self._format_and_raise(key=index, value=item, cause=e)
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/base.py", line 101, in _format_and_raise
    type_override=type_override,
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/_utils.py", line 629, in format_and_raise
    _raise(ex, cause)
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/_utils.py", line 610, in _raise
    raise ex  # set end OC_CAUSE=1 for full backtrace
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/listconfig.py", line 224, in append
    parent=self,
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/omegaconf.py", line 770, in _maybe_wrap
    ref_type=ref_type,
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/omegaconf.py", line 714, in _node_wrap
    ref_type=ref_type,
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/listconfig.py", line 68, in __init__
    format_and_raise(node=None, key=None, value=None, cause=ex, msg=str(ex))
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/_utils.py", line 629, in format_and_raise
    _raise(ex, cause)
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/_utils.py", line 610, in _raise
    raise ex  # set end OC_CAUSE=1 for full backtrace
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/listconfig.py", line 66, in __init__
    self._set_value(value=content)
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/listconfig.py", line 521, in _set_value
    self.append(item)
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/listconfig.py", line 228, in append
    self._format_and_raise(key=index, value=item, cause=e)
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/base.py", line 101, in _format_and_raise
    type_override=type_override,
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/_utils.py", line 694, in format_and_raise
    _raise(ex, cause)
  File "/root/anaconda3/envs/PiggybackGAN/lib/python3.6/site-packages/omegaconf/_utils.py", line 610, in _raise
    raise ex  # set end OC_CAUSE=1 for full backtrace
omegaconf.errors.UnsupportedValueType: Value 'Tensor' is not a supported primitive type
    full_key: netG_A_filter_list[0][0]
    reference_type=Optional[List[Any]]
    object_type=list

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Process finished with exit code 1

The information worth paying attention to is

 File "/opt/data/private/Pig/Piggyback-GAN-Pytorch-main/pb_cycleGAN.py", line 88, in train
    opt.netG_A_filter_list.append([layer.unc_filt.detach().cpu()])
omegaconf.errors.UnsupportedValueType: Value 'Tensor' is not a supported primitive type
    full_key: netG_A_filter_list[0][0]
    reference_type=Optional[List[Any]]
    object_type=list

My GPU only has a single core, not the 4 Gpus of the original author. I found the relevant part in the source code and conducted some tests to eliminate the problem of type mismatch. In addition, the version change of Omegaconf cannot solve my problem. On the right, the type of [layer.unc_filt.detach().cpu()] is list[tensor[]]

about code image

I don't know how to solve this problem now. I don't know whether to modify the code or be affected by the process. Could someone please tell me what I should do?

OmegaConf does not support assignment of non primitive types to the config. This have changed years ago. There is a possibility that the author used a very old version of OmegaConf that did allow for this assignment, but based on his environment.yaml file he is using 2.0.6 which does not support it.

Contact the author of the code about this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM