-
Notifications
You must be signed in to change notification settings - Fork 537
Skypilot: Lambda Edition #2526
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
Merged
Merged
Skypilot: Lambda Edition #2526
Changes from 29 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
6d7cab2
add runpod
safoinme 70d1f29
Update Skypilot RunPod orchestrator
safoinme 40547e9
Auto-update of Starter template
actions-user f869e91
Add Skypilot OCI and Skypilot Lambda integrations
safoinme ef7cadc
Update Skypilot integrations to use newer versions
safoinme 66a532f
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
safoinme 37eddaa
Add SkypilotRunPodIntegration and SkypilotLambdaIntegration to integr…
safoinme 63e4558
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
safoinme 6fd192d
Update Skypilot integration requirements
safoinme 039ca12
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
safoinme 05fb8be
Update Docker commands to use sudo
safoinme 90ceaf6
Auto-update of LLM Finetuning template
actions-user 6421c6d
Fix package name extraction in Integration class
safoinme d50d7e6
Merge branch 'feature/OSSK-470-add-more-skypilot-options' of github.c…
safoinme 438231f
Add debug logs for docker run command
safoinme cb933ae
Update Skypilot VM orchestrator and integration
safoinme a3f1567
Refactor integration.py and sql_zen_store.py
safoinme e8256b3
Add GPU support for ZenML pipelines runs
safoinme ced9602
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
safoinme 24e83bb
Fix debug log message formatting in Integration class
safoinme 1aaa003
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
safoinme 9ad1b0b
Merge branch 'feature/OSSK-470-add-more-skypilot-options' of github.c…
safoinme aa1244b
Fix IndexError in integration.py
safoinme ca1b918
Fix dependency resolution issue in Integration class
safoinme bd43a92
fix docstring
safoinme 1ae6189
Fix fileio import in SkypilotLambdaOrchestrator.py
safoinme e37cc96
Fix formatting in SkypilotLambdaOrchestratorSettings docstring
safoinme da576f7
Update Lambda Labs orchestrator documentation and logo
safoinme c93d2d9
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
strickvl ff0f22c
Apply suggestions from code review
safoinme 281d809
Apply suggestions from code review
safoinme daaa498
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
safoinme 35bbca1
Update docs/book/stacks-and-components/component-guide/orchestrators/…
safoinme 99c7dc4
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
safoinme 3e6bfb1
Update Skypilot integration requirements to version 0.5.0
safoinme 2e5ec43
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
strickvl aba1fc1
Merge branch 'develop' into feature/OSSK-470-add-more-skypilot-options
strickvl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -50,6 +50,14 @@ Read more about how to configure step-specific resources [here](#configuring-ste | |||||
The SkyPilot VM Orchestrator does not currently support the ability to [schedule pipelines runs](/docs/book/user-guide/advanced-guide/pipelining-features/schedule-pipeline-runs.md) | ||||||
{% endhint %} | ||||||
|
||||||
{% hint style="info" %} | ||||||
All ZenML pipelines runs are executed using docker containers within the VMs provisioned by the orchestrator. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
For that reason, you may need to configure you pipeline settings with `docker_run_args=["--gpus=all"]` | ||||||
safoinme marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
to enable GPU support in the docker container. | ||||||
safoinme marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
{% endhint %} | ||||||
|
||||||
{% hint style="info" %} | ||||||
|
||||||
|
||||||
## How to deploy it | ||||||
|
||||||
|
@@ -240,6 +248,36 @@ zenml orchestrator connect <ORCHESTRATOR_NAME> --connector azure-skypilot-vm | |||||
zenml stack register <STACK_NAME> -o <ORCHESTRATOR_NAME> ... --set | ||||||
``` | ||||||
{% endtab %} | ||||||
|
||||||
{% tab title="Lambda Labs" %} | ||||||
|
||||||
Lambda Labs is a cloud provider that offers GPU instances for machine learning workloads. Unlike the major cloud providers, with Lambda Labs we don't need to configure a service connector to authenticate with the cloud provider. Instead, we can directly use API keys to authenticate with the Lambda Labs API. | ||||||
safoinme marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
```shell | ||||||
zenml integration install skypilot_lambda | ||||||
``` | ||||||
|
||||||
Once the integration is installed, we can register the orchestrator with the following command: | ||||||
|
||||||
```shell | ||||||
# For more secure and recommended way, we will register the API key as a secret | ||||||
zenml secret create lambda_api_key --scope user --api_key=<VALUE_1> | ||||||
# Register the orchestrator | ||||||
zenml orchestrator register <ORCHESTRATOR_NAME> --flavor vm_lambda --api_key={{lambda_api_key.api_key}} | ||||||
# Register and activate a stack with the new orchestrator | ||||||
zenml stack register <STACK_NAME> -o <ORCHESTRATOR_NAME> ... --set | ||||||
``` | ||||||
|
||||||
{% hint style="info" %} | ||||||
The lambda labs orchrestrator does not support some of the features like `spot_recovery`, `disk_tier`, `image_id`, `zone`, `idle_minutes_to_autostop`, `disk_size`, `use_spot`. It is recommended to not use these features with the lambda labs orchestrator and also not to use [step-specific settings](#configuring-step-specific-resources). | ||||||
safoinme marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
{% endhint %} | ||||||
|
||||||
{% hint style="warning" %} | ||||||
While testing the orchestrator, we have noticed that the Lambda Labs orchestrator does not support the `down` flag. This means that the orchestrator will not automatically tear down the cluster after all jobs finish. We recommend manually tearing down the cluster after all jobs finish to avoid unnecessary costs. | ||||||
safoinme marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
{% endhint %} | ||||||
|
||||||
{% endtab %} | ||||||
|
||||||
{% endtabs %} | ||||||
|
||||||
#### Additional Configuration | ||||||
|
@@ -263,6 +301,7 @@ For additional configuration of the Skypilot orchestrator, you can pass `Setting | |||||
* `idle_minutes_to_autostop`: Automatically stop the cluster after this many minutes of idleness, i.e., no running or pending jobs in the cluster's job queue. Idleness gets reset whenever setting-up/running/pending jobs are found in the job queue. Setting this flag is equivalent to running `sky.launch(..., detach_run=True, ...)` and then `sky.autostop(idle_minutes=<minutes>)`. If not set, the cluster will not be autostopped. | ||||||
* `down`: Tear down the cluster after all jobs finish (successfully or abnormally). If `idle_minutes_to_autostop` is also set, the cluster will be torn down after the specified idle time. Note that if errors occur during provisioning/data syncing/setting up, the cluster will not be torn down for debugging purposes. | ||||||
* `stream_logs`: If True, show the logs in the terminal as they are generated while the cluster is running. | ||||||
* `docker_run_args`: Additional arguments to pass to the `docker run` command. For example, `['--gpus=all']` to use all GPUs available on the VM. | ||||||
|
||||||
The following code snippets show how to configure the orchestrator settings for each cloud provider: | ||||||
|
||||||
|
@@ -291,6 +330,7 @@ skypilot_settings = SkypilotAWSOrchestratorSettings( | |||||
idle_minutes_to_autostop=60, | ||||||
down=True, | ||||||
stream_logs=True | ||||||
docker_run_args=["--gpus=all"] | ||||||
) | ||||||
|
||||||
|
||||||
|
@@ -374,6 +414,34 @@ skypilot_settings = SkypilotAzureOrchestratorSettings( | |||||
) | ||||||
``` | ||||||
|
||||||
{% endtab %} | ||||||
|
||||||
{% tab title="Lambda" %} | ||||||
|
||||||
**Code Example:** | ||||||
|
||||||
```python | ||||||
from zenml.integrations.skypilot_lambda.flavors.skypilot_orchestrator_lambda_vm_flavor import SkypilotLambdaOrchestratorSettings | ||||||
safoinme marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
|
||||||
skypilot_settings = SkypilotLambdaOrchestratorSettings( | ||||||
instance_type="gpu_1x_h100_pcie", | ||||||
cluster_name="my_cluster", | ||||||
retry_until_up=True, | ||||||
idle_minutes_to_autostop=60, | ||||||
down=True, | ||||||
stream_logs=True, | ||||||
docker_run_args=["--gpus=all"] | ||||||
) | ||||||
|
||||||
|
||||||
@pipeline( | ||||||
settings={ | ||||||
"orchestrator.vm_lambda": skypilot_settings | ||||||
} | ||||||
) | ||||||
``` | ||||||
|
||||||
{% endtab %} | ||||||
{% endtabs %} | ||||||
|
||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (c) ZenML GmbH 2024. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at: | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
"""Initialization of the Skypilot Lambda integration for ZenML. | ||
|
||
The Skypilot integration sub-module powers an alternative to the local | ||
orchestrator for a remote orchestration of ZenML pipelines on VMs. | ||
""" | ||
from typing import List, Type | ||
|
||
from zenml.integrations.constants import ( | ||
SKYPILOT_LAMBDA, | ||
) | ||
from zenml.integrations.integration import Integration | ||
from zenml.stack import Flavor | ||
|
||
SKYPILOT_LAMBDA_ORCHESTRATOR_FLAVOR = "vm_lambda" | ||
|
||
|
||
class SkypilotLambdaIntegration(Integration): | ||
"""Definition of Skypilot Lambda Integration for ZenML.""" | ||
|
||
NAME = SKYPILOT_LAMBDA | ||
REQUIREMENTS = ["skypilot[lambda]"] | ||
bcdurak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@classmethod | ||
def flavors(cls) -> List[Type[Flavor]]: | ||
"""Declare the stack component flavors for the Skypilot Lambda integration. | ||
|
||
Returns: | ||
List of stack component flavors for this integration. | ||
""" | ||
from zenml.integrations.skypilot_lambda.flavors import ( | ||
SkypilotLambdaOrchestratorFlavor, | ||
) | ||
|
||
return [SkypilotLambdaOrchestratorFlavor] | ||
|
||
|
||
SkypilotLambdaIntegration.check_installation() |
26 changes: 26 additions & 0 deletions
26
src/zenml/integrations/skypilot_lambda/flavors/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) ZenML GmbH 2024. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at: | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
"""Skypilot integration flavor for Skypilot Lambda orchestrator.""" | ||
|
||
from zenml.integrations.skypilot_lambda.flavors.skypilot_orchestrator_lambda_vm_flavor import ( | ||
SkypilotLambdaOrchestratorConfig, | ||
SkypilotLambdaOrchestratorFlavor, | ||
SkypilotLambdaOrchestratorSettings, | ||
) | ||
|
||
__all__ = [ | ||
"SkypilotLambdaOrchestratorConfig", | ||
"SkypilotLambdaOrchestratorFlavor", | ||
"SkypilotLambdaOrchestratorSettings", | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.