Lightning-AI / pytorch-lightning

Pretrain, finetune and deploy AI models on multiple GPUs, TPUs with zero code changes.

Home Page:https://lightning.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: Parser key "data": Problem with given class_path 'my_class_path': __args__

MBAnslow opened this issue · comments

Bug description

When trying to run my lightning module using lightning CLI I get the error:

error: Parser key "data":
  Problem with given class_path 'my_class_path':
    __args__

Surprisingly, if I only have the function

def setup(self, stage: str):

defined I don't get the error and the setup code is run. However, as soon as I add the function

    def train_dataloader(self):
        return DataLoader(self.train, shuffle=True, **self.dataloader_kwargs)

I get the error.

I assume it is an problem parsing the python file but I have never encountered this problem before.

What version are you seeing the problem on?

v2.2

How to reproduce the bug

No response

Error messages and logs

usage: main.py [-h] [-c CONFIG] [--print_config[=flags]]
               [--seed_everything SEED_EVERYTHING] [--trainer CONFIG]
               [--trainer.accelerator.help CLASS_PATH_OR_NAME]
               [--trainer.accelerator ACCELERATOR]
               [--trainer.strategy.help CLASS_PATH_OR_NAME]
               [--trainer.strategy STRATEGY] [--trainer.devices DEVICES]
               [--trainer.num_nodes NUM_NODES] [--trainer.precision PRECISION]
               [--trainer.logger.help CLASS_PATH_OR_NAME]
               [--trainer.logger LOGGER]
               [--trainer.callbacks.help CLASS_PATH_OR_NAME]
               [--trainer.callbacks CALLBACKS]
               [--trainer.fast_dev_run FAST_DEV_RUN]
               [--trainer.max_epochs MAX_EPOCHS]
               [--trainer.min_epochs MIN_EPOCHS]
               [--trainer.max_steps MAX_STEPS] [--trainer.min_steps MIN_STEPS]
               [--trainer.max_time MAX_TIME]
               [--trainer.limit_train_batches LIMIT_TRAIN_BATCHES]
               [--trainer.limit_val_batches LIMIT_VAL_BATCHES]
               [--trainer.limit_test_batches LIMIT_TEST_BATCHES]
               [--trainer.limit_predict_batches LIMIT_PREDICT_BATCHES]
               [--trainer.overfit_batches OVERFIT_BATCHES]
               [--trainer.val_check_interval VAL_CHECK_INTERVAL]
               [--trainer.check_val_every_n_epoch CHECK_VAL_EVERY_N_EPOCH]
               [--trainer.num_sanity_val_steps NUM_SANITY_VAL_STEPS]
               [--trainer.log_every_n_steps LOG_EVERY_N_STEPS]
               [--trainer.enable_checkpointing {true,false,null}]
               [--trainer.enable_progress_bar {true,false,null}]
               [--trainer.enable_model_summary {true,false,null}]
               [--trainer.accumulate_grad_batches ACCUMULATE_GRAD_BATCHES]
               [--trainer.gradient_clip_val GRADIENT_CLIP_VAL]
               [--trainer.gradient_clip_algorithm GRADIENT_CLIP_ALGORITHM]
               [--trainer.deterministic DETERMINISTIC]
               [--trainer.benchmark {true,false,null}]
               [--trainer.inference_mode {true,false}]
               [--trainer.use_distributed_sampler {true,false}]
               [--trainer.profiler.help CLASS_PATH_OR_NAME]
               [--trainer.profiler PROFILER]
               [--trainer.detect_anomaly {true,false}]
               [--trainer.barebones {true,false}]
               [--trainer.plugins.help CLASS_PATH_OR_NAME]
               [--trainer.plugins PLUGINS]
               [--trainer.sync_batchnorm {true,false}]
               [--trainer.reload_dataloaders_every_n_epochs RELOAD_DATALOADERS_EVERY_N_EPOCHS]
               [--trainer.default_root_dir DEFAULT_ROOT_DIR]
               [--model.help CLASS_PATH_OR_NAME]
               --model CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE
               [--data.help CLASS_PATH_OR_NAME]
               --data CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE
               [--ckpt_path CKPT_PATH] [--optimizer.help CLASS_PATH_OR_NAME]
               [--optimizer CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE]
               [--lr_scheduler.help CLASS_PATH_OR_NAME]
               [--lr_scheduler CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE]
error: Parser key "data":
  Problem with given class_path 'data.datamodules.AudioTextDataModule1':
    __args__

Environment

Current environment
  • CUDA:
    - GPU: None
    - available: False
    - version: None
  • Lightning:
    - lightning: 2.3.0
    - lightning-utilities: 0.11.2
    - pytorch-lightning: 2.3.0
    - torch: 2.1.2
    - torchaudio: 2.1.2
    - torchlibrosa: 0.1.0
    - torchmetrics: 1.4.0.post0
    - torchvision: 0.16.2
  • Packages:
    - aiohttp: 3.9.1
    - aiosignal: 1.3.1
    - appdirs: 1.4.4
    - asttokens: 2.4.1
    - async-timeout: 4.0.3
    - attrs: 23.2.0
    - audioread: 3.0.1
    - braceexpand: 0.1.7
    - certifi: 2023.11.17
    - cffi: 1.16.0
    - charset-normalizer: 3.3.2
    - click: 8.1.7
    - contourpy: 1.2.0
    - cycler: 0.12.1
    - datasets: 2.16.1
    - decorator: 5.1.1
    - dill: 0.3.7
    - docker-pycreds: 0.4.0
    - exceptiongroup: 1.2.0
    - executing: 2.0.1
    - fastjsonschema: 2.19.1
    - filelock: 3.13.1
    - fonttools: 4.47.2
    - frozenlist: 1.4.1
    - fsspec: 2023.10.0
    - ftfy: 6.1.3
    - gitdb: 4.0.11
    - gitpython: 3.1.41
    - h5py: 3.10.0
    - huggingface-hub: 0.20.3
    - idna: 3.6
    - ipython: 8.20.0
    - jedi: 0.19.1
    - jinja2: 3.1.3
    - joblib: 1.3.2
    - jsonpickle: 3.0.2
    - jsonschema: 4.21.1
    - jsonschema-specifications: 2023.12.1
    - jupyter-core: 5.7.1
    - kiwisolver: 1.4.5
    - laion-clap: 1.1.4
    - lazy-loader: 0.3
    - librosa: 0.10.1
    - lightning: 2.3.0
    - lightning-utilities: 0.11.2
    - llvmlite: 0.41.1
    - markupsafe: 2.1.4
    - matplotlib: 3.8.2
    - matplotlib-inline: 0.1.6
    - mpmath: 1.3.0
    - msgpack: 1.0.7
    - multidict: 6.0.4
    - multiprocess: 0.70.15
    - nbformat: 5.9.2
    - networkx: 3.2.1
    - numba: 0.58.1
    - numpy: 1.23.5
    - packaging: 23.2
    - pandas: 2.2.0
    - parso: 0.8.3
    - pexpect: 4.9.0
    - pillow: 10.2.0
    - pip: 24.0
    - platformdirs: 4.1.0
    - plotly: 5.18.0
    - pooch: 1.8.0
    - progressbar: 2.5
    - prompt-toolkit: 3.0.43
    - protobuf: 4.25.2
    - psutil: 5.9.8
    - ptyprocess: 0.7.0
    - pure-eval: 0.2.2
    - pyarrow: 15.0.0
    - pyarrow-hotfix: 0.6
    - pycparser: 2.21
    - pygments: 2.17.2
    - pynndescent: 0.5.11
    - pyparsing: 3.1.1
    - python-dateutil: 2.8.2
    - pytorch-lightning: 2.3.0
    - pytz: 2023.3.post1
    - pyvis: 0.3.2
    - pyyaml: 6.0.1
    - referencing: 0.32.1
    - regex: 2023.12.25
    - requests: 2.31.0
    - rpds-py: 0.17.1
    - safetensors: 0.4.2
    - scikit-learn: 1.4.0
    - scipy: 1.12.0
    - sentry-sdk: 1.39.2
    - setproctitle: 1.3.3
    - setuptools: 65.5.1
    - six: 1.16.0
    - smmap: 5.0.1
    - soundfile: 0.12.1
    - soxr: 0.3.7
    - stack-data: 0.6.3
    - stop-words: 2018.7.23
    - sympy: 1.12
    - tenacity: 8.2.3
    - tensorboardx: 2.6.2.2
    - threadpoolctl: 3.2.0
    - tokenizers: 0.13.3
    - torch: 2.1.2
    - torchaudio: 2.1.2
    - torchlibrosa: 0.1.0
    - torchmetrics: 1.4.0.post0
    - torchvision: 0.16.2
    - tqdm: 4.66.1
    - traitlets: 5.14.1
    - transformers: 4.30.0
    - typing-extensions: 4.9.0
    - tzdata: 2023.4
    - umap-learn: 0.5.5
    - urllib3: 2.1.0
    - wandb: 0.16.2
    - wcwidth: 0.2.13
    - webdataset: 0.2.86
    - wget: 3.2
    - wheel: 0.42.0
    - wordcloud: 1.9.3
    - wordninja: 2.0.0
    - xxhash: 3.4.1
    - yarl: 1.9.4
  • System:
    - OS: Darwin
    - architecture:
    - 64bit
    -
    - processor: arm
    - python: 3.10.5
    - release: 23.2.0
    - version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000

More info

No response