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

Safetensors changes #913

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

swfsql
Copy link
Contributor

@swfsql swfsql commented Feb 1, 2024

  • Makes the safetensors module private.
    • Doesn't get exported on the preamble, avoiding a naming clash with the safetensors external crate for apps that use dfdx.
  • Change how and when the period . is inserted.
    • This should make it closer to how the fields are accessed in the code.
  • For load, read, save, write safetensor(s), add a _with method:
    • Requires load/read to decide whether it should skip missing tensors;
    • Requires load/read/save/write to decide how should keys be mapped.
    • This makes it easier to load/save from/to models that were not saved by dfdx and thus contains a different safetensors key/location structuring.
  • Allow models to get built from a safetensors byte array data (not from reading a file).

This doesn't have much testing nor documentation updates, so this PR should be considered a draft.

@swfsql swfsql mentioned this pull request Feb 7, 2024
13 tasks
@swfsql swfsql changed the title Update safetensors module and naming Safetensors changes Feb 9, 2024
@swfsql swfsql marked this pull request as draft March 1, 2024 14:56
- Makes the safetensors module private.
  - Doesn't get exported on the preamble, avoiding a naming clash with the safetensors external crate.
- Change how and when the period is inserted.
  - This should make it closer to how the fields are accessed in the code.
This alternative method:
- Requires load/read to decide whether it should skip missing tensors;
- Requires load/read/save/write to decide how should keys be mapped.
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

Successfully merging this pull request may close these issues.

None yet

2 participants