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

Function load_encoder_block

src/models/stable_audio/same_autoencoder.cpp:478–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476 prefix + ".mapping",
477 storage_type,
478 out_channels,
479 in_channels,
480 kernel,
481 true);
482 weights.new_tokens = store.load_f32_tensor(source, prefix + ".new_tokens", {1, 1, out_channels});
483 const int64_t depth = config.same_encoder_transformer_depths.front();
484 weights.transformers.reserve(static_cast<size_t>(depth));
485 for (int64_t layer = 0; layer < depth; ++layer) {
486 weights.transformers.push_back(load_same_transformer(
487 store,
488 source,
489 prefix + ".transformers." + std::to_string(layer),
490 config,
491 out_channels,
492 storage_type));
493 }
494 return weights;
495}
496
497} // namespace
498
499StableAudioSameWeights load_stable_audio_same_weights(
500 const StableAudioAssets & assets,
501 ggml_backend_t backend,
502 core::BackendType backend_type,
503 size_t weight_context_bytes,
504 assets::TensorStorageType weight_storage_type) {
505 const auto & config = assets.config;
506 const auto & source = *assets.model_weights;
507 StableAudioSameWeights weights;
508 weights.store = std::make_shared<core::BackendWeightStore>(
509 backend,
510 backend_type,
511 "stable_audio.same.weights",
512 weight_context_bytes != 0 ? weight_context_bytes :
513 kSameWeightContextBytes);
514 weights.bottleneck_bias = weights.store->load_f32_tensor(source, "pretransform.model.bottleneck.bias", {1, config.latent_dim, 1});

Callers 1

Calls 4

load_same_transformerFunction · 0.85
load_f32_tensorMethod · 0.80
load_weight_norm_conv1dFunction · 0.70
to_stringFunction · 0.50

Tested by

no test coverage detected