Merge pull request #20348 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot 2022-09-01 10:59:49 -04:00 коммит произвёл GitHub
Родитель f5b6ea7b58 ec93affcd4
Коммит 5c4eb8e6e7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 131 добавлений и 6 удалений

Двоичные данные
assets/images/help/codespaces/jupyter-notebook-step3.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 232 KiB

Двоичные данные
assets/images/help/codespaces/jupyter-python-kernel-dropdown.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 80 KiB

Двоичные данные
assets/images/help/codespaces/jupyter-python-kernel-link.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 178 KiB

Двоичные данные
assets/images/help/codespaces/jupyter-run-all.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 23 KiB

Двоичные данные
assets/images/help/codespaces/open-codespace-in-jupyter.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 188 KiB

Просмотреть файл

@ -0,0 +1,120 @@
---
title: Getting started with GitHub Codespaces for machine learning
shortTitle: Machine learning
intro: 'Learn about working on machine learning projects with {% data variables.product.prodname_github_codespaces %} and its out-of-the-box tools.'
product: '{% data reusables.gated-features.codespaces %}'
versions:
fpt: '*'
ghec: '*'
type: tutorial
topics:
- Codespaces
- Developer
---
## Introduction
This guide introduces you to machine learning with {% data variables.product.prodname_github_codespaces %}. Youll build a simple image classifier, learn about some of the tools that come preinstalled in {% data variables.product.prodname_github_codespaces %}, configure your development environment for NVIDIA CUDA, and use {% data variables.product.prodname_cli %} to open your codespace in JupyterLab.
## Prerequisite
You have access to {% data variables.product.prodname_github_codespaces %}. For more information, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#access-to-github-codespaces)."
## Build a simple image classifier
We'll use a Jupyter notebook to build a simple image classifier.
Jupyter notebooks are sets of cells that you can execute one after another. The notebook we'll use includes a number of cells that build an image classifier using [PyTorch](https://pytorch.org/). Each cell is a different phase of that process: download a dataset, set up a neural network, train a model, and then test that model.
We'll run all of the cells, in sequence, to perform all phases of building the image classifier. When we do this Jupyter saves the output back into the notebook so that you can examine the results.
### Creating a repository and a codespace
1. Go to the [github/codespaces-getting-started-ml](https://github.com/github/codespaces-getting-started-ml) template repository and click **Use this template**.
{% data reusables.codespaces.open-codespace-from-template-repo %}
By default, a codespace for this repository opens in a web-based version of {% data variables.product.prodname_vscode %}.
### Open the image classifier notebook
The default container image that's used by {% data variables.product.prodname_github_codespaces %} includes a set of machine learning libraries that are preinstalled in your codespace. For example, Numpy, pandas, SciPy, Matplotlib, seaborn, scikit-learn, TensorFlow, Keras, PyTorch, Requests, and Plotly. For more information about the default image, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#using-the-default-dev-container-configuration)" and [the `devcontainers/images` repository](https://github.com/devcontainers/images/tree/main/src/codespaces#github-codespaces-default-linux-universal).
1. In the {% data variables.product.prodname_vscode_shortname %} editor, close any "Get Started" tabs that are displayed.
1. Open the `image-classifier.ipynb` notebook file.
1. Click the Python kernel link at the top right of the editor.
![Screenshot of the Python kernal link](/assets/images/help/codespaces/jupyter-python-kernel-link.png)
1. In the drop-down menu, choose the kernel in the directory `/opt/python/latest/bin/python`.
![Screenshot of the Python kernal drop-down menu](/assets/images/help/codespaces/jupyter-python-kernel-dropdown.png)
### Build the image classifier
The image classifier notebook contains all the code you need to download a dataset, train a neural network, and evaluate its performance.
1. Click **Run All** to execute all of the notebooks cells.
![Screenshot of the Run All button](/assets/images/help/codespaces/jupyter-run-all.png)
1. Scroll down to view the output of each cell.
![Screenshot of Step 3 in the editor](/assets/images/help/codespaces/jupyter-notebook-step3.png)
## Configure NVIDIA CUDA for your codespace
Some software, such as TensorFlow, requires you to install NVIDIA CUDA to use your codespaces GPU. Where this is the case, you can create your own custom configuration, by using a `devcontainer.json` file, and specify that CUDA should be installed. For more information on creating a custom configuration, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#creating-a-custom-dev-container-configuration)."
{% note %}
**Note**: For full details of the script that's run when you add the `nvidia-cuda` feature, see [the devcontainers/features repository](https://github.com/devcontainers/features/tree/main/src/nvidia-cuda).
{% endnote %}
1. Within a codespace, open the `.devcontainer/devcontainer.json` file in the editor.
1. Add a top-level `features` object with the following contents:
```json{:copy}
“features”: {
"ghcr.io/devcontainers/features/nvidia-cuda:1": {
"installCudnn": true
}
}
```
For more information about the `features` object, see the [development containers specification](https://containers.dev/implementors/features/#devcontainer-json-properties).
If you are using the `devcontainer.json` file from the image classifier repository you created for this tutorial, your `devcontainer.json` file will now look like this:
```
{
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter"
]
}
},
“features”: {
"ghcr.io/devcontainers/features/nvidia-cuda:1": {
"installCudnn": true
}
}
}
```
1. Save the change.
{% data reusables.codespaces.rebuild-command %}
The codespace container will be rebuilt. This will take several minutes. When the rebuild is complete the codespace is automatically reopened.
1. Commit the change to the repository so that CUDA will be installed in any new codespaces you create from this repository in future.
## Open your codespace in JupyterLab
The default container image that's used by {% data variables.product.prodname_github_codespaces %} includes JupyterLab, the web-based Jupyter IDE. You can use {% data variables.product.prodname_cli %} to open your codespace in JupyterLab without having to install anything else on your codespace.
1. In the terminal, enter the {% data variables.product.prodname_cli %} command `gh cs jupyter`.
1. Choose the codespace you want to open.
![Screenshot of opening a codespace from the terminal](/assets/images/help/codespaces/open-codespace-in-jupyter.png)

Просмотреть файл

@ -18,6 +18,7 @@ children:
- /forwarding-ports-in-your-codespace
- /default-environment-variables-for-your-codespace
- /connecting-to-a-private-network
- /getting-started-with-github-codespaces-for-machine-learning
- /using-github-codespaces-in-visual-studio-code
- /using-github-codespaces-with-github-cli
---

Просмотреть файл

@ -25,12 +25,7 @@ For more information on exactly how {% data variables.product.prodname_github_co
## Creating your codespace
1. Navigate to the [template repository](https://github.com/github/haikus-for-codespaces) and select **Use this template**.
1. Choose an owner for the new repository, enter a repository name, select your preferred privacy setting, and click **Create repository from template**.
1. Navigate to the main page of the newly created repository. Under the repository name, use the **{% octicon "code" aria-label="The code icon" %} Code** drop-down menu, and in the **Codespaces** tab, click **Create codespace on main**.
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
{% data reusables.codespaces.open-codespace-from-template-repo %}
## Running the application

Просмотреть файл

@ -0,0 +1,8 @@
1. Select an owner for the new repository, enter a repository name, select your preferred privacy setting, and click **Create repository from template**.
1. On the main page of the newly created repository, click the **{% octicon "code" aria-label="The code icon" %} Code** button and select the **Codespaces** tab.
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
If you dont see this tab, {% data variables.product.prodname_github_codespaces %} isn't available for you. For more information about access to {% data variables.product.prodname_github_codespaces %}, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#access-to-github-codespaces)."
1. On the **Codespaces** tab, click **Create codespace on main**.

Просмотреть файл

@ -66,6 +66,7 @@ const PUBLIC_REPOS = new Set([
'super-linter',
'tweetsodium',
'VisualStudio',
'codespaces-getting-started-ml',
])
const ALLOW_DOCS_PATHS = [