Skip to content

Working with Amazon SageMaker#

To track runs and log metadata to Neptune, take the following steps in your Amazon SageMaker environment:

  1. In the left pane, under Notebook, select Lifecycle configurations.
  2. Click Create configuration.
  3. Enter a name for your lifecycle configuration (you'll need it in step 7).
  4. Modify the Create notebook script to run it once at the creation of your SageMaker Notebook instance.
  5. Copy-paste the following to the Create notebook script:

    Note

    In the PARAMETERS section, specify in which environments you want to install the Neptune client library (neptune-client).

    #!/bin/bash
    
    set -e
    
    sudo -u ec2-user -i <<'EOF'
    
    # PARAMETERS
    ENVS=(
    python3
    pytorch_p36
    )
    
    # Install Neptune client library
    for env in $ENVS; do
        source /home/ec2-user/anaconda3/bin/activate $env
        pip install neptune-client
        source /home/ec2-user/anaconda3/bin/deactivate
    done
    
    # Install Jupyter extension
    source /home/ec2-user/anaconda3/bin/activate JupyterSystemEnv
    pip install neptune-notebooks
    jupyter nbextension enable --py neptune-notebooks --sys-prefix
    jupyter labextension install neptune-notebooks
    source /home/ec2-user/anaconda3/bin/deactivate
    EOF
    
  6. In the left pane, select Notebook instances and click Create notebook instance.

  7. Type in an instance name and click Additional configuration to add the lifecycle configuration you just created.
  8. To start your instance, click Create notebook instance.

Success

If everything was set up correctly, the status of your Amazon SageMaker instance should be "InService".

You can open a Jupyter Notebook or JupyterLab with Neptune notebook versioning enabled.