Skip to content

Commit d94d40b

Browse files
Update README
1 parent c346690 commit d94d40b

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ If you want to add a new use case or a feature, see [CONTRIBUTING](CONTRIBUTING.
7272
### Step 1: Install the library
7373
Before starting the whole procedure, check that both `pip` and `python` commands point to Python version 3.7 or higher with `python --version` command.
7474

75+
> **Important:** Make sure you read the "Getting started" section and didn't skip the steps from [Setting up your AWS account with IAM and SSM configuration](IAM_SSM_Setup.md).
76+
7577
Install the latest stable version of library from the [PyPI repository](https://pypi.org/project/sagemaker-ssh-helper/):
7678

7779
```shell
@@ -287,6 +289,15 @@ sagemaker_ssh_helper.setup_and_start_ssh()
287289
*Note:* adding `lib` dir to Python path is required, because SageMaker inference is putting dependencies
288290
into the `code/lib` directory, while SageMaker training put libs directly to `code`.
289291

292+
On the following screenshot you see the sample code for the inference code running in SageMaker endpoint on AWS Inferentia chip.
293+
The user has connected to the endpoint with the `sm-ssh connect` command and executed the `neuron-ls` [command](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/tools/neuron-sys-tools/neuron-ls.html):
294+
295+
![](images/sm_ssh_inf2.png)
296+
297+
You can find this sample code in the notebook [Deploy SD2.1 to Inferentia2 + SageMaker + HF Optimum Neuron + SageMaker SSH Helper](https://github.com/aws-samples/ml-specialized-hardware/blob/main/tutorials/04_ImageGenerationWithStableDiffusion/SDOnInf2AndHFOptimumNeuron_SMSSH.ipynb).
298+
299+
You can also notice on the screenshot that the user configured the remote Python interpreter that connects to SageMaker Studio, so the user also executes the notebook itself remotely inside SageMaker. This setup is further described in the section for [Local IDE Integration with SageMaker Studio](#studio).
300+
290301
### Multi-model endpoints
291302

292303
For multi-model endpoints, the setup procedure is slightly different from regular endpoints:
@@ -571,10 +582,16 @@ Make sure you've configured your ssh config as mentioned in the [~/.ssh/config](
571582

572583
A. Follow the [instructions in the PyCharm docs](https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-interpreter), to configure the remote interpreter in PyCharm.
573584

574-
In the field for host name, put the same value as for `fqdn` in the [`sm-ssh` command](#sm-ssh), e.g., `ssh-training-example-2023-07-25-03-18-04-490.training.sagemaker`, and use `root` as the username.
585+
In the field for host name, put the same value as for `fqdn` in the [`sm-ssh` command](#sm-ssh), e.g., `ssh-training-manual-2023-10-02-14-38-56-744.training.sagemaker`, and use `root` as the username.
575586

576587
![](images/pycharm_training.png)
577588

589+
When PyCharm asks for the SSH key, point to the `~/.ssh/<fqdn>` private key file that was automatically generated for you by SSH Helper:
590+
591+
![](images/pycharm_training_ssh.png)
592+
593+
*Note:* If PyCharm says connection refused, it can be due to timeout. Check that you can connect to this host from your system terminal with `ssh` and `sm-ssh` and try configuring the remote interpreter again.
594+
578595
*Tip:* When you configure Python interpreter in PyCharm, it's recommended to configure [the deployment path mapping](https://www.jetbrains.com/help/pycharm/creating-local-server-configuration.html#mapping) for you project to point into `/root/project_name` instead of default `/tmp/pycharm_project_123`. This is how you will be able to see your project in SageMaker Studio and PyCharm will automatically sync your local dir to the remote dir.
579596

580597
*Tip:* Also instead of creating a new venv, point the Python interpreter to the existing location.
@@ -724,6 +741,12 @@ sm-ssh list studio.sagemaker
724741

725742
3. Using the remote Jupyter Notebook
726743

744+
In recent versions of PyCharm, Jupyter Notebook is tunnelled automatically through remote interpreter connection. You might need to add `--allow-root` argument to the command line, when your remote interpreter runs under root:
745+
746+
![](images/remote_jupyter.png)
747+
748+
If you wish to connect to the existing notebook server started by SSH Helper or don't use PyCharm, proceed with the next configuration steps.
749+
727750
To make the remote Jupyter Server port `8889` forwarded to the local machine, use SSH:
728751

729752
```shell

images/pycharm_training.png

-716 Bytes
Loading

images/pycharm_training_ssh.png

98.9 KB
Loading

images/remote_jupyter.png

990 KB
Loading

images/sm_ssh_inf2.png

1.66 MB
Loading

0 commit comments

Comments
 (0)