Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/model_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,33 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb,
}
std::string processed_name = convert_tensor_name(tensor_storage.name, imatrix_version);
std::vector<float> imatrix = get_imatrix_collector().get_values(processed_name);
if (imatrix.empty()) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to pass in a --imat-prefix argument to specify the prefix, rather than trying to hardcode the traversal.

const std::vector<std::string> known_prefixes = {
"model.diffusion_model.",
"model.high_noise_diffusion_model.",
"model.diffusion_model.uncond.",

"cond_stage_model.transformer.",
"text_encoders.clip_l.transformer.",
"cond_stage_model.1.transformer.",
"text_encoders.clip_g.transformer.",

"text_encoders.t5xxl.transformer.",
"text_encoders.llm.",
"text_encoders.llm.visual.",

"vae.",
"tae."};
std::string processed_name_original = processed_name;

for (const auto& prefix : known_prefixes) {
processed_name = prefix + processed_name_original;
imatrix = get_imatrix_collector().get_values(processed_name);
if (!imatrix.empty()) {
break; // Exit the loop if a valid prefix is found
}
}
}
convert_tensor((void*)target_buf,
tensor_storage.type,
convert_buf,
Expand Down
Loading