aday777 commited on
Commit
5986fab
·
verified ·
1 Parent(s): 6bd9b2d

README: add concrete How-to-use (stdlib header read + safetensors load)

Browse files
Files changed (1) hide show
  1. README.md +23 -0
README.md CHANGED
@@ -67,6 +67,29 @@ architecture without touching the 753B weights.
67
  the build environment), and whether `GlmMoeDsaForCausalLM` accepts this reduced geometry without
68
  extra fields. Treat those as open until run against a real install.
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  ## License
71
  MIT, unchanged from the base model per its Hub metadata. See `LICENSE`.
72
 
 
67
  the build environment), and whether `GlmMoeDsaForCausalLM` accepts this reduced geometry without
68
  extra fields. Treat those as open until run against a real install.
69
 
70
+ ## How to use
71
+ Read the tensors with the standard library (no torch needed, matching how this was built):
72
+
73
+ ```python
74
+ import json, struct
75
+ with open("model.safetensors", "rb") as f:
76
+ n = struct.unpack("<Q", f.read(8))[0]
77
+ header = json.loads(f.read(n))
78
+ # header[name] = {"dtype", "shape", "data_offsets"}; data starts at byte 8+n
79
+ ```
80
+
81
+ Or with the `safetensors` package:
82
+
83
+ ```python
84
+ from safetensors.torch import load_file
85
+ tensors = load_file("model.safetensors") # {name: tensor}
86
+ ```
87
+
88
+ To exercise a real loader, build a config from `config.json` (the `glm_moe_dsa`
89
+ model type; use `AutoConfig.from_pretrained(..., trust_remote_code=True)` where
90
+ needed) and feed these weights in. There is no `lm_head` tensor and the tokenizer
91
+ files are placeholders, so supply your own head/tokenizer.
92
+
93
  ## License
94
  MIT, unchanged from the base model per its Hub metadata. See `LICENSE`.
95