Skip to main content

SDK to develop using Lightning AI Studios

Project description

Lightning SDK

Software Development Kit (SDK) for Lightning AI

Installation

The package can be installed using pip install lightning-sdk

Usage

To use the SDK, you need to export the environment variables LIGHTNING_USER_ID and LIGHTNING_API_KEY with the values found in your account settings -> Keys -> Programmatic Login.

If you want to use it from within a Studio, these variables are already available for you.

Example

from lightning_sdk import Machine, Studio

# or s =  Studio("my-studio", "my-teamspace", org="my-org", create_ok=True)
# or (inside a Studio) s = Studio()  # will infer name, teamspace and owner of the current studio automatically.
#    can also just pass some arguments: s = Studio("my-new-studio", create_ok=True)
s = Studio("my-studio", "my-teamspace", user="my-username", create_ok=True)

print("starting Studio...")
s.start()

# prints Machine.CPU-4
print(s.machine)

# or start directly on this machine with s.start(Machine.A10G)
print("switching Studio machine...")
s.switch_machine(Machine.A10G)

# prints Machine.A10G
print(s.machine)

# prints Status.Running
print(s.status)

print(s.run("nvidia-smi"))

# install plugins for jobs and multi-machine training
s.install_plugin("jobs")
s.install_plugin("multi-machine-training")

# run the resulting plugins to start 1 job and 1 multi-machine training
s.installed_plugins["jobs"].run("python my_dummy_file", name="my_first_job", machine=Machine.A10G)
s.installed_plugins["multi-machine-training"].run("python my_dummy_file", name="my_first_mmt", machine=Machine.T4, num_instances=42)

print("Stopping Studio")
s.stop()

# duplicates Studio, this will also duplicate the environment and all files in the Studio
duplicate = s.duplicate()

# delete original Studio, duplicated Studio is it's own entity and not related to original anymore
s.delete()

# stop and delete duplicated Studio
duplicate.stop()
duplicate.delete()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

lightning_sdk-0.2.23-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file lightning_sdk-0.2.23-py3-none-any.whl.

File metadata

  • Download URL: lightning_sdk-0.2.23-py3-none-any.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for lightning_sdk-0.2.23-py3-none-any.whl
Algorithm Hash digest
SHA256 5c60006e550e5ca01472cd325e9af754cd2a1800e5646dc468fc3ea1434d0f59
MD5 8a0b7cfc84d9fa9cfa48bac9e1f2e9ca
BLAKE2b-256 ac19c545e2b9b3d815852100f0dfe1c96959150faf38de5223c9362044d421f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page