How to write a PyTorch Lightning tutorial¶
Author: PL team
License: CC
Generated: 2024-07-23T19:52:57.122823
This is a template to show how to contribute a tutorial.
Give us a ⭐ on Github | Check out the documentation | Join us on Discord
Setup¶
This notebook requires some packages besides pytorch-lightning.
[1]:
! pip install --quiet "matplotlib"
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
Create a Markdown cell¶
# %% [markdown]
the content of single cell shall be connected with #
at each line, so for example: # Add some text that will be rendered as markdown text.
Create a code cell¶
# %%
[2]:
import torch
print(torch.__version__)
2.3.1+cu118
Add any Python codes¶
Easy integration with Python ecosystem libraries component.
For example create a simple plot with matplotlib
with an image:
From: https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html
[3]:
import matplotlib.pyplot as plt # noqa: E402
import numpy as np # noqa: E402
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(xlabel="time (s)", ylabel="voltage (mV)", title="About as simple as it gets, folks")
ax.grid()
fig.savefig("test.png")
# render image to the notebooks
plt.show()
Congratulations - Time to Join the Community!¶
Congratulations on completing this notebook tutorial! If you enjoyed this and would like to join the Lightning movement, you can do so in the following ways!
Star Lightning on GitHub¶
The easiest way to help our community is just by starring the GitHub repos! This helps raise awareness of the cool tools we’re building.
Join our Discord!¶
The best way to keep up to date on the latest advancements is to join our community! Make sure to introduce yourself and share your interests in #general
channel
Contributions !¶
The best way to contribute to our community is to become a code contributor! At any time you can go to Lightning or Bolt GitHub Issues page and filter for “good first issue”.
You can also contribute your own notebooks with useful examples !