8000 Update python verions by robbiemu · Pull Request #13574 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

Update python verions #13574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
91b5d14
Updates Python and torch versions
robbiemu May 15, 2025
c99863b
Updates torchvision dependency
robbiemu May 15, 2025
ef77f28
Updates NumPy dependency to version 2.1 or higher
robbiemu May 15, 2025
c278aff
pyright-based changes for tools/mtmd/legacy-models/convert_image_enc…
robbiemu May 16, 2025
a6ab097
Fixes type annotation for numpy arrays
robbiemu May 16, 2025
eb7cef1
Updates type hints for numpy compatibility
robbiemu May 16, 2025
150f157
Better fix than earlier for quants.py
robbiemu May 16, 2025
822c83c
Several types in numpy 2.2+ are defined as typeAliases with no underl…
robbiemu May 16, 2025
4cfda13
revert change from NDArray in this file
robbiemu May 19, 2025
2f3854c
Updates pyright 8000 configuration
robbiemu May 19, 2025
eb6499c
Revert tools/mtmd/ to match master
robbiemu May 19, 2025
ba079d3
Revert "Revert tools/mtmd/ to match master"
robbiemu May 19, 2025
1434730
reverting change to legacy-models script
robbiemu May 19, 2025
afd66e9
Excludes legacy models from type checking
robbiemu May 19, 2025
6ee8253
Configures pyright to ignore invalid type forms
robbiemu May 19, 2025
d49b004
Uses `np.dtype` for NumPy type hints in GGUF reader
robbiemu May 19, 2025
a5c74dd
reverting removal of DTypeLike changes
robbiemu May 19, 2025
3400755
Fixes byteorder check and removes unrequested exclusion tests
robbiemu May 19, 2025
4802d01
reverting unnecessary changes in gguf-py/gguf as of numpy 2.2.6
robbiemu May 20, 2025
0570f17
pyrightconfig.json
robbiemu May 20, 2025
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
Prev Previous commit
Next Next commit
Revert "Revert tools/mtmd/ to match master"
This reverts commit eb6499c.
  • Loading branch information
robbiemu committed May 19, 2025
commit ba079d3dbaa8a3b2c026192773c7a14a8905d2e3
74 changes: 1 addition & 73 deletions tools/mtmd/clip-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <climits>
#include <cstdarg>
#include <cinttypes>
#include <string>
#include <map>
#include <sstream>
Expand Down Expand Up @@ -45,7 +44,7 @@
// tensor name constants
//

#define TN_POS_EMBD "v.position_embd.weight"
#define TN_POS_EMBD "%s.position_embd.weight"
#define TN_CLASS_EMBD "v.class_embd"
#define TN_PATCH_EMBD "v.patch_embd.weight" // not rename tensor with ".0" postfix for backwrad compat
#define TN_PATCH_EMBD_1 "v.patch_embd.weight.1"
Expand Down Expand Up @@ -111,7 +110,6 @@ enum projector_type {
PROJECTOR_TYPE_PIXTRAL,
PROJECTOR_TYPE_QWEN25VL,
PROJECTOR_TYPE_INTERNVL,
PROJECTOR_TYPE_LLAMA4,
PROJECTOR_TYPE_UNKNOWN,
};

Expand All @@ -127,7 +125,6 @@ static std::map<projector_type, std::string> PROJECTOR_TYPE_NAMES = {
{ PROJECTOR_TYPE_IDEFICS3, "idefics3"},
{ PROJECTOR_TYPE_PIXTRAL, "pixtral"},
{ PROJECTOR_TYPE_INTERNVL, "internvl"},
{ PROJECTOR_TYPE_LLAMA4, "llama4"},
};

static projector_type clip_projector_type_from_string(const std::string & str) {
Expand Down Expand Up @@ -243,11 +240,6 @@ struct clip_image_u8_batch {
struct clip_image_f32_batch {
std::vector<clip_image_f32_ptr> entries;

// for llava-uhd style models, we need to know the grid size
// note: entries.size() == grid_x * grid_y + 1 (one overview image)
int grid_x = 0;
int grid_y = 0;

clip_image_f32_batch clone() const {
clip_image_f32_batch new_batch;
new_batch.entries.reserve(entries.size());
Expand Down 8000 Expand Up @@ -366,70 +358,6 @@ static std::string gguf_kv_to_str(const struct gguf_context * ctx_gguf, int i) {
}
}

//
// debugging
//

static void print_tensor_shape(ggml_tensor * t) {
printf("%s.shape = [", t->name);
for (int i = 0; i < ggml_n_dims(t); ++i) {
printf("%" PRId64, t->ne[i]);
if (i < ggml_n_dims(t) - 1) {
printf(", ");
}
}
printf("]\n");
}

static void print_tensor_data(ggml_tensor * t, uint8_t * data, int64_t n) {
ggml_type type = t->type;
int64_t * ne = t->ne;
size_t * nb = t->nb;
for (int64_t i3 = 0; i3 < ne[3]; i3++) {
printf("%s.data: [\n", t->name);
for (int64_t i2 = 0; i2 < ne[2]; i2++) {
if (i2 == n && ne[2] > 2*n) {
printf(" ..., \n");
i2 = ne[2] - n;
}
printf(" [\n");
for (int64_t i1 = 0; i1 < ne[1]; i1++) {
if (i1 == n && ne[1] > 2*n) {
printf(" ..., \n");
i1 = ne[1] - n;
}
printf(" [");
for (int64_t i0 = 0; i0 < ne[0]; i0++) {
if (i0 == n && ne[0] > 2*n) {
printf("..., ");
i0 = ne[0] - n;
}
size_t i = i3 * nb[3] + i2 * nb[2] + i1 * nb[1] + i0 * nb[0];
float v;
if (type == GGML_TYPE_F16) {
v = ggml_fp16_to_fp32(*(ggml_fp16_t *) &data[i]);
} else if (type == GGML_TYPE_F32) {
v = *(float *) &data[i];
} else if (type == GGML_TYPE_I32) {
v = (float) *(int32_t *) &data[i];
} else if (type == GGML_TYPE_I16) {
v = (float) *(int16_t *) &data[i];
} else if (type == GGML_TYPE_I8) {
v = (float) *(int8_t *) &data[i];
} else {
GGML_ABORT("fatal error");
}
printf("%8.4f", v);
if (i0 < ne[0] - 1) printf(", ");
}
printf("],\n");
}
printf(" ],\n");
}
printf(" ]\n");
}
}

//
// API used internally with mtmd
//
Expand Down
Loading
Loading
0