mmgeneration icon indicating copy to clipboard operation
mmgeneration copied to clipboard

TypeError: UnconditionalImageDataset: __init__() got an unexpected keyword argument 'dataset'

Open ljq8866 opened this issue 2 years ago • 1 comments

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. I have read the FAQ documentation but cannot get the expected help.
  3. The bug has not been fixed in the latest version.

Describe the bug

Traceback (most recent call last): File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/mmcv/utils/registry.py", line 69, in build_from_cfg return obj_cls(**args) TypeError: init() got an unexpected keyword argument 'dataset'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/train.py", line 228, in main() File "tools/train.py", line 206, in main datasets = [build_dataset(cfg.data.train)] File "/home/lthpc/Annotation/LJQ/src/mmgeneration-master/mmgen/datasets/builder.py", line 60, in build_dataset dataset = build_from_cfg(cfg, DATASETS, default_args) File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/mmcv/utils/registry.py", line 72, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') TypeError: UnconditionalImageDataset: init() got an unexpected keyword argument 'dataset' ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 3910) of binary: /home/lthpc/anaconda2/envs/ljq/bin/python Traceback (most recent call last): File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/torch/distributed/launch.py", line 193, in main() File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/torch/distributed/launch.py", line 189, in main launch(args) File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/torch/distributed/launch.py", line 174, in launch run(args) File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/torch/distributed/run.py", line 752, in run elastic_launch( File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 131, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/home/lthpc/anaconda2/envs/ljq/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

Reproduction

  1. What command or script did you run? bash tools/dist_train.sh configs/styleganv3/stylegan3_r_ada_fp16_gamma3.3_flag_TW_640_b4x8.py 1 --work-dir ./work_dirs/experiments/TW

  2. Did you make any modifications on the code or config? Did you understand what you have modified? yes,I have changed the cfg file

  3. What dataset did you use? my dataset

Environment

_sys.platform: linux Python: 3.8.13 (default, Mar 28 2022, 11:38:47) [GCC 7.5.0] CUDA available: True CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 10.0, V10.0.130 GPU 0: TITAN V GPU 1,2: GeForce RTX 2080 SUPER GPU 3: TITAN Xp GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 PyTorch: 1.12.0+cu102 PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • LAPACK is enabled (usually provided by MKL)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 10.2
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70
  • CuDNN 7.6.5
  • Magma 2.5.2_**

Error traceback If applicable, paste the error trackback here.

I don't know what's the meaning of the "dataset" error,and why ,I just change the cfg file, if anyone can help me, I will be appreciated.

ljq8866 avatar Jul 27 '22 03:07 ljq8866

Seems that you use a self-defined config is modified from stylegan3_r_ada_fp16_gamma3.3_metfaces_1024_b4x8 .

In the original config, dataset is defined in https://github.com/open-mmlab/mmgeneration/blob/master/configs/_base_/datasets/ffhq_flip.py

Maybe you remove RepeatDataset from data['train'] but still remain dataset. If you do not want to use RepeatDataset, you can use the following config:

data = dict(
    samples_per_gpu=None,
    workers_per_gpu=4,
    train=dict(type=dataset_type, imgs_root=None, pipeline=train_pipeline)),
    val=dict(type=dataset_type, imgs_root=None, pipeline=val_pipeline))

LeoXing1996 avatar Jul 28 '22 03:07 LeoXing1996