Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

covex-neuron

PyPI GitHub License Python Status

Run your PyTorch and Hugging Face code on AWS Trainium, unchanged from NVIDIA except for two lines

GitHub · PyPI · Notebooks

covex-neuron is built on TorchNeuron, the native PyTorch backend for Trainium2 and Trainium3. It handles the parts that make Trainium different from a GPU (bf16, fixed input shapes, the Neuron compiler) and runs your script on AWS by the second, next to an NVIDIA GPU for comparison.

Installation

pip install covex-neuron

Quickstart

Add two lines to an existing GPU script:

import covex_neuron as cn

device = cn.device()                      # "neuron" on Trainium, "cuda" on GPU
pipe = pipeline("sentiment-analysis", model="distilbert/distilbert-base-uncased-finetuned-sst-2-english", device=device)
pipe = cn.prepare(pipe)                   # no-op on GPU / CPU

cn.prepare takes a transformers model (with its tokenizer), a transformers pipeline, or a diffusers pipeline.

Run it on a GPU and on Trainium from your laptop, using only your AWS credentials:

gpu = cn.run(["sentiment.py"], on="gpu")        # 1x NVIDIA A10G
trn = cn.run(["sentiment.py"], on="trainium")   # 1x Trainium2 chip
cn.compare(gpu, trn)

You pay per second while the job runs, and nothing keeps running afterwards.

Notebooks

Notebook Workload
01 Sentiment analysis transformers pipeline, DistilBERT SST-2
02 Text classification AutoModelForSequenceClassification, emotion (7 classes)
03 Image generation diffusers, SD-Turbo

Each one runs the same script on a GPU and on Trainium and prints the comparison.

Examples

examples/nvidia has sentiment analysis, text classification and image generation scripts as written for a GPU. examples/trainium has the same scripts with the two lines added. To run both and compare:

python examples/run_demo.py

License

Apache 2.0

Metadata

Release files for covex-neuron 0.0.1.dev2

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

Source distribution (sdist)

Source distribution for covex-neuron 0.0.1.dev2
File Size Uploaded Provenance
covex_neuron-0.0.1.dev2.tar.gz 19.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for covex-neuron 0.0.1.dev2
File Interpreter ABI Platform
covex_neuron-0.0.1.dev2-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / covex_neuron-0.0.1.dev2.tar.gz

Download URL covex_neuron-0.0.1.dev2.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d53018bbb8d2cc51ff6c5157d64c6b70cde5fe35bf7187d884d965d5110f5e6d
BLAKE2b-256 checksum
How to use checksums
90174ed24c63a6d03e69bbf9f629eea1aa1a3cc0c9ad128c268400d0c666c180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / covex_neuron-0.0.1.dev2-py3-none-any.whl

Download URL covex_neuron-0.0.1.dev2-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56349e03b0f738338fab4239eb2ae8e5ccd6fe076afbe0ec6f55a7d0a7240655
BLAKE2b-256 checksum
How to use checksums
7717246db70c6ec45c72e8038565800d7c335a082f3d93114ef3660a04a19233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for covex-neuron 0.0.1.dev2

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.

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