open-mmlab / mmcv

OpenMMLab Computer Vision Foundation
https://mmcv.readthedocs.io/en/latest/
Apache License 2.0
5.91k stars 1.65k forks source link

[Bug] TypeError: class `ControlNetDataset` in mmagic/datasets/controlnet_dataset.py: class `LoadImageFromFile` in mmcv/transforms/loading.py: __init__() got an unexpected keyword argument 'keys' #3003

Open drewZZzz6 opened 11 months ago

drewZZzz6 commented 11 months ago

Prerequisite

Environment

OrderedDict([('sys.platform', 'linux'), ('Python', '3.9.16 (main, Mar 8 2023, 14:00:05) [GCC 11.2.0]'), ('CUDA available', True), ('numpy_random_seed', 2147483648), ('GPU 0', 'NVIDIA GeForce RTX 3090 Ti'), ('TorchVision', '0.14.1'), ('OpenCV', '4.8.1'), ('MMEngine', '0.6.0'), ('MMCV', '2.1.0'), ('MMCV Compiler', 'GCC 11.3'), ('MMCV CUDA Compiler', '11.7')])

Reproduces the problem - code sample

TypeError: class ControlNetDataset in mmagic/datasets/controlnet_dataset.py: class LoadImageFromFile in mmcv/transforms/loading.py: init() got an unexpected keyword argument 'key' ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 888) of binary: /home/zyz/anaconda3/envs/py39/bin/python

Reproduces the problem - command or script

bash tools/dist_train.sh configs/controlnet/controlnet-1xb1-fill50k.py 1

Reproduces the problem - error message

TypeError: class LoadImageFromFile in mmcv/transforms/loading.py: init() got an unexpected keyword argument 'keys'

Additional information

1、当我用Fill50K训练ControlNet时报错了,

Config for data loader

pipeline = [ dict(type='LoadImageFromFile', key='source', channel_order='rgb'), dict(type='LoadImageFromFile', key='target', channel_order='rgb'), dict( type='PackInputs', keys=['source', 'target'], data_keys='prompt', meta_keys=[ 'source_channel_order', 'source_color_type', 'target_channel_order', 'target_color_type' ])

zhouzaida commented 10 months ago

Hi, what is your mmagic version? mmagic has implemented the LoadImageFromFile transform so it should use the implementation from mmagic rather than mmcv.

https://github.com/open-mmlab/mmagic/blob/1bdd952457ff6c81ea4a7d628cf911bda21819dc/mmagic/datasets/transforms/loading.py#L16

If your mmagic version is less than 1.0.0, you could try to upgrade your mmagic version to 1.0.0+.