Skip to main content

A simple wrapper around DeepSpeed for model parallelism.

Project description

Model Parallelism

This package is a simple wrapper around DeepSpeed to make it as easy as possible to implement model parallelism in your PyTorch models.

Example Usage

  # Your training script
+ import model_parallelism

  # All your data preparation, logging, etc.

  model = create_model(...)

- model = model.to(device)
- optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)
+ model = model_parallelism.initialize(
+     model, learning_rate=1e-4, optimizer="Adam", batch_size=batch_size
+ )

  for batch in dataloader:
      loss = model(batch)
-     loss.backward
+     model.backward(loss)
-     optimizer.step()
+     model.step()

Project details


Download files

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

Source Distribution

model_parallelism-0.1.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

model_parallelism-0.1.0-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

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