Welcome to the pprobe repository, a powerful Python hook tool designed to enhance your development and debugging experience. This tool provides a variety of features that can help you trace function calls, manage device conversions, and much more. Below is an overview of the project, its installation process, usage, and contribution guidelines.
# pprobe: Python Hook Tool
Welcome to the pprobe repository, a powerful Python hook tool designed to enhance your development and debugging experience. This tool provides a variety of features that can help you trace function calls, manage device conversions, and much more. Below is an overview of the project, its installation process, usage, and contribution guidelines.
## Overview
pprobe is a versatile Python package that allows you to:
- Trace and log function calls within your Python applications.
- Detect and log device conversions for tensors in PyTorch.
- Utilize a command-line interface to enable or disable specific options.
The tool is particularly useful for debugging complex Python applications, especially those involving deep learning frameworks like PyTorch.
## Installation
To install pprobe, clone the repository and use pip to install the package and its dependencies:
```sh
git clone https://github.com/your-username/pprobe.git
cd pprobe
pip install -r requirements.txt
python setup.py install
pprobe can be used in various ways depending on your needs:
To start using pprobe in your Python script, you can import and initialize it as follows:
from pprobe.bootstrap import TorchFunctionContext
context = TorchFunctionContext()
context.__enter__()
# Your code here
context.__exit__()
pprobe comes with a command-line interface that allows you to enable, disable, list, and reset options. Here are some examples:
List current status:
PPROBE --list
Enable specific options:
PPROBE --enable option1,option2
Disable specific options:
PPROBE --disable option1,option2
Reset options to default:
PPROBE --reset
For PyTorch users, pprobe provides specific hooks to trace tensor operations:
from pprobe.bootstrap import torch_hook_fn
torch_hook_fn('torch', torch)
Contributions to pprobe are welcome! To contribute, please follow these steps:
- Fork the repository and clone it to your local machine.
- Create a new branch for your changes.
- Make your changes and ensure that tests pass.
- Submit a pull request with a detailed description of your changes.
To run tests, use tox:
tox
PPROBE --list
=================================================
██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔══██╗██╔══██╗██╔═══██╗██╔══██╗██╔════╝
██████╔╝██████╔╝██████╔╝██║ ██║██████╔╝█████╗
██╔═══╝ ██╔═══╝ ██╔══██╗██║ ██║██╔══██╗██╔══╝
██║ ██║ ██║ ██║╚██████╔╝██████╔╝███████╗
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
=================================================
+------------------------+--------+---------+
| TOGGLE-NAMES | STATUS | DEFAULT |
+------------------------+--------+---------+
| PPROBE_ENABLE | True | False |
| TORCH_REPRODUCE | True | True |
| TORCH_CATCH_STEP | False | False |
| TORCH_CATCH_LOSS | False | False |
| TORCH_CATCH_LR | False | False |
| TORCH_DUMP_OP | True | False |
| TORCH_DUMP_MODULE | False | False |
| TORCH_DUMP_DIST | False | False |
| TORCH_DUMP_MEMORY | False | False |
| TORCH_TEST_DUMP_OP | False | False |
| TORCH_TEST_DUMP_MODULE | False | False |
| TORCH_TEST_DUMP_DIST | False | False |
| TORCH_PERF_ISSUE | False | False |
| TORCH_TRACE_FILE | False | False |
+------------------------+--------+---------+
pprobe is released under the MIT License.
For any questions or feedback, please reach out to [email protected].
Feel free to explore the code and examples provided in this repository. We hope that pprobe will be a valuable addition to your Python development toolkit. Happy coding!