Nicolas Patry [Wed, 5 Oct 2022 08:18:56 +0000 (10:18 +0200)]
Refusing to save non contiguous tensors now. (#17)
* Refusing to save non contiguous tensors now.
Refusing to save non contiguous tensors now.
It causes weird issues.
1/ It is hard to make it play well with lazy-loading since you would
have 2 call sites, 1 needing to refer to some mother tensor (and
potentially a whole graph of them) that might not yet exist.
```python
x = torch.zeros((20, 20))
y = x[:, 0]
torch.save([x, y], filename)
x1, y1 = torch.load(filename)
y1.fill_(1)
```
This exists because some two different tensors can refer to the same
buffer with different striding, and pytorch save can persist them.
This library and format doesn't enable that so we should just
discard them.
2/ There was a bug when saving from something else than `cpu`
because the pointer would point to a GPU address for instance
so every tensor needs to be brought back before saving
(Unless there's a better way).
Nicolas Patry [Thu, 29 Sep 2022 07:34:13 +0000 (09:34 +0200)]
Big revamp: (#10)
* Adding slicing support on tensorview.
Clippy 1.64.
Improve the comment.
[WIP] Bad python slice API for now, still looking for a nice pythonesque
one
But at least this works !
Much better API.
Pros:
- handles a lot of boilerplate for caller.
- Feels more pythonesque
Cons:
- Unsure about soundness of keeping Mmap struct.
- Lots more boilerplate in the binding
Removing unused code.
Improved API names hopefully.
Adding .keys() support.
Big revamp:
- Remove `Tensor` to fuse with `TensorView` (the price to pay for shape
cloning should be small enough that it shouldn't make too much of a
difference
- Remove `deserialize_file`, now that we have `safe_open` facility.
- Tried to remove `torch` dependency on `numpy` (Still need the
`torch.Tensor` to bytes without copying facility.
- Revamped the speed tests to show metrics side by side. They need
to be taken with extreme caution, timings are never reproducible.
New possibility to save metadata.
Fixing the workflow.
Rename.
Black.
Installing other libs.
Make windows happy.
Non venv.
Install jax on windows is impossible ?
More private python functions + Windows(flax) shenanigans.
Nicolas Patry [Tue, 22 Feb 2022 16:45:50 +0000 (17:45 +0100)]
Getting something decent.
- Still a copy at the Rust/Python boundaries (ideally we need to
std::mem::forget, and pass raw pointers to Python world to avoid the
copy)
- Saving/Loading, use pure bytes array to avoid writing to disk, but
that does incure more memory usage, maybe something to add later.