Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Expose more info to Python bindings #569

Open
yanok opened this issue Feb 5, 2025 · 0 comments
Open

FR: Expose more info to Python bindings #569

yanok opened this issue Feb 5, 2025 · 0 comments

Comments

@yanok
Copy link

yanok commented Feb 5, 2025

Feature request

Currently we can only get shape and dtype for all tensors via Python bindings. Could we also expose a global data offset as well as start/end offsets of specific tensors?

In particular, I'm interested in getting (start, end) offsets in the file for a specific tensor, so probably the global offset is not even needed, we can do addition on the Rust side.

Motivation

I want to experiment with reading the actual data using our custom interface that can stream data directly to GPU. So my plan is to read safetensors metadata using normal POSIX reads and then use custom API to stream the data. Custom API is in C but there are working Python bindings, so at this stage I'd prefer to keep the wiring in Python instead of trying to call into C from Rust. But for that I need to expose the offsets to Python.

Your contribution

Yes, I can submit a PR. It seems like a trivial change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant