From 2bbf5937af2b811b19467727c739b96f6525d825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20R=C3=A4dle?= Date: Sun, 11 Dec 2022 17:43:21 -0800 Subject: [PATCH] Install PyTorch Tutorial Basic tutorial for how to install the Python PyTorch dependency --- .../docs/tutorials/models/install-pytorch.mdx | 76 +++++++++++++++++++ website/fb/sdoc-cache.json | 4 + website/sidebars.js | 10 ++- 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 website/docs/tutorials/models/install-pytorch.mdx create mode 100644 website/fb/sdoc-cache.json diff --git a/website/docs/tutorials/models/install-pytorch.mdx b/website/docs/tutorials/models/install-pytorch.mdx new file mode 100644 index 000000000..b5d94937d --- /dev/null +++ b/website/docs/tutorials/models/install-pytorch.mdx @@ -0,0 +1,76 @@ +--- +id: install-pytorch +sidebar_position: 1 +title: Install PyTorch +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +In this tutorial, we will learn a quick way for how to set up PyTorch. + +# [OPTIONAL] Set up Python virtual environment + +It is recommended to run the Python scripts in a virtual environment. Python offers a command to create a virtual environment with the following command. + +```shell +python3 -m venv venv +source venv/bin/activate +``` + +# Install `torch` dependency + +Last, let's install the PyTorch dependencies via the Python package manager. + + + + + ```shell + pip install torch==1.12.1 + ``` + + + + + ```shell + pip install torch==1.12.1+cpu + ``` + + + + + ```shell + pip install torch==1.12.1+cpu + ``` + + + + +# Test Installation + +Open Python interpreter in terminal + +```python +python +``` + +Then execute the two lines of code, which will print the PyTorch version + +```python +import torch +print(torch.__version__) +``` + +```python title="Output" +1.12.1 +``` + +Exit the Python interpreter with `exit()`. + +That's it! PyTorch is installed successfully \ No newline at end of file diff --git a/website/fb/sdoc-cache.json b/website/fb/sdoc-cache.json new file mode 100644 index 000000000..e172e37eb --- /dev/null +++ b/website/fb/sdoc-cache.json @@ -0,0 +1,4 @@ +{ + "snippets": {}, + "description": "@generated" +} \ No newline at end of file diff --git a/website/sidebars.js b/website/sidebars.js index 1f4e80c1d..a4fc98d79 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -35,7 +35,15 @@ module.exports = { }, { type: 'category', - label: 'Tutorials', + label: 'Model Tutorials', + collapsed: false, + items: [ + 'tutorials/models/install-pytorch', + ], + }, + { + type: 'category', + label: 'Demo Tutorials', collapsed: false, items: [ 'tutorials/snacks/image-classification',