Skip to main content

A command-line utility to provision infrastructure for ML workflows

Project description

Reproducible ML workflows for teams

dstack helps teams define ML workflow, run them in a configured cloud, and collaborate around artifacts.
It takes care of provisioning compute resources, handling dependencies, and versioning data.

Slack

DocsQuickstartExamplesSlackTwitter

Last commit PyPI - License

Features

  • Define your ML workflows declaratively (incl. their dependencies, environment, artifacts, and compute resources).
  • Run workflows via the CLI. Have compute resources provisioned in your cloud (using your local credentials).
  • Save data, models, and environments as artifacts and reuse them across workflows and teams.

You can use the dstack CLI from both your IDE and your CI/CD pipelines.

For debugging purposes, you can spin dev environments (VS Code and JupyterLab), and also run workflow locally if needed.

How does it work?

  1. Install dstack CLI locally
  2. Configure the cloud credentials locally (e.g. via ~/.aws/credentials)
  3. Define ML workflows in .dstack/workflows.yaml (within your existing Git repository)
  4. Run ML workflows via the dstack run CLI command
  5. Use other dstack CLI commands to manage runs, artifacts, etc.

When you run a workflow via the dstack CLI, it provisions the required compute resources (in a configured cloud account), sets up environment (such as Python, Conda, CUDA, etc), fetches your code, downloads deps, saves artifacts, and tears down compute resources.

Demo

Installation

Use pip to install dstack locally:

pip install dstack

The dstack CLI needs your AWS account credentials to be configured locally (e.g. in ~/.aws/credentials or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables).

Before you can use the dstack CLI, you need to configure it:

dstack config

It will prompt you to select an AWS region where dstack will provision compute resources, and an S3 bucket, where dstack will store state and output artifacts.

AWS profile: default
AWS region: eu-west-1
S3 bucket: dstack-142421590066-eu-west-1
EC2 subnet: none

Usage example

Step 1: Create a .dstack/workflows.yaml file, and define there how to run the script, from where to load the data, how to store output artifacts, and what compute resources are needed to run it.

workflows: 
  - name: train
    provider: bash
    deps:
      - tag: mnist_data
    commands:
      - pip install requirements.txt
      - python src/train.py
    artifacts: 
      - path: ./checkpoint
    resources:
      interruptible: true
      gpu: 1

Use deps to add artifacts of other workflows as dependencies. You can refer to other workflows via the name of the workflow, or via the name of the tag.

Step 2: Run the workflow via dstack run:

dstack run train

It will automatically provision the required compute resource, and run the workflow. You'll see the output in real-time:

Provisioning... It may take up to a minute. ✓

To interrupt, press Ctrl+C.

Epoch 4: 100%|██████████████| 1876/1876 [00:17<00:00, 107.85it/s, loss=0.0944, v_num=0, val_loss=0.108, val_acc=0.968]

`Trainer.fit` stopped: `max_epochs=5` reached.

Testing DataLoader 0: 100%|██████████████| 313/313 [00:00<00:00, 589.34it/s]

Test metric   DataLoader 0
val_acc       0.965399980545044
val_loss      0.10975822806358337

Step 3: Use the dstack ps command to see the status of runs.

dstack ps -a

RUN               TARGET    SUBMITTED    OWNER           STATUS   TAG
angry-elephant-1  download  8 hours ago  peterschmidt85  Done     mnist_data
wet-insect-1      train     1 weeks ago  peterschmidt85  Running  

Step 4: Use other commands to manage runs, artifacts, tags, secrets, and more.

More information

Licence

Mozilla Public License 2.0

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 Distribution

dstack-0.0.13a1.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

dstack-0.0.13a1-py3-none-any.whl (6.7 MB view details)

Uploaded Python 3

File details

Details for the file dstack-0.0.13a1.tar.gz.

File metadata

  • Download URL: dstack-0.0.13a1.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for dstack-0.0.13a1.tar.gz
Algorithm Hash digest
SHA256 636fafa9733a2d183adae2626f6633844af829e63b503cd8fd9ba62d499cee3a
MD5 383d8439efed563fb6dc5b060c7a1e9a
BLAKE2b-256 796da9f1573706cdc18232681b6dfa1164726629c49b8874a5ea7b9cd5bb2dec

See more details on using hashes here.

File details

Details for the file dstack-0.0.13a1-py3-none-any.whl.

File metadata

  • Download URL: dstack-0.0.13a1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for dstack-0.0.13a1-py3-none-any.whl
Algorithm Hash digest
SHA256 cbd7e9fba51e2e0c43328c0b1a6a9e0f70c521b0677a03cc68aafd381c674aff
MD5 95b92e645f5776a67e6d250e40c2bd58
BLAKE2b-256 a14b8945124c99c2e922009a6692cfd3f500f473d9b3c14cd257b2b55d501df3

See more details on using hashes here.

Supported by

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