Skip to content

Commit 255f95a

Browse files
committed
Model: hotfix for broken tensor names in flux unchained
1 parent 14206fd commit 255f95a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

model.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,8 +1669,13 @@ bool ModelLoader::load_tensors(std::map<std::string, struct ggml_tensor*>& tenso
16691669
std::set<std::string> ignore_tensors) {
16701670
std::set<std::string> tensor_names_in_file;
16711671
auto on_new_tensor_cb = [&](const TensorStorage& tensor_storage, ggml_tensor** dst_tensor) -> bool {
1672-
const std::string& name = tensor_storage.name;
1672+
std::string name = tensor_storage.name;
16731673
// LOG_DEBUG("%s", tensor_storage.to_string().c_str());
1674+
if (starts_with(name, "model.diffusion_model.model.diffusion_model")) {
1675+
LOG_WARN("Tensor %s has duplicated 'model.diffusion_model', attempting dirty fix...", name.c_str());
1676+
name = name.substr(strlen("model.diffusion_model."));
1677+
}
1678+
16741679
tensor_names_in_file.insert(name);
16751680

16761681
struct ggml_tensor* real;

0 commit comments

Comments
 (0)