Skip to content

Commit

Permalink
improve importing demos (#20446)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Nov 25, 2024
1 parent 75d7357 commit 1f4a77c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
17 changes: 15 additions & 2 deletions src/lightning/pytorch/demos/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
from lightning.pytorch.demos.lstm import LightningLSTM, SequenceSampler, SimpleLSTM # noqa: F401
from lightning.pytorch.demos.transformer import LightningTransformer, Transformer, WikiText2 # noqa: F401
from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel, DemoModel
from lightning.pytorch.demos.lstm import LightningLSTM, SequenceSampler, SimpleLSTM
from lightning.pytorch.demos.transformer import LightningTransformer, Transformer, WikiText2

__all__ = [
"LightningLSTM",
"SequenceSampler",
"SimpleLSTM",
"LightningTransformer",
"Transformer",
"WikiText2",
"BoringModel",
"BoringDataModule",
"DemoModel",
]
8 changes: 4 additions & 4 deletions tests/tests_pytorch/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ def test_lightning_cli_print_config():
"any.py",
"predict",
"--seed_everything=1234",
"--model=lightning.pytorch.demos.boring_classes.BoringModel",
"--data=lightning.pytorch.demos.boring_classes.BoringDataModule",
"--model=lightning.pytorch.demos.BoringModel",
"--data=lightning.pytorch.demos.BoringDataModule",
"--print_config",
]
out = StringIO()
Expand All @@ -492,8 +492,8 @@ def test_lightning_cli_print_config():

outval = yaml.safe_load(text)
assert outval["seed_everything"] == 1234
assert outval["model"]["class_path"] == "lightning.pytorch.demos.boring_classes.BoringModel"
assert outval["data"]["class_path"] == "lightning.pytorch.demos.boring_classes.BoringDataModule"
assert outval["model"]["class_path"] == "lightning.pytorch.demos.BoringModel"
assert outval["data"]["class_path"] == "lightning.pytorch.demos.BoringDataModule"
assert outval["ckpt_path"] is None


Expand Down

0 comments on commit 1f4a77c

Please sign in to comment.