pdmr: Pandas Multiprocess Runner - A library for running functions on Pandas DataFrames with multiprocessing and checkpointing.
Project description
pandas_multiprocess_runner
A library for running functions on Pandas DataFrames with multiprocessing and checkpointing, supporting both synchronous and asynchronous execution.
Installation
pip install pdmr
Usage
from pdmr import PandasMultiprocessRunner
import pandas as pd
# Example usage with your inference logic:
def my_inference_function(index, prompt, response_a, response_b):
# ... your inference logic using get_response and construct_prompt ...
return {
"result": inference_result,
"other_data": "example"
}
# Sample DataFrame (replace with your 'train' DataFrame)
data = {
"Index": range(5),
"prompt": ["prompt1", "prompt2", "prompt3", "prompt4", "prompt5"],
"response_a": ["response_a1", "response_a2", "response_a3", "response_a4", "response_a5"],
"response_b": ["response_b1", "response_b2", "response_b3", "response_b4", "response_b5"]
}
df = pd.DataFrame(data).set_index('Index')
runner = PandasMultiprocessRunner(
my_inference_function,
df,
checkpoint_interval=2,
output_dir="my_results",
use_async=False # or True for asynchronous
)
results_df = runner.run("prompt", "response_a", "response_b")
print(results_df)
pandas_multiprocess_runner/
├── pandas_multiprocess_runner/
│ ├── __init__.py
│ ├── core.py # Core logic for processing and checkpointing
│ ├── utils.py # Helper functions (e.g., for checkpointing)
│ └── exceptions.py # Custom exception classes
├── tests/
│ ├── __init__.py
│ └── test_core.py # Unit tests for core.py
├── setup.py # Package metadata and installation
├── README.md # Project description and usage instructions
├── requirements.txt # Project dependencies
└── examples.py # Example usage of the library
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pdmr-0.1.0.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pdmr-0.1.0-py3-none-any.whl
(4.7 kB
view details)
File details
Details for the file pdmr-0.1.0.tar.gz.
File metadata
- Download URL: pdmr-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e22906955d6b5c998be252d6f0020426370f8d740b159e6a6f5c1d49dc3bcf
|
|
| MD5 |
c862e082750d1b5320daafd582bebc2a
|
|
| BLAKE2b-256 |
4f1a72842473b245c471fa2be5f0dc2da20e7f6b435f5fe4b3e772dc941cc69c
|
File details
Details for the file pdmr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pdmr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d22424c853fc1aa10c20f415dbc5990ac930bb832230781f6457a5dca7016a4b
|
|
| MD5 |
273c4142e17ebc9cb19f9787e07f1295
|
|
| BLAKE2b-256 |
77e65022d90cb17acb040f8acef3ce49366c4bc70d65f447c68a28c1756e6e14
|