mirror of
https://github.com/zml/zml.git
synced 2026-11-16 19:11:09 +00:00
Refactor `zml/safetensors.zig`
* Drop metadata parsing
* refactor code to be more "object oriented", code is owned by the
`TensorRegistry`
* implement a new format `model.safetensors.full_index.json` that is
similar to `index.json` but actually has data inside it:
```
{
"metadata": {"num_tensors":96085,"total_size":510286023000},
"weight_map": {
"aligner.w1.bias": {"filename":"model-00001-of-00048.safetensors","shape":[5120],"data_offsets":[27384,37624],"dtype":"BF16"},
"aligner.w1.weight": {"filename":"model-00001-of-00048.safetensors","shape":[5120,9216],"data_offsets":[37624,94409464],"dtype":"BF16"},
"aligner.w2.bias": {"filename":"model-00001-of-00048.safetensors","shape":[5120],"data_offsets":[94409464,94419704],"dtype":"BF16"},
"aligner.w2.weight": {"filename":"model-00001-of-00048.safetensors","shape":[5120,5120],"data_offsets":[94419704,146848504],"dtype":"BF16"},
"vision.blocks.0.attn.wo.bias": {"filename":"model-00001-of-00048.safetensors","shape":[1024],"data_offsets":[146848504,146850552],"dtype":"BF16"},
"vision.blocks.0.attn.wo.weight": {"filename":"model-00001-of-00048.safetensors","shape":[1024,1024],"data_offsets":[146850552,148947704],"dtype":"BF16"},
"vision.blocks.0.attn.wqkv.bias": {"filename":"model-00001-of-00048.safetensors","shape":[3072],"data_offsets":[148947704,148953848],"dtype":"BF16"},
...
```
I followed conventions of `model.saftensors.index.json`
|
History
|
|
|---|---|---|
| .. | ||
| stamp | ||
| bazel.zig | ||
| BUILD.bazel | ||
| cc_import.bzl | ||
| dpkg.bzl | ||
| http_aea_archive.bzl | ||
| http_deb_archive.bzl | ||
| huggingface.bzl | ||
| patchelf.bzl | ||
| runfiles.bzl | ||
| runfiles_init.c | ||
| simple_repository.bzl | ||
| swig.bzl | ||
| zig_index.json | ||
| zig_options.bzl | ||
| zig_proto_library.bzl | ||
| zig_srcs.bzl | ||