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

Function open_diffusion_head_source

src/models/vibevoice/lora.cpp:436–450  ·  view source on GitHub ↗

Opens the diffusion-head fine-tune weights, preferring safetensors over the pickled variants.

Source from the content-addressed store, hash-verified

434
435// Opens the diffusion-head fine-tune weights, preferring safetensors over the pickled variants.
436std::shared_ptr<const assets::TensorSource> open_diffusion_head_source(const std::filesystem::path & adapter_dir) {
437 const auto safetensors = adapter_dir / "diffusion_head" / "model.safetensors";
438 if (engine::io::is_existing_file(safetensors)) {
439 return assets::open_tensor_source(safetensors);
440 }
441 const auto bin = adapter_dir / "diffusion_head_full.bin";
442 if (engine::io::is_existing_file(bin)) {
443 return assets::open_torch_bin_tensor_source(bin);
444 }
445 const auto nested_bin = adapter_dir / "diffusion_head" / "diffusion_head_full.bin";
446 if (engine::io::is_existing_file(nested_bin)) {
447 return assets::open_torch_bin_tensor_source(nested_bin);
448 }
449 return nullptr;
450}
451
452// Registers full-weight overrides for every adapter tensor that has a matching base tensor. A shape
453// mismatch is a hard error (wrong model size); a missing base tensor is skipped like strict=False.

Callers 1

Calls 3

is_existing_fileFunction · 0.85
open_tensor_sourceFunction · 0.85

Tested by

no test coverage detected