MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / load_layer_weights

Function load_layer_weights

src/models/vibevoice/diffusion_head.cpp:68–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68VibeVoiceDiffusionHeadLayerWeights load_layer_weights(
69 core::BackendWeightStore & store,
70 const assets::TensorSource & source,
71 const VibeVoiceDiffusionHeadConfig & config,
72 int64_t layer,
73 assets::TensorStorageType weight_storage_type) {
74 const std::string prefix = "model.prediction_head.layers." + std::to_string(layer);
75 const int64_t hidden = config.hidden_size;
76 const int64_t ffn = ffn_dim(config);
77 VibeVoiceDiffusionHeadLayerWeights weights;
78 weights.gate_proj.weight = store.load_tensor(
79 source,
80 prefix + ".ffn.gate_proj.weight",
81 weight_storage_type,
82 {ffn, hidden});
83 weights.up_proj.weight = store.load_tensor(
84 source,
85 prefix + ".ffn.up_proj.weight",
86 weight_storage_type,
87 {ffn, hidden});
88 weights.down_proj.weight = store.load_tensor(
89 source,
90 prefix + ".ffn.down_proj.weight",
91 weight_storage_type,
92 {hidden, ffn});
93 weights.norm = source.require_f32_tensor(prefix + ".norm.weight", {hidden});
94 weights.ada_ln.weight = store.load_tensor(
95 source,
96 prefix + ".adaLN_modulation.1.weight",
97 weight_storage_type,
98 {3 * hidden, hidden});
99 return weights;
100}
101
102core::TensorValue repeat_last_dim_like(
103 core::ModuleBuildContext & ctx,

Callers 1

Calls 4

ffn_dimFunction · 0.85
load_tensorMethod · 0.80
require_f32_tensorMethod · 0.80
to_stringFunction · 0.50

Tested by

no test coverage detected