From 255f95a7ffae9a7599f6a9e7ae2e15ceba1445ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20du=20Hamel?= Date: Fri, 4 Oct 2024 14:06:37 +0200 Subject: [PATCH] Model: hotfix for broken tensor names in flux unchained --- model.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/model.cpp b/model.cpp index b74a735f..c707c0f3 100644 --- a/model.cpp +++ b/model.cpp @@ -1669,8 +1669,13 @@ bool ModelLoader::load_tensors(std::map& tenso std::set ignore_tensors) { std::set tensor_names_in_file; auto on_new_tensor_cb = [&](const TensorStorage& tensor_storage, ggml_tensor** dst_tensor) -> bool { - const std::string& name = tensor_storage.name; + std::string name = tensor_storage.name; // LOG_DEBUG("%s", tensor_storage.to_string().c_str()); + if (starts_with(name, "model.diffusion_model.model.diffusion_model")) { + LOG_WARN("Tensor %s has duplicated 'model.diffusion_model', attempting dirty fix...", name.c_str()); + name = name.substr(strlen("model.diffusion_model.")); + } + tensor_names_in_file.insert(name); struct ggml_tensor* real;