|
12 | 12 |
|
13 | 13 | .. _new_project:
|
14 | 14 |
|
15 |
| -############ |
16 |
| -Introduction |
17 |
| -############ |
18 | 15 |
|
19 |
| -************************** |
20 |
| -What is PyTorch Lightning? |
21 |
| -************************** |
| 16 | +#################### |
| 17 | +Lightning in 2 Steps |
| 18 | +#################### |
22 | 19 |
|
23 |
| -PyTorch Lightning provides you with the APIs required to build models, datasets, and so on. PyTorch has all you need to train your models; however, there’s much more to deep learning than attaching layers. When it comes to the actual training, there’s a lot of boilerplate code that you need to write, and if you need to scale your training/inferencing on multiple devices/machines, there’s another set of integrations you might need to do. |
| 20 | +**In this guide we'll show you how to organize your PyTorch code into Lightning in 2 steps.** |
24 | 21 |
|
25 |
| -PyTorch Lightning solves these for you. All you need is to restructure some of your existing code, set certain flags, and then you are done. |
26 |
| -Now you can train your models on different accelerators like GPU/TPU/IPU, to do distributed training across multiple machines/nodes without code changes using state-of-the-art distributed training mechanisms. |
| 22 | +Organizing your code with PyTorch Lightning makes your code: |
27 | 23 |
|
28 |
| -Code organization is the core of Lightning. It leaves the research logic to you and automates the rest. |
29 |
| - |
30 |
| ----------- |
31 |
| - |
32 |
| -******************** |
33 |
| -Lightning Philosophy |
34 |
| -******************** |
35 |
| - |
36 |
| -Organizing your code with Lightning makes your code: |
37 |
| - |
38 |
| -* Flexible (this is all pure PyTorch), but removes a ton of boilerplate |
| 24 | +* Keep all the flexibility (this is all pure PyTorch), but removes a ton of boilerplate |
39 | 25 | * More readable by decoupling the research code from the engineering
|
40 | 26 | * Easier to reproduce
|
41 | 27 | * Less error-prone by automating most of the training loop and tricky engineering
|
42 | 28 | * Scalable to any hardware without changing your model
|
43 | 29 |
|
44 |
| -Lightning is built for: |
45 |
| - |
46 |
| -* Researchers who want to focus on research without worrying about the engineering aspects of it |
47 |
| -* ML Engineers who want to build reproducible pipelines |
48 |
| -* Data Scientists who want to try out different models for their tasks and build-in ML techniques |
49 |
| -* Educators who seek to study and teach Deep Learning with PyTorch |
50 |
| - |
51 |
| -The team makes sure that all the latest techniques are already integrated and well maintained. |
52 |
| - |
53 | 30 |
|
54 | 31 | ----------
|
55 | 32 |
|
| 33 | +Here's a 3 minute conversion guide for PyTorch projects: |
56 | 34 |
|
57 |
| -***************** |
58 |
| -Starter Templates |
59 |
| -***************** |
| 35 | +.. raw:: html |
60 | 36 |
|
61 |
| -Before installing anything, use the following templates to try it out live: |
| 37 | + <video width="100%" max-width="800px" controls autoplay muted playsinline |
| 38 | + src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/pl_docs/pl_docs_animation_final.m4v"></video> |
62 | 39 |
|
63 |
| -.. list-table:: |
64 |
| - :widths: 18 15 25 |
65 |
| - :header-rows: 1 |
| 40 | +---------- |
66 | 41 |
|
67 |
| - * - Use case |
68 |
| - - Description |
69 |
| - - link |
70 |
| - * - Scratch model |
71 |
| - - To prototype quickly / debug with random data |
72 |
| - - |
73 |
| - .. raw:: html |
| 42 | +********************************* |
| 43 | +Step 0: Install PyTorch Lightning |
| 44 | +********************************* |
74 | 45 |
|
75 |
| - <div style='width:150px;height:auto'> |
76 |
| - <a href="https://colab.research.google.com/drive/1rHBxrtopwtF8iLpmC_e7yl3TeDGrseJL?usp=sharing>"> |
77 |
| - <img alt="open in colab" src="http://bit.ly/pl_colab"> |
78 |
| - </a> |
79 |
| - </div> |
80 |
| - * - Scratch model with manual optimization |
81 |
| - - To prototype quickly / debug with random data |
82 |
| - - |
83 |
| - .. raw:: html |
84 | 46 |
|
85 |
| - <div style='width:150px;height:auto'> |
86 |
| - <a href="https://colab.research.google.com/drive/1nGtvBFirIvtNQdppe2xBes6aJnZMjvl8?usp=sharing"> |
87 |
| - <img alt="open in colab" src="http://bit.ly/pl_colab"> |
88 |
| - </a> |
89 |
| - </div> |
| 47 | +You can install using `pip <https://pypi.org/project/pytorch-lightning/>`_ |
90 | 48 |
|
| 49 | +.. code-block:: bash |
91 | 50 |
|
92 |
| ----------- |
| 51 | + pip install pytorch-lightning |
93 | 52 |
|
94 |
| -************ |
95 |
| -Installation |
96 |
| -************ |
| 53 | +Or with `conda <https://anaconda.org/conda-forge/pytorch-lightning>`_ (see how to install conda `here <https://docs.conda.io/projects/conda/en/latest/user-guide/install/>`_): |
97 | 54 |
|
98 |
| -Follow the :ref:`Installation Guide <installation>` to install PyTorch Lightning. |
| 55 | +.. code-block:: bash |
99 | 56 |
|
100 |
| ----------- |
| 57 | + conda install pytorch-lightning -c conda-forge |
101 | 58 |
|
102 |
| -******************** |
103 |
| -Lightning Components |
104 |
| -******************** |
| 59 | +You could also use conda environments |
105 | 60 |
|
106 |
| -Here's a 3-minute conversion guide for PyTorch projects: |
| 61 | +.. code-block:: bash |
107 | 62 |
|
108 |
| -.. raw:: html |
| 63 | + conda activate my_env |
| 64 | + pip install pytorch-lightning |
109 | 65 |
|
110 |
| - <video width="100%" max-width="800px" controls autoplay muted playsinline |
111 |
| - src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/pl_docs/pl_docs_animation_final.m4v"></video> |
| 66 | +---------- |
112 | 67 |
|
113 | 68 | Import the following:
|
114 | 69 |
|
@@ -641,6 +596,44 @@ Read our :doc:`Guide <../starter/core_guide>` to learn more with a step-by-step
|
641 | 596 | -------------
|
642 | 597 |
|
643 | 598 |
|
| 599 | +***************** |
| 600 | +Starter Templates |
| 601 | +***************** |
| 602 | + |
| 603 | +Before installing anything, use the following templates to try it out live: |
| 604 | + |
| 605 | +.. list-table:: |
| 606 | + :widths: 18 15 25 |
| 607 | + :header-rows: 1 |
| 608 | + |
| 609 | + * - Use case |
| 610 | + - Description |
| 611 | + - link |
| 612 | + * - Scratch model |
| 613 | + - To prototype quickly / debug with random data |
| 614 | + - |
| 615 | + .. raw:: html |
| 616 | + |
| 617 | + <div style='width:150px;height:auto'> |
| 618 | + <a href="https://colab.research.google.com/drive/1rHBxrtopwtF8iLpmC_e7yl3TeDGrseJL?usp=sharing>"> |
| 619 | + <img alt="open in colab" src="http://bit.ly/pl_colab"> |
| 620 | + </a> |
| 621 | + </div> |
| 622 | + * - Scratch model with manual optimization |
| 623 | + - To prototype quickly / debug with random data |
| 624 | + - |
| 625 | + .. raw:: html |
| 626 | + |
| 627 | + <div style='width:150px;height:auto'> |
| 628 | + <a href="https://colab.research.google.com/drive/1nGtvBFirIvtNQdppe2xBes6aJnZMjvl8?usp=sharing"> |
| 629 | + <img alt="open in colab" src="http://bit.ly/pl_colab"> |
| 630 | + </a> |
| 631 | + </div> |
| 632 | + |
| 633 | + |
| 634 | +------------ |
| 635 | + |
| 636 | + |
644 | 637 | *******
|
645 | 638 | Grid AI
|
646 | 639 | *******
|
|
0 commit comments