New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Error when training model - TypeError: BaseDataset.__init__() got an unexpected keyword argument 'split' #1858
Comments
I had the same problem following the guide How to Pretrain with Custom Dataset. The problem is that the dataset you are overriding has a The solution I found was to copy all the arguments and add an extra train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='RandomResizedCrop', scale=224, backend='pillow'),
dict(type='RandomFlip', prob=0.5, direction='horizontal'),
dict(type='PackInputs'),
]
train_dataloader = dict(
dataset=dict(
type='CustomDataset',
data_root=data_root,
ann_file='', # We assume you are using the sub-folder format without ann_file
data_prefix='train',
pipeline=train_pipeline,
_delete_=True,
)) |
Hi, @leon-costa, I'm trying but not working, |
Hi everyone, any update? |
I have made it worked. @leon-costa 's solution and the link he gave In my case I have removed the '../base/datasets/imagenet_bs32_pil_resize.py', from my config's base, then applied required dict settings (of course without split) for dataset into my config. Then it worked. |
@TNodeCode
A prominent dataset that utilizes this feature is |
Branch
main branch (mmpretrain version)
Describe the bug
I have tried to train a model on a custom dataset using the mmpretrain library.
First I cloned the repository, then I created a dataset folder with the following structure:
-- custom_dataset
--- train
--- test
--- val
Next I followed the documentation (https://mmpretrain.readthedocs.io/en/latest/user_guides/train.html) on how to train a classification model on a custom dataset.
I created a new configuration file:
configs/mobilenet_v2/mobilenet-v2_finetune.py
I then tried to train the model on my custom dataset with the command
python ./tools/train.py ./configs/mobilenet_v2/mobilenet-v2_finetune.py
Then I get the following error:
Environment
{'sys.platform': 'win32',
'Python': '3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 '
'64 bit (AMD64)]',
'CUDA available': False,
'numpy_random_seed': 2147483648,
'MSVC': 'Microsoft (R) C/C++-Optimierungscompiler Version 19.26.28806 für x64',
'GCC': 'n/a',
'PyTorch': '2.0.1+cu117',
'TorchVision': '0.15.2+cu117',
'OpenCV': '4.7.0',
'MMEngine': '0.10.2',
'MMCV': '2.1.0',
'MMPreTrain': '1.1.1+e95d9ac'}
Other information
No response
The text was updated successfully, but these errors were encountered: