| 66 | } |
| 67 | |
| 68 | VibeVoiceDiffusionHeadLayerWeights 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 | |
| 102 | core::TensorValue repeat_last_dim_like( |
| 103 | core::ModuleBuildContext & ctx, |
no test coverage detected