Skip to content
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

image_mean and image_std are not read properly from gguf file #104

Open
herf opened this issue Oct 9, 2024 · 0 comments
Open

image_mean and image_std are not read properly from gguf file #104

herf opened this issue Oct 9, 2024 · 0 comments

Comments

@herf
Copy link

herf commented Oct 9, 2024

Around L539 in clip.cpp:

        for (int i = 0; i < 3; ++i) {
            new_clip->image_mean[i] = *((float *)gguf_get_arr_data(ctx, idx_mean));
            new_clip->image_std[i] = *((float *)gguf_get_arr_data(ctx, idx_std));
        }

This code will read the mean[0] and std[0] into all three members (rather than the actual vector[3]).

It should say:

        for (int i = 0; i < 3; ++i) {
            new_clip->image_mean[i] = ((float *)gguf_get_arr_data(ctx, idx_mean))[i];
            new_clip->image_std[i] = ((float *)gguf_get_arr_data(ctx, idx_std))[i];
        }

Probably should also validate the array size before doing this - is gguf_get_arr_n() "length"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant