Skip to content
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

Allow Using Specific Dataloaders in LightningCLI (Instead of a DataModule) #20673

Open
stuartthomson opened this issue Mar 26, 2025 · 0 comments
Labels
feature Is an improvement or enhancement needs triage Waiting to be triaged by maintainers

Comments

@stuartthomson
Copy link

stuartthomson commented Mar 26, 2025

Description & Motivation

I would like to configure the LightningCLI to use dataloaders in the test subcommand, similar to this example from the docs

trainer.test(dataloaders=test_dataloaders)

As far as I can tell this impossible using the LightningCLI because you can only pass a datamodule into it. My test set is defined differently from various training sets I have so this becomes annoying to create separate datamodules for each.

You can see that the dataloaders option is specifically ignored in the cli.py subcommands method.

Pitch

I would like to specify dataloaders in the LightningCLI. Perhaps like:

LightningCLI(
  MyModule,
  train_dataloaders=MyTrainDataloader,
  test_dataloaders=MyTestDataloader,
  args=args
)

Alternatives

The alternative is having to create different datamodules for every combination of train/test dataloaders.
Or you have to simply just not use the CLI stuff and call lightning directly.

Additional context

I would be willing to open a PR if this feature is deemed useful.

cc @lantiga @Borda

@stuartthomson stuartthomson added feature Is an improvement or enhancement needs triage Waiting to be triaged by maintainers labels Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement needs triage Waiting to be triaged by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant