minor editorconfig-check fixes
This commit is contained in:
parent
1c88647ec6
commit
d981f19e9d
|
|
@ -643,7 +643,7 @@ static void save_tensor_to_file(const struct ggml_tensor * tensor, const uint8_t
|
||||||
append_str(" [");
|
append_str(" [");
|
||||||
for (int64_t i0 = 0; i0 < ne[0]; i0++) {
|
for (int64_t i0 = 0; i0 < ne[0]; i0++) {
|
||||||
size_t i = i3 * nb[3] + i2 * nb[2] + i1 * nb[1] + i0 * nb[0];
|
size_t i = i3 * nb[3] + i2 * nb[2] + i1 * nb[1] + i0 * nb[0];
|
||||||
float v;
|
float v;
|
||||||
if (type == GGML_TYPE_F16) {
|
if (type == GGML_TYPE_F16) {
|
||||||
v = ggml_fp16_to_fp32(*(ggml_fp16_t *) &data[i]);
|
v = ggml_fp16_to_fp32(*(ggml_fp16_t *) &data[i]);
|
||||||
} else if (type == GGML_TYPE_F32) {
|
} else if (type == GGML_TYPE_F32) {
|
||||||
|
|
@ -659,13 +659,15 @@ static void save_tensor_to_file(const struct ggml_tensor * tensor, const uint8_t
|
||||||
}
|
}
|
||||||
int len = snprintf(num_buf, sizeof(num_buf), "%8.4f", v);
|
int len = snprintf(num_buf, sizeof(num_buf), "%8.4f", v);
|
||||||
append(num_buf, len);
|
append(num_buf, len);
|
||||||
if (i0 < ne[0] - 1) append_str(", ");
|
if (i0 < ne[0] - 1) {
|
||||||
|
append_str(", ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
append_str("],\n");
|
append_str("],\n");
|
||||||
}
|
}
|
||||||
append_str(" ],\n");
|
append_str(" ],\n");
|
||||||
}
|
}
|
||||||
append_str(" ]"); // End of batch
|
append_str(" ]"); // End of batch
|
||||||
if (i3 < ne[3] - 1) {
|
if (i3 < ne[3] - 1) {
|
||||||
append_str(",\n"); // Comma between batches
|
append_str(",\n"); // Comma between batches
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -662,19 +662,19 @@ struct clip_graph {
|
||||||
|
|
||||||
ggml_cgraph * build_deepseek_ocr() {
|
ggml_cgraph * build_deepseek_ocr() {
|
||||||
//patch embedding
|
//patch embedding
|
||||||
ggml_tensor * inp_raw = build_inp_raw();
|
ggml_tensor * inp_raw = build_inp_raw();
|
||||||
ggml_tensor * sam_out = build_sam(inp_raw);
|
ggml_tensor * sam_out = build_sam(inp_raw);
|
||||||
ggml_tensor * clip_out = build_dsocr_clip(sam_out);
|
ggml_tensor * clip_out = build_dsocr_clip(sam_out);
|
||||||
|
|
||||||
int clip_n_patches = sam_out->ne[0] * sam_out->ne[1];
|
int clip_n_patches = sam_out->ne[0] * sam_out->ne[1];
|
||||||
|
|
||||||
sam_out = ggml_cont(ctx0, ggml_permute(ctx0, sam_out, 1, 2, 0, 3));
|
sam_out = ggml_cont(ctx0, ggml_permute(ctx0, sam_out, 1, 2, 0, 3));
|
||||||
sam_out = ggml_reshape_2d(ctx0, sam_out, sam_out->ne[0], clip_n_patches);
|
sam_out = ggml_reshape_2d(ctx0, sam_out, sam_out->ne[0], clip_n_patches);
|
||||||
clip_out = ggml_view_2d(ctx0, clip_out, n_embd, clip_n_patches, clip_out->nb[1], clip_out->nb[1]);
|
clip_out = ggml_view_2d(ctx0, clip_out, n_embd, clip_n_patches, clip_out->nb[1], clip_out->nb[1]);
|
||||||
|
|
||||||
ggml_tensor * cur;
|
ggml_tensor * cur;
|
||||||
cur = ggml_concat(ctx0, clip_out, sam_out, 0);
|
cur = ggml_concat(ctx0, clip_out, sam_out, 0);
|
||||||
cur = ggml_reshape_2d(ctx0, cur, 2*n_embd,clip_n_patches);
|
cur = ggml_reshape_2d(ctx0, cur, 2 * n_embd, clip_n_patches);
|
||||||
cur = ggml_cont(ctx0, cur);
|
cur = ggml_cont(ctx0, cur);
|
||||||
cur = ggml_mul_mat(ctx0, model.fc_w, cur);
|
cur = ggml_mul_mat(ctx0, model.fc_w, cur);
|
||||||
cur = ggml_add(ctx0, cur, model.fc_b);
|
cur = ggml_add(ctx0, cur, model.fc_b);
|
||||||
|
|
@ -687,10 +687,10 @@ struct clip_graph {
|
||||||
ggml_tensor * vs;
|
ggml_tensor * vs;
|
||||||
|
|
||||||
imgnl = ggml_repeat_4d(ctx0, model.image_newline, n_dim, 1, h, 1);
|
imgnl = ggml_repeat_4d(ctx0, model.image_newline, n_dim, 1, h, 1);
|
||||||
vs = ggml_reshape_2d(ctx0, model.view_seperator, n_dim, 1); // (n_dim, 1)
|
vs = ggml_reshape_2d(ctx0, model.view_seperator, n_dim, 1); // (n_dim, 1)
|
||||||
cur = ggml_reshape_3d(ctx0, cur, n_dim, w, h);
|
cur = ggml_reshape_3d(ctx0, cur, n_dim, w, h);
|
||||||
cur = ggml_reshape_2d(ctx0, ggml_concat(ctx0, cur, imgnl, 1), n_dim, (w+1)*h);
|
cur = ggml_reshape_2d(ctx0, ggml_concat(ctx0, cur, imgnl, 1), n_dim, (w + 1) * h);
|
||||||
cur = ggml_concat(ctx0, cur, vs, 1); // (n_dim, h*(w+1) + 1)
|
cur = ggml_concat(ctx0, cur, vs, 1); // (n_dim, h*(w+1) + 1)
|
||||||
|
|
||||||
cb(cur, "dsocr_output", -1);
|
cb(cur, "dsocr_output", -1);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue