mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-07-31 15:20:41 -05:00
fix: correct the handling of weight loading
This commit is contained in:
@@ -2864,6 +2864,8 @@ class StableDiffusionGGML {
|
||||
nelements *= ne[i];
|
||||
}
|
||||
|
||||
const size_t num_bytes = nelements / ggml_blck_size(ggml_type(ttype)) * ggml_type_size(ggml_type(ttype));
|
||||
|
||||
std::string name(length, 0);
|
||||
file.read(&name[0], length);
|
||||
|
||||
@@ -2891,7 +2893,7 @@ class StableDiffusionGGML {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
file.ignore(nelements * ggml_type_size((ggml_type)ttype));
|
||||
file.ignore(num_bytes);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2919,8 +2921,6 @@ class StableDiffusionGGML {
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t num_bytes = nelements / ggml_blck_size(ggml_type(ttype)) * ggml_type_size(ggml_type(ttype));
|
||||
|
||||
file.read(reinterpret_cast<char*>(tensor->data), num_bytes);
|
||||
|
||||
total_size += ggml_nbytes(tensor);
|
||||
|
||||
Reference in New Issue
Block a user