mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 11:26:34 +00:00
fix: load INT8 convrot LLM embeddings correctly (#2067)
This commit is contained in:
1 parent
47e83d7136
commit
ede32a621e
4 files changed
+91
-12
No files matched your search
+10
-1
@@ -79,6 +79,10 @@ static bool device_supports_param_op(ggml_backend_dev_t device,
|
||||
if (op == GGML_OP_GET_ROWS) {
|
||||
ggml_tensor* indices = ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 1);
|
||||
op_tensor = ggml_get_rows(ctx, weight, indices);
|
||||
} else if (op == GGML_OP_CUSTOM) {
|
||||
op_tensor = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 1);
|
||||
op_tensor->op = op;
|
||||
op_tensor->src[0] = weight;
|
||||
}
|
||||
if (op_tensor == nullptr) {
|
||||
ggml_free(ctx);
|
||||
@@ -507,7 +511,9 @@ bool ModelManager::stage_tensors_to_compute_backend(const std::vector<TensorStat
|
||||
LOG_ERROR("model manager params backend is null for tensor '%s'", state->name.c_str());
|
||||
return false;
|
||||
}
|
||||
if (state->compute_backend == state->params_backend || state->staged_to_compute_backend) {
|
||||
// Custom CPU operators must retain host weights even when the runner uses a GPU.
|
||||
if (state->usage_op == GGML_OP_CUSTOM ||
|
||||
state->compute_backend == state->params_backend || state->staged_to_compute_backend) {
|
||||
continue;
|
||||
}
|
||||
if (!state->loaded_to_params_backend || state->tensor == nullptr || state->tensor->data == nullptr) {
|
||||
@@ -1402,6 +1408,9 @@ size_t ModelManager::compute_backend_alloc_size(const std::vector<TensorState*>&
|
||||
if (state == nullptr || state->tensor == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (state->usage_op == GGML_OP_CUSTOM && !sd_backend_is_cpu(state->compute_backend)) {
|
||||
continue;
|
||||
}
|
||||
const bool compute_resident =
|
||||
state->compute_backend == state->params_backend
|
||||
? state->loaded_to_params_backend
|
||||
|
||||
Reference in new issue
Block a user