Opens the diffusion-head fine-tune weights, preferring safetensors over the pickled variants.
| 434 | |
| 435 | // Opens the diffusion-head fine-tune weights, preferring safetensors over the pickled variants. |
| 436 | std::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. |
no test coverage detected