Skip to main content

Memmpy

Memmpy is a Python library for working with memory mapped numpy arrays. It supports

  • Saving to temporary or permanent memory mapped files
  • Appending and extending arrays in constant time
  • Loading arrays in batches
  • Train-validation-test-splits and k-fold cross validation
  • Fast & lazy shuffling by shuffling in blocks and bands

Who should use Memmpy?

Memmpy is primarly intended for use in data science and machine learning applications where the dataset is too large to fit into memory at once. Memmpy is not intended for use in small applications where the entire dataset fits into memory and can be loaded at once. It is also not intended for use in very large applications where training is massively distributed.

Installation

Memmpy can be installed directly from PyPI using pip. It requires Python 3.10 or higher.

pip install memmpy

Usage

Writing to a memory mapped file.

# Create a memory mapped array
file = memmpy.Vector()

for i in range(4):
    file.append(np.random.rand(100))  # O(1)


file.extend(np.random.rand(32, 100))

# access the array
assert file.array.shape == (4 + 32, 100)

# save to non-temporary file
file.save("data.npy")

Loading random batches from a memory mapped file.

array = np.memmap(data.npy, dtype=np.float64, mode='r', shape=(36, 100))

# Load the array in batches
batch_indicies = memmpy.batch_indicies_split(
    array.shape[0],
    4,
    "train",
    valid_part=10,  # size of the validation and train set
    kfold_index=2,  # take the second out of 10 folds
)
shuffle = memmpy.shuffle_fast(array.shape[0], seed=42)  # O(1)

for indicies in batch_indicies:
    indicies = shuffle(indicies)
    batch = array[indicies]

Metadata

Release files for memmpy 0.1.11

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

Source distribution (sdist)

Source distribution for memmpy 0.1.11
File Size Uploaded Provenance Actions
memmpy-0.1.11.tar.gz 4.0 kB Without provenance Details for memmpy-0.1.11.tar.gz

Built distribution (wheel)

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

Total release size: 19.3 kB

Release files / memmpy-0.1.11.tar.gz

Download URL memmpy-0.1.11.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a5ccb72d993d146536e1622933b364e5a635252d9105225c35f45aae29d872b3
BLAKE2b-256 checksum
How to use checksums
04ada3d90be3b1f2db093f9876d581f4873a1d2c6f723709192c3365d0a3b6c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / memmpy-0.1.11-py3-none-any.whl

Download URL memmpy-0.1.11-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e3ff04628133befb0afebdb0cc0b973f252a32d1cddd6e71cbed809e40eed05
BLAKE2b-256 checksum
How to use checksums
500f15eb22792f1c34449b05e2291bb6aebdcbbecaa84c5d8c32f83aaaffa78c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for memmpy 0.1.11

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.

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