Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

04_optional-aws-sagemaker-notebook #451

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rvaneijk
Copy link

AWS CloudFormation Template: Jupyter Notebook with LLMs-from-scratch Repo

This CloudFormation template creates a GPU-enabled Jupyter notebook in Amazon SageMaker with an execution role and the LLMs-from-scratch GitHub repository.

What it does:

  1. Creates an IAM role with the necessary permissions for the SageMaker notebook instance.
  2. Creates a KMS key and an alias for encrypting the notebook instance.
  3. Configures a notebook instance lifecycle configuration script that:
    • Installs a separate Miniconda installation in the user's home directory.
    • Creates a custom Python environment with TensorFlow 2.15.0 and PyTorch 2.1.0, both with CUDA support.
    • Installs additional packages like Jupyter Lab, Matplotlib, and other useful libraries.
    • Registers the custom environment as a Jupyter kernel.
  4. Creates the SageMaker notebook instance with the specified configuration, including the GPU-enabled instance type, the execution role, and the default code repository.

How to use:

  1. Download the CloudFormation template file (cloudformation-template.yml).
  2. In the AWS Management Console, navigate to the CloudFormation service.
  3. Create a new stack and upload the template file.
  4. Provide a name for the notebook instance (e.g., "LLMsFromScratchNotebook") (defaults to the LLMs-from-scratch GitHub repo).
  5. Review and accept the template's parameters, then create the stack.
  6. Once the stack creation is complete, the SageMaker notebook instance will be available in the SageMaker console.
  7. Open the notebook instance and start using the pre-configured environment to work on your LLMs-from-scratch projects.

Key Points:

  • The template creates a GPU-enabled (ml.g4dn.xlarge) notebook instance with 50GB of storage.
  • It sets up a custom Miniconda environment with TensorFlow 2.15.0 and PyTorch 2.1.0, both with CUDA support.
  • The custom environment is registered as a Jupyter kernel, making it available for use in the notebook.
  • The template also creates a KMS key for encrypting the notebook instance and an IAM role with the necessary permissions.

@rasbt
Copy link
Owner

rasbt commented Nov 28, 2024

Hi there and thank for the PR. I am currently away from a computer for the next few days, but I can try and think about how to best incorporate the PR when I am back. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants