Skip to main content

ModuleProfiler

Free open-source package to profile torch.nn.Module modules and obtain useful information to design a model that fits your needs and constraints at development time.

With moduleprofiler you can:

  • Calculate the number of parameters of your model.
  • Trace the input and output sizes of each component of your model.
  • Estimate the number of operations your model performs in a forward pass.
  • Calculate per module and total inference time.

All results can be obtained in one of the following formats:

  • dict (default output format)
  • pandas.DataFrame (to perform further calculations or filtering in your code)
  • html (to export as webpage)
  • LaTeX (to include in your publications)

[Online documentation | Tutorial ]

Installation

moduleprofiler can be installed as any regular python module within your environment.

Install from PyPI:

python -m pip install moduleprofiler

Install from this repository:

python -m pip install git+https://github.com/eagomez2/moduleprofiler.git

Documentation

You can access the online documentation. There you will find a more in depth introduction to moduleprofiler, including tutorials, methods documentation and an extensive reference about the calculations utilized to estimate the operations of different supported torch.nn.Module modules.

You can also run the documentation locally by going to the root folder of the package and running:

mkdocs serve

Before running this, make sure that your python environment is enabled.

Cite

If this package contributed to your work, please consider citing it:

@misc{moduleprofiler,
  author = {Esteban Gómez},
  title  = {moduleprofiler},
  year   = 2024,
  url    = {https://github.com/eagomez2/moduleprofiler}
}

This package was developed by Esteban Gómez, member of the Speech Interaction Technology group from Aalto University.

License

For further details about the license of this package, please see LICENSE.

Metadata

Release files for moduleprofiler 0.0.4

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

Source distribution (sdist)

Source distribution for moduleprofiler 0.0.4
File Size Uploaded
moduleprofiler-0.0.4.tar.gz 444.0 kB Details

Built distribution (wheel)

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

Total release size: 465.4 kB

Release files / moduleprofiler-0.0.4.tar.gz

Download URL moduleprofiler-0.0.4.tar.gz
Size 444.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8aab7f376860647b2d7308f635b4bdb68ee712b1f4e551add2ec5ce316ce9372
BLAKE2b-256 checksum
How to use checksums
65d4f9510380b9dae66319ed7c2ac35cf503ec4ae792a79cf3bebf4d685751c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / moduleprofiler-0.0.4-py3-none-any.whl

Download URL moduleprofiler-0.0.4-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5522167d3b5ff4abc56fee91a146a42c9dab66956b4509bc2368f3fe239bcf30
BLAKE2b-256 checksum
How to use checksums
68e81eb14becedd6b6531ba1e330e7264a92b8148ba38f9e17ca90a20458c76f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.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