Skip to content

Commit 920e76e

Browse files
committed
prune ecosystem example (#5085)
* draft * wip * CI * drop pl geometry * copy * logo
1 parent 0877b7c commit 920e76e

21 files changed

+168
-468
lines changed

pl_examples/__init__.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,40 @@
88

99
TORCHVISION_AVAILABLE = _module_available("torchvision")
1010
DALI_AVAILABLE = _module_available("nvidia.dali")
11+
12+
13+
LIGHTNING_LOGO = """
14+
####
15+
###########
16+
####################
17+
############################
18+
#####################################
19+
##############################################
20+
######################### ###################
21+
####################### ###################
22+
#################### ####################
23+
################## #####################
24+
################ ######################
25+
##################### #################
26+
###################### ###################
27+
##################### #####################
28+
#################### #######################
29+
################### #########################
30+
##############################################
31+
#####################################
32+
############################
33+
####################
34+
##########
35+
####
36+
"""
37+
38+
39+
def nice_print(msg, last=False):
40+
print()
41+
print("\033[0;35m" + msg + "\033[0m")
42+
if last:
43+
print()
44+
45+
46+
def cli_lightning_logo():
47+
nice_print(LIGHTNING_LOGO)

pl_examples/basic_examples/autoencoder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from torch.utils.data import random_split
2222

2323
import pytorch_lightning as pl
24-
from pl_examples import TORCHVISION_AVAILABLE
24+
from pl_examples import TORCHVISION_AVAILABLE, cli_lightning_logo
2525

2626
if TORCHVISION_AVAILABLE:
2727
from torchvision.datasets.mnist import MNIST
@@ -105,4 +105,5 @@ def cli_main():
105105

106106

107107
if __name__ == '__main__':
108+
cli_lightning_logo()
108109
cli_main()

pl_examples/basic_examples/backbone_image_classifier.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from torch.utils.data import DataLoader, random_split
2020

2121
import pytorch_lightning as pl
22-
from pl_examples import DATASETS_PATH, TORCHVISION_AVAILABLE
22+
from pl_examples import DATASETS_PATH, TORCHVISION_AVAILABLE, cli_lightning_logo
2323

2424
if TORCHVISION_AVAILABLE:
2525
from torchvision.datasets.mnist import MNIST
@@ -125,4 +125,5 @@ def cli_main():
125125

126126

127127
if __name__ == '__main__':
128+
cli_lightning_logo()
128129
cli_main()

pl_examples/basic_examples/conv_sequential_example.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import torchvision
3030

3131
import pytorch_lightning as pl
32+
from pl_examples import cli_lightning_logo
3233
from pytorch_lightning import Trainer
3334
from pytorch_lightning.metrics.functional import accuracy
3435
from pytorch_lightning.plugins.ddp_sequential_plugin import DDPSequentialPlugin
@@ -190,6 +191,7 @@ def instantiate_datamodule(args):
190191

191192

192193
if __name__ == "__main__":
194+
cli_lightning_logo()
193195
parser = ArgumentParser(description="Pipe Example")
194196
parser.add_argument("--use_ddp_sequential", action="store_true")
195197
parser = Trainer.add_argparse_args(parser)

pl_examples/basic_examples/dali_image_classifier.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from torch.utils.data import random_split
2323

2424
import pytorch_lightning as pl
25-
from pl_examples import TORCHVISION_AVAILABLE, DALI_AVAILABLE
25+
from pl_examples import TORCHVISION_AVAILABLE, DALI_AVAILABLE, cli_lightning_logo
2626

2727
if TORCHVISION_AVAILABLE:
2828
from torchvision.datasets.mnist import MNIST
@@ -205,4 +205,5 @@ def cli_main():
205205

206206

207207
if __name__ == "__main__":
208+
cli_lightning_logo()
208209
cli_main()

pl_examples/basic_examples/simple_image_classifier.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from torch.nn import functional as F
2020

2121
import pytorch_lightning as pl
22+
from pl_examples import cli_lightning_logo
2223
from pl_examples.basic_examples.mnist_datamodule import MNISTDataModule
2324

2425

@@ -103,4 +104,5 @@ def cli_main():
103104

104105

105106
if __name__ == '__main__':
107+
cli_lightning_logo()
106108
cli_main()

pl_examples/bug_report_model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import os
2323
import torch
2424
from torch.utils.data import Dataset
25+
26+
from pl_examples import cli_lightning_logo
2527
from pytorch_lightning import Trainer, LightningModule
2628

2729

@@ -137,4 +139,5 @@ def on_train_epoch_start(self) -> None:
137139

138140

139141
if __name__ == '__main__':
142+
cli_lightning_logo()
140143
run_test()

pl_examples/domain_templates/computer_vision_fine_tuning.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright The PyTorch Lightning team.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
"""Computer vision example on Transfer Learning.
215
316
This computer vision example illustrates how one could fine-tune a pre-trained
@@ -40,6 +53,7 @@
4053
from torchvision.datasets.utils import download_and_extract_archive
4154

4255
import pytorch_lightning as pl
56+
from pl_examples import cli_lightning_logo
4357
from pytorch_lightning import _logger as log
4458

4559
BN_TYPES = (torch.nn.BatchNorm1d, torch.nn.BatchNorm2d, torch.nn.BatchNorm3d)
@@ -451,4 +465,5 @@ def get_args() -> argparse.Namespace:
451465

452466

453467
if __name__ == '__main__':
468+
cli_lightning_logo()
454469
main(get_args())

pl_examples/domain_templates/generative_adversarial_net.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright The PyTorch Lightning team.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
"""
215
To run this template just do:
316
python generative_adversarial_net.py
@@ -18,6 +31,7 @@
1831
from torch.utils.data import DataLoader
1932
from torchvision.datasets import MNIST
2033

34+
from pl_examples import cli_lightning_logo
2135
from pytorch_lightning.core import LightningModule, LightningDataModule
2236
from pytorch_lightning.trainer import Trainer
2337

@@ -211,6 +225,7 @@ def main(args: Namespace) -> None:
211225

212226

213227
if __name__ == '__main__':
228+
cli_lightning_logo()
214229
parser = ArgumentParser()
215230

216231
# Add program level args, if any.

pl_examples/domain_templates/imagenet.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright The PyTorch Lightning team.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
"""
215
This example is largely adapted from https://github.com/pytorch/examples/blob/master/imagenet/main.py
316
@@ -32,6 +45,7 @@
3245
import torchvision.transforms as transforms
3346

3447
import pytorch_lightning as pl
48+
from pl_examples import cli_lightning_logo
3549
from pytorch_lightning.core import LightningModule
3650

3751

@@ -246,4 +260,5 @@ def run_cli():
246260

247261

248262
if __name__ == '__main__':
263+
cli_lightning_logo()
249264
run_cli()

0 commit comments

Comments
 (0)