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
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.16.tar.gz
(5.5 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.16.tar.gz.
File metadata
- Download URL: vajra_streamer-0.0.16.tar.gz
- Upload date:
- Size: 5.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbbbb335d0eae4c7663b0326296ee140eec115871b3e7e8a5dd04260ca5f19f6
|
|
| MD5 |
5aeac4790404598a2f1327031f14bd2e
|
|
| BLAKE2b-256 |
a924d5def0d824838422a91970fcd829641f768143023ccb95ea5a6c2bff3a90
|
File details
Details for the file vajra_streamer-0.0.16-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: vajra_streamer-0.0.16-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 7.6 MB
- Tags: CPython 3.10, 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 |
7d12aaffdfaa92be64fcbff8c415790b90cc2034a1579f7460eef4ed061a2f86
|
|
| MD5 |
affe5c8e87cb5b810c9981cd58f75538
|
|
| BLAKE2b-256 |
ed36a89fbd4f582d09cfb459d79cfb3ea5522f574aabe4b73f90887c196fb269
|