A fast zero-copy PyTorch tensor streamer
Project description
Vajra
A fast zero-copy PyTorch tensor streamer powered by Dlang.
Usage
Once installed, you can use Vajra in any Python script or Jupyter Notebook:
import torch
from vajra import VajraStreamer, StreamConfig
# Configure the streamer (optional, uses defaults otherwise)
config = StreamConfig(
auth_token="hf_YOUR_TOKEN", # Required for gated models like Llama 3
chunk_size_mb=64,
chunk_workers=16,
gpu_workers=3,
disable_cache=False
)
# Context manager ensures VRAM is freed when done
with VajraStreamer(config) as streamer:
# Pass the URL or a Hugging Face repo ID
# (e.g. "meta-llama/Meta-Llama-3-8B")
tensors = streamer.load("meta-llama/Meta-Llama-3-8B")
# 'tensors' is a dictionary mapping tensor names to zero-copy PyTorch tensors
# that are backed directly by the downloaded GPU memory.
for name, tensor in tensors.items():
print(f"Tensor: {name}, Shape: {tensor.shape}, Dtype: {tensor.dtype}")
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
vajra_streamer-0.0.21.tar.gz
(3.8 MB
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
File details
Details for the file vajra_streamer-0.0.21.tar.gz.
File metadata
- Download URL: vajra_streamer-0.0.21.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19fcd1622b6789c2d945fd33649816ca6d70ca97a6c0a2843f59d47303bca33b
|
|
| MD5 |
4d782c8d594f8af7a1fb9ff8f8e0e836
|
|
| BLAKE2b-256 |
04ec4ca80a24d57bd913f24b9c211f7face127fbe2799f771bd04d6d4572d1c3
|
File details
Details for the file vajra_streamer-0.0.21-py3-none-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: vajra_streamer-0.0.21-py3-none-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 8.0 MB
- Tags: Python 3, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f0b2cdefa0658a450b9e7f84795c13ec941ca2b120332292481967e9206f997
|
|
| MD5 |
9986cf2c84f30181caf050ab1c91bf05
|
|
| BLAKE2b-256 |
b49faec6a4201604271a1782a7ad3a2c4b8dfcf5261a59a0417dc89cad4ff95f
|