Skip to content

Safetensors migration#1020

Merged
aaylward merged 3 commits intomainfrom
safetensors-migration
Feb 18, 2026
Merged

Safetensors migration#1020
aaylward merged 3 commits intomainfrom
safetensors-migration

Conversation

@aaylward
Copy link
Copy Markdown
Collaborator

Replace JSON weight format with safetensors across microgpt

Switch all weight and optimizer state serialization from JSON (f64 text)
to safetensors (f32 binary), reducing checkpoint size ~5x and enabling
f16 inference exports at ~10x reduction.

  • Add save_weights_st/load_weights_st to TensorGpt
  • Add save_m_st/save_v_st/load_state_st to TensorAdam
  • Add InferenceGpt::load_safetensors (handles f32 and f16)
  • Add serialize_state_dict_st for f16 export
  • Add microgpt export --half subcommand
  • Update CLI train/infer/info, serve to use safetensors
  • Remove all JSON weight serialization
  • Update all tests to safetensors; add byte-identity and f16 export tests
  • Update READMEs for lib, CLI, and serve

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

aaylward and others added 3 commits February 18, 2026 00:54
Switch all weight and optimizer state serialization from JSON (f64 text)
to safetensors (f32 binary), reducing checkpoint size ~5x and enabling
f16 inference exports at ~10x reduction.

- Add save_weights_st/load_weights_st to TensorGpt
- Add save_m_st/save_v_st/load_state_st to TensorAdam
- Add InferenceGpt::load_safetensors (handles f32 and f16)
- Add serialize_state_dict_st for f16 export
- Add `microgpt export --half` subcommand
- Update CLI train/infer/info, serve to use safetensors
- Remove all JSON weight serialization
- Update all tests to safetensors; add byte-identity and f16 export tests
- Update READMEs for lib, CLI, and serve

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aaylward aaylward enabled auto-merge (squash) February 18, 2026 06:04
@aaylward aaylward merged commit a9dfbbe into main Feb 18, 2026
9 checks passed
@aaylward aaylward deleted the safetensors-migration branch February 18, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant