SkyPilot: Seamless Integration with Paperspace

In this article we will explore SkyPilot, a widely used framework designed to optimize GPU availability and minimize costs when running LLMs and AI on various cloud platforms.

7 months ago   •   4 min read

By Shaoni Mukherjee

Sign up FREE

Build & scale AI models on low-cost cloud GPUs.

Get started Talk to an expert
Table of contents

Bring this project to life

We're thrilled to share that we have teamed up with the awesome engineers at Trainy to integrate Paperspace with SkyPilot, an innovative open-source framework tailored for running LLMs, AI tasks, and batch jobs across various cloud platforms. This partnership aims to revolutionize your development journey by offering enhanced efficiency and cost savings, especially when it comes to tasks like model training, fine-tuning, and deployment. With this collaboration, you can expect smoother workflows and improved resource management, empowering you to achieve your goals with greater ease and effectiveness.

What is SkyPilot?

SkyPilot simplifies cloud infrastructure management, users can easily launch tasks and clusters on any cloud platform.

  • With SkyPilot, scaling up is straightforward - just queue up the tasks, and SkyPilot takes care of managing them efficiently.
  • Accessing object storage like S3, GCS, or R2 is made simple.
  • SkyPilot ensures maximum GPU availability for your tasks.
  • SkyPilot helps reduce your cloud costs:

1. It utilizes Managed Spot instances, offering significant cost savings with auto-recovery features.

  1. The Optimizer feature automatically selects the most cost-effective resources for your tasks, potentially doubling your savings.
  2. Autostop ensures that idle clusters are automatically cleaned up, saving you from unnecessary expenses.
  • SkyPilot seamlessly supports your existing GPU, TPU, and CPU workloads without requiring any code changes.
  • SkyPilot currently works with a wide range of providers making it versatile and adaptable to your needs.

Getting Started

Bring this project to life

  1. Obtain your API key to configure Paperspace access, follow the steps to obtain the key:
  • Log in to Paperspace platform, click on your profile and select 'Team Settings', this step will take you to your workspace.
  • Next click the 'API Keys' tab and add a name to the 'Name' section and click on the 'Add' button.
  • This step will generate the API keys and store it, click 'Revoke' to remove the key.
  • Copy the key.
0:00
/0:24
  1. Install SkyPilot:
  • Use the command to install the SkyPilot Paperspace cloud.
pip install "skypilot-nightly[paperspace]"

Few additional packages:

pip3 install attrs==19.2.0 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
  1. Add your API key:
mkdir -p ~/.paperspace
echo "{\"apiKey\":\"your-key\"}" > ~/.paperspace/config.json
  1. Verify the setup:
  • Run the code below, which will check the added credentials.
sky check

Once your environment is configured, you can effortlessly create a cluster within minutes.

  1. Create a new directory and navigate to the folder:
mkdir hello-sky
cd hello-sky
  1. Create a yaml file using the below code:
touch hello_sky.yaml
vi hello_sky.yaml
  1. Paste the following configuration details:
resources:
  # Optional; if left out, automatically pick the cheapest cloud.
  cloud: paperspace
  # 1x NVIDIA V100 GPU
  accelerators: V100:1

# Working directory (optional) containing the project codebase.
# Its contents are synced to ~/sky_workdir/ on the cluster.
workdir: .

# Typical use: pip install -r requirements.txt
# Invoked under the workdir (i.e., can use its files).
setup: |
  echo "Running setup."

# Typical use: make use of resources, such as running training.
# Invoked under the workdir (i.e., can use its files).
run: |
  echo "Hello, SkyPilot!"
  conda env list


This specification outlines the components of a task:

  • Resources: Cloud resources necessary for task execution, such as accelerators and instance types.
  • Workdir: The directory containing project code, which will be synched to the instance(s).
  • Setup: Commands to be executed before running the task, performed within the work directory.
  • Run: Commands that execute the task itself, also performed within the work directory.

Each of these fields is optional.

  1. Use the below code to launch a cluster and run a task:
sky launch -c mycluster hello_sky.yaml

You should see the available instances, the details of the instance along with the estimated cost.

Once this is confirmed, the cluster will start spining up.

The "sky launch" command handles tasks such as:

  • It chooses the best cloud provider and virtual machine according to the specified resource constraints.
  • It sets up (or reuses) a cluster on that chosen cloud.
  • It synchs with the work directory.
  • It runs the setup commands.
  • Finally, it executes the main task.

To view the running clusters in a single table format, run the below code:

sky status

here is a list of all possible cluster states.

Conclusion

Congratulations! you have successfully launched the cluster using Paperspace platform.

SkyPilot has been able to simplify the process of running large language models (LLMs), artificial intelligence (AI), and batch jobs across various cloud platforms.

We will highly recommend to try SkyPilot using Paperspace and run LLMs.

Also, please go through the documentation to understand more and experimanet with different tasks.

Thanks!

Add speed and simplicity to your Machine Learning workflow today

Get startedTalk to an expert

References

Spread the word