Introduction
Deepspeed is a highly scalable framework from Microsoft for distributed training and model serving. The Metaflow @deepspeed decorator helps you run these workflows inside of Metaflow tasks.
Features
- Automatic SSH configuration: Multi-node Deepspeed jobs are built around OpenMPI or Horovod. Like Metaflow's
@mpidecorator, the@deepspeeddecorator automatically configures SSH requirements between nodes, so you can focus on research code. - Seamless Python interface: Metaflow's
@deepspeedexposes a methodcurrent.deepspeed.runto make it easy to run Deepspeed commands on your transient MPI cluster, in the same way you'd launch Deepspeed from the terminal independent of Metaflow. A major design goal is to get the orchestration and other benefits of Metaflow, without requiring modification to research code.
Installation
Install this experimental module:
pip install metaflow-deepspeed
Getting Started
After installing the module, you can import the deepspeed decorator and use it in your Metaflow steps.
This exposes the current.deepspeed.run method, which you can map your terminal commands for running Deepspeed.
from metaflow import FlowSpec, step, deepspeed, current, batch, environment
class HelloDeepspeed(FlowSpec):
@step
def start(self):
self.next(self.train, num_parallel=2)
@environment(vars={"NCCL_SOCKET_IFNAME": "eth0"})
@batch(gpu=8, cpu=64, memory=256000)
@deepspeed
@step
def train(self):
current.deepspeed.run(
entrypoint="my_torch_dist_script.py"
)
self.next(self.join)
@step
def join(self, inputs):
self.next(self.end)
@step
def end(self):
pass
if __name__ == "__main__":
HelloDeepspeed()
Examples
| Directory | MPI program description |
|---|---|
| CPU Check | The easiest way to check your Deepspeed infrastructure on CPUs. |
| Hello Deepspeed | The easiest way to check your Deepspeed infrastructure on GPUs. |
| BERT | Train your BERT model using Deepspeed! |
| Dolly | A multi-node implementation of Databricks' Dolly. |
Cloud-specific use cases
| Directory | MPI program description |
|---|---|
| Automatically upload a directory on AWS | Push a checkpoint of any directory to S3 after the Deepspeed process completes. |
| Automatically upload a directory on Azure | Push a checkpoint of any directory to Azure Blob storage after the Deepspeed process completes. |
| Use Metaflow S3 client from the Deepspeed process | Upload arbitrary bytes to S3 storage from the Deepspeed process. |
| Use Metaflow Azure Blob client from the Deepspeed process | Upload arbitrary bytes to Azure Blob storage from the Deepspeed process. |
| Use a Metaflow Huggingface checkpoint on S3 | Push a checkpoint to S3 at the end of each epoch using a customizable Huggingface callback. See the implementation here to build your own. |
| Use a Metaflow Huggingface checkpoint on Azure | Push a checkpoint to Azure Blob storage at the end of each epoch using a customizable Huggingface callback. See the implementation here to build your own. |
License
metaflow-deepspeed is distributed under the Apache License.
Metadata
Release files for metaflow-deepspeed 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| metaflow_deepspeed-0.0.9.tar.gz | 27.8 kB | Without provenance | Details for metaflow_deepspeed-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| metaflow_deepspeed-0.0.9-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for metaflow_deepspeed-0.0.9-py2.py3-none-any.whl |
Total release size: 63.3 kB
Release files / metaflow_deepspeed-0.0.9.tar.gz
| Download URL | metaflow_deepspeed-0.0.9.tar.gz |
|---|---|
| Size | 27.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b31ece64b7183da5796fb02fa21f4e3e00a02ca139654848e6d16211c5a1d035
|
|
BLAKE2b-256 checksum How to use checksums |
a077facd58d7a094f819b4bcb68769251f8e8faf52bc2342909c88e309dbded6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.7
|
Release files / metaflow_deepspeed-0.0.9-py2.py3-none-any.whl
| Download URL | metaflow_deepspeed-0.0.9-py2.py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
df7f603428da66ff2053b8e6d12fe77027fc92cf8bd76d28fe52b2cae8b625c0
|
|
BLAKE2b-256 checksum How to use checksums |
091352e212adcde83b16566423d7d35aef7c5356cca25fa157cb33988322db64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.7
|
Security for metaflow-deepspeed 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.