Skip to main content

Trainy on-demand profiler

GitHub Repo stars

This is the trainy CLI and daemon to setup on demand tracing for PyTorch in pure Python. This will allow you to extract traces in the middle of training.

Installation

You can either install from pypi or from source

# install from pypi
pip install trainy

# install from source
git clone https://github.com/Trainy-ai/trainy
pip install -e trainy

Quickstart

If you haven't already, set up ray head and worker nodes. This can configured to happen automatically using (Skypilot)[https://skypilot.readthedocs.io/en/latest/index.html] or K8s

# on the head node 
$ ray start --head --port 6380

# on the worker nodes
$ ray start --address ${HEAD_IP}

In your train code, initialize the trainy daemon before running your train loop.

import trainy
trainy.init()
Trainer.train()

While your model is training, to capture traces on all the nodes, run

$ trainy trace --logdir ~/my-traces

This saves the traces for each process locally into ~/my-traces. It's recommended you run a shared file system like NFS or an s3 backed store so that all of your traces are in the same place. An example of how to do this and scale this up is under the examples/resnet_mnist on AWS

How It Works

Trainy registers a hook into whatever PyTorch optimizer is present in your code, to count the optimizer iterations and registers the program with the head ray node. A separate HTTP server daemon thread is run concurrently, which waits for a trigger POST request to start profiling.

Need help

We offer support for both setting up trainy and analyzing program traces. If you are interested, please email us

Metadata

Release files for trainy 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trainy 0.1.3
File Size Uploaded
trainy-0.1.3.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trainy 0.1.3
File Interpreter ABI Platform
trainy-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / trainy-0.1.3.tar.gz

Download URL trainy-0.1.3.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bfffb017399938567f0e4344699ea8d40271a11c90a1c90367c866b1f6cc79e2
BLAKE2b-256 checksum
How to use checksums
5854c6c811cd0e1c36d5024e4eaae9bb4e48f5435b712ce2481637c1015788b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / trainy-0.1.3-py3-none-any.whl

Download URL trainy-0.1.3-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
367e0fa8940de27c462b5d8d349b884ceafbb8345d991d7c61f931f90966e254
BLAKE2b-256 checksum
How to use checksums
e0f325143a7b6358497f4a12a480a9cafe491d884d5084f807561f57d4b82aa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page