Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PyTorch tutorials.

License

NotificationsYou must be signed in to change notification settings

pytorch/tutorials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

All the tutorials are now presented as sphinx style documentation at:

Asking a question

If you have a question about a tutorial, post inhttps://dev-discuss.pytorch.org/ rather than creating an issue in this repo. Your question will be answered much faster on the dev-discuss forum.

Submitting an issue

You can submit the following types of issues:

  • Feature request - request a new tutorial to be added. Please explain why this tutorial is needed and how it demonstrates PyTorch value.
  • Bug report - report a failure or outdated information in an existing tutorial. When submitting a bug report, please run:python3 -m torch.utils.collect_env to get information about your environment and add the output to the bug report.

Contributing

We use sphinx-gallery'snotebook styled examples to create the tutorials. Syntax is very simple. In essence, you write a slightly well formatted Python file and it shows up as an HTML page. In addition, a Jupyter notebook is autogenerated and available to run in Google Colab.

Here is how you can create a new tutorial (for a detailed description, seeCONTRIBUTING.md):

NOTE: Before submitting a new tutorial, readPyTorch Tutorial Submission Policy.

  1. Create a Python file. If you want it executed while inserted into documentation, save the file with the suffixtutorial so that the file name isyour_tutorial.py.
  2. Put it in one of thebeginner_source,intermediate_source,advanced_source directory based on the level of difficulty. If it is a recipe, add it torecipes_source. For tutorials demonstrating unstable prototype features, add to theprototype_source.
  3. For Tutorials (except if it is a prototype feature), include it in thetoctree directive and create acustomcarditem inindex.rst.
  4. For Tutorials (except if it is a prototype feature), create a thumbnail in theindex.rst file using a command like.. customcarditem:: beginner/your_tutorial.html. For Recipes, create a thumbnail in therecipes_index.rst

If you are starting off with a Jupyter notebook, you can usethis script to convert the notebook to Python file. After conversion and addition to the project, please make sure that section headings and other things are in logical order.

Building locally

The tutorial build is very large and requires a GPU. If your machine does not have a GPU device, you can preview your HTML build without actually downloading the data and running the tutorial code:

  1. Install required dependencies by running:pip install -r requirements.txt.

Typically, you would run either inconda orvirtualenv. If you want to usevirtualenv, in the root of the repo, run:virtualenv venv, thensource venv/bin/activate.

  • If you have a GPU-powered laptop, you can build usingmake docs. This will download the data, execute the tutorials and build the documentation todocs/ directory. This might take about 60-120 min for systems with GPUs. If you do not have a GPU installed on your system, then see next step.
  • You can skip the computationally intensive graph generation by runningmake html-noplot to build basic html documentation to_build/html. This way, you can quickly preview your tutorial.

Building a single tutorial

You can build a single tutorial by using theGALLERY_PATTERN environment variable. For example to run onlyneural_style_transfer_tutorial.py, run:

GALLERY_PATTERN="neural_style_transfer_tutorial.py" make html

or

GALLERY_PATTERN="neural_style_transfer_tutorial.py" sphinx-build . _build

TheGALLERY_PATTERN variable respects regular expressions.

Spell Check

You can run pyspelling to check for spelling errors in the tutorials. To check only Python files, run pyspelling -n python. To check only .rst files, use pyspelling -n reST. Currently, .rst spell checking is limited to the beginner/ directory. Contributions to enable spell checking in other directories are welcome!

pyspelling          # full check (~3 mins)pyspelling -n python  # Python files onlypyspelling -n reST    # reST files (only beginner/ dir currently included)

About contributing to PyTorch Documentation and Tutorials

  • You can find information about contributing to PyTorch documentation in thePyTorch RepoREADME.md file.
  • Additional information can be found inPyTorch CONTRIBUTING.md.

License

PyTorch Tutorials is BSD licensed, as found in the LICENSE file.

About

PyTorch tutorials.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp