]> khamidou — GitHub mirrors - safetensors.git/log
safetensors.git
4 years agoImplement benchmarking using Criterion (#19)
Mishig [Fri, 7 Oct 2022 14:10:34 +0000 (16:10 +0200)]
Implement benchmarking using Criterion (#19)

4 years agoRefusing to save non contiguous tensors now. (#17)
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).

3/ Disable saving sparse tensors.

Forcing contiguous tensors from PT.

* Black.

* Fixing sparse.

* Skip if no gpu.

* X

* Y.

* Update bindings/python/py_src/safetensors/torch.py

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
* Updating quality.

* Rewrite warning multiline.

* Remove `doc-builder` not there yet.

* Factor out flattening.

* Forgot the workflows.

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
4 years agoUse np.prod for compatibility with Python 3.7 (#14)
Sylvain Gugger [Fri, 30 Sep 2022 11:36:02 +0000 (07:36 -0400)]
Use np.prod for compatibility with Python 3.7 (#14)

4 years agoBump version number for next release. (#13)
Nicolas Patry [Fri, 30 Sep 2022 08:37:19 +0000 (10:37 +0200)]
Bump version number for next release. (#13)

4 years agoRemoving dev suffix. (#12)
Nicolas Patry [Thu, 29 Sep 2022 13:31:17 +0000 (15:31 +0200)]
Removing dev suffix. (#12)

4 years agoUpdate README.md (#11)
Nicolas Patry [Thu, 29 Sep 2022 13:21:07 +0000 (15:21 +0200)]
Update README.md (#11)

* Update README.md

* Update bindings/python/README.md

Co-authored-by: Mishig Davaadorj <mishig.davaadorj@coloradocollege.edu>
Co-authored-by: Mishig Davaadorj <mishig.davaadorj@coloradocollege.edu>
4 years agoBig revamp: (#10)
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.

Fixing TF to be ACTUALLY TF native.

Option<Metadata>

* Black.

* Export metadata.

4 years agoPoC for additional metadata (#9)
Sylvain Gugger [Wed, 28 Sep 2022 16:05:00 +0000 (12:05 -0400)]
PoC for additional metadata (#9)

* PoC for additional metadata

* Address review comments and fix tests

* Don't push format metadata

4 years agoFix SIZES for torch tensors (#4)
Sylvain Gugger [Fri, 23 Sep 2022 16:58:15 +0000 (12:58 -0400)]
Fix SIZES for torch tensors (#4)

4 years agoMain should not have a released version (so users don't make (#3)
Nicolas Patry [Fri, 23 Sep 2022 14:50:28 +0000 (16:50 +0200)]
Main should not have a released version (so users don't make (#3)

confusions.)

4 years agoMerge pull request #2 from mishig25/patch-1
Nicolas Patry [Fri, 23 Sep 2022 13:30:51 +0000 (15:30 +0200)]
Merge pull request #2 from mishig25/patch-1

Update README.md

4 years agoUpdate README.md
Mishig Davaadorj [Fri, 23 Sep 2022 10:09:47 +0000 (12:09 +0200)]
Update README.md

4 years agoMerge pull request #1 from huggingface/create_release_gh_action
Nicolas Patry [Fri, 23 Sep 2022 09:56:49 +0000 (11:56 +0200)]
Merge pull request #1 from huggingface/create_release_gh_action

Creating build gh action

4 years agoCreate release actions.
Nicolas Patry [Fri, 23 Sep 2022 09:52:20 +0000 (11:52 +0200)]
Create release actions.

4 years agoAdd license, focus on conda.
Nicolas Patry [Thu, 22 Sep 2022 22:18:13 +0000 (00:18 +0200)]
Add license, focus on conda.

4 years agoAdd LICENSE
Nicolas Patry [Thu, 22 Sep 2022 22:17:31 +0000 (00:17 +0200)]
Add LICENSE

4 years agoMissing conda scripts.
Nicolas Patry [Thu, 22 Sep 2022 21:46:43 +0000 (23:46 +0200)]
Missing conda scripts.

4 years agoTest other releases.
Nicolas Patry [Thu, 22 Sep 2022 21:15:17 +0000 (23:15 +0200)]
Test other releases.

4 years ago1.64 requires manylinux2014
Nicolas Patry [Thu, 22 Sep 2022 21:11:00 +0000 (23:11 +0200)]
1.64 requires manylinux2014

  https://github.com/messense/maturin-action/pull/83

4 years ago:(
Nicolas Patry [Thu, 22 Sep 2022 16:33:57 +0000 (18:33 +0200)]
:(

4 years agoMany linux try to get rust from gh action.
Nicolas Patry [Thu, 22 Sep 2022 16:31:59 +0000 (18:31 +0200)]
Many linux try to get rust from gh action.

4 years agoReadme compliance.
Nicolas Patry [Thu, 22 Sep 2022 15:50:14 +0000 (17:50 +0200)]
Readme compliance.

4 years agoClippy pass.
Nicolas Patry [Thu, 22 Sep 2022 15:32:13 +0000 (17:32 +0200)]
Clippy pass.

4 years agoCreating build gh action
Nicolas Patry [Thu, 22 Sep 2022 15:26:20 +0000 (17:26 +0200)]
Creating build gh action

4 years agoIncluding here.
Nicolas Patry [Wed, 6 Jul 2022 22:38:20 +0000 (00:38 +0200)]
Including here.

4 years agoConvertion of bfloat16 enabled.
Nicolas Patry [Wed, 6 Jul 2022 22:33:40 +0000 (00:33 +0200)]
Convertion of bfloat16 enabled.

4 years agoSmall helpers
Nicolas Patry [Wed, 6 Jul 2022 20:26:56 +0000 (22:26 +0200)]
Small helpers

4 years agoSupport and tests vs other frameworks.
Nicolas Patry [Wed, 2 Mar 2022 16:52:51 +0000 (17:52 +0100)]
Support and tests vs other frameworks.

4 years agoCleaning up Python organisation + readme + tests.
Nicolas Patry [Wed, 2 Mar 2022 13:41:57 +0000 (14:41 +0100)]
Cleaning up Python organisation + readme + tests.

4 years agoFormatting.
Nicolas Patry [Wed, 2 Mar 2022 09:38:33 +0000 (10:38 +0100)]
Formatting.

4 years agoUpdated the rEADME a little.
Nicolas Patry [Wed, 2 Mar 2022 08:57:14 +0000 (09:57 +0100)]
Updated the rEADME a little.

4 years agoCompleting a bit the README.
Nicolas Patry [Tue, 1 Mar 2022 22:26:24 +0000 (23:26 +0100)]
Completing a bit the README.

4 years agoTMP.
Nicolas Patry [Tue, 1 Mar 2022 16:54:04 +0000 (17:54 +0100)]
TMP.

4 years agoWriting to file using BufWriter.
Nicolas Patry [Fri, 25 Feb 2022 13:55:50 +0000 (14:55 +0100)]
Writing to file using BufWriter.

4 years agoAdding mmap loading to prevent the extra copy while remaining safe.
Nicolas Patry [Fri, 25 Feb 2022 12:47:45 +0000 (13:47 +0100)]
Adding mmap loading to prevent the extra copy while remaining safe.

4 years agoByteArray (to be writeable for torch support).
Nicolas Patry [Thu, 24 Feb 2022 18:27:51 +0000 (19:27 +0100)]
ByteArray (to be writeable for torch support).

4 years agoGetting something decent.
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.

4 years agoInitial commit.
Nicolas Patry [Mon, 21 Feb 2022 16:49:06 +0000 (17:49 +0100)]
Initial commit.