MCPcopy Create free account
hub / github.com/Niko1221/Strata / stage_groups

Function stage_groups

engine/src/split/src/model.cpp:235–255  ·  view source on GitHub ↗

the stager's groups for load_card: group l every tensor of layer l, group NL the output head's. The head is read through the page cache: the draft layer (Mtp) takes its rows of output.weight from the mapping after the load

Source from the content-addressed store, hash-verified

233// the stager's groups for load_card: group l every tensor of layer l, group NL the output head's. The head is read
234// through the page cache: the draft layer (Mtp) takes its rows of output.weight from the mapping after the load
235std::vector<Stager::Group> stage_groups(const Gguf& g) {
236#if FNX_27B
237 // and group NL + 1 the draft layer, blk.NL (Flash-Next's comes from separate files, Mtp)
238 std::vector<Stager::Group> gs(NL + 2);
239 for (const auto& kv : g.tensors()) {
240 int l = -1, n = 0;
241 if (std::sscanf(kv.first.c_str(), "blk.%d.%n", &l, &n) == 1 && n > 0 && l >= 0 && l <= NL)
242 gs[(size_t) (l < NL ? l : NL + 1)].names.push_back(kv.first);
243 }
244 gs[NL].names = {"output_norm.weight", "output.weight"};
245#else
246 std::vector<Stager::Group> gs(NL + 1);
247 for (const auto& kv : g.tensors()) {
248 int l = -1, n = 0;
249 if (std::sscanf(kv.first.c_str(), "blk.%d.%n", &l, &n) == 1 && n > 0 && l >= 0 && l < NL) gs[(size_t) l].names.push_back(kv.first);
250 }
251 gs[NL].names = {"output_hc_norm.weight", "output_hc_down.weight", "output_hc_up.weight", "output.weight"};
252#endif
253 gs[NL].cached = true;
254 return gs;
255}
256
257// the column slicers take block indices that the callers count in 32-value blocks (ff0 / 32, HS / 32, HD / 32)
258TypeInfo block32(const Tensor& t) {

Callers 1

ModelMethod · 0.85

Calls 2

push_backMethod · 0.80
tensorsMethod · 0.45

Tested by

no test coverage detected