Skip to main content

flaregun

A simple helper package for PyTorch to get better visibility on real-time GPU usage, model params, etc.

Installation

$ pip install flaregun

Usage

Get real-time Nvidia GPU memory usage in Python:

from flaregun import GPUStats

# Pretty print statistics for GPU #0
GPUStats(device=0).print()
> "GPU memory usage: 3061 / 32510 MB"

Get parameter count in any PyTorch compatible model (e.g. HuggingFace, etc.):

from flaregun import ModelStats

# Get HuggingFace model
model = AutoModelForMaskedLM.from_pretrained("/path/to/Longformer-Model")

# Pretty print Model parameter count
ModelStats(model).print()
> "148711257 params (148711257 trainable | 0 non-trainable)"

API

All features of the library are listed below.

GPU memory utilization

from flaregun import GPUStats

device = ...integer of GPU device...

# Free GPU memory (in MB)
free_mem = GPUStats(device).free()

# Total GPU memory (in MB)
total_mem = GPUStats(device).total()

# Used GPU memory (in MB)
used_mem = GPUStats(device).used()

Model parameter count

from flaregun import ModelStats

model = ...PyTorch-compatible model...

# Total params
total = ModelStats(model).total()

# Trainable params
trainable = ModelStats(model).trainable()

# Frozen (non-trainable) params
frozen = ModelStats(model).frozen()

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

Running Tests

poetry run pytest tests/

Test PyPI

Create release:

git tag vXX.XX.XXX
git push --tags
# Then go to Github and link this tag to a Release

Publish:

poetry build
poetry publish -r test-pypi --username XXX --password XXXX

Install:

pip3 install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple flaregun

PyPI

Publish:

poetry publish

Building Docs

cd docs
poetry run make clean html && poetry run make html

License

flaregun was created by Michael Wornow. It is licensed under the terms of the MIT license.

Credits

flaregun was created with cookiecutter and the py-pkgs-cookiecutter template.

Metadata

Release files for flaregun 0.0.2

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

Source distribution (sdist)

Source distribution for flaregun 0.0.2
File Size Uploaded Provenance Actions
flaregun-0.0.2.tar.gz 3.3 kB Without provenance Details for flaregun-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 7.2 kB

Release files / flaregun-0.0.2.tar.gz

Download URL flaregun-0.0.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4598e944f0e8c696fa009fe4eaed56bb405c8a642c7acbcda0fdd3fde05bb37b
BLAKE2b-256 checksum
How to use checksums
5f4d8fc8197b578d148546899193a3ec783da40827074f21aa416844a811f49c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.9.6 Darwin/21.6.0

Release files / flaregun-0.0.2-py3-none-any.whl

Download URL flaregun-0.0.2-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
877ff1f3e04f8b016717eb125b0ae835dc78856d109f81efb855665aefea9359
BLAKE2b-256 checksum
How to use checksums
02a8e74bcab874ca4cffa97432c4bec684b633b1ea866f17a80d4044561ba4f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.9.6 Darwin/21.6.0

Security for flaregun 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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