You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of clip_model_load() seems incorrectly assigns mean and standard deviation values to the image_mean and image_std fields.
The existing code fetches data for all three color channels (presumably RGB) but fails to iterate through the retrieved arrays. This results in all channels being assigned the first value of the respective image_mean and image_std arrays.
The original code is as this:
int idx_mean = get_key_idx(ctx, KEY_IMAGE_MEAN);
int idx_std = get_key_idx(ctx, KEY_IMAGE_STD);
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));
}
To rectify this, the code should access the correct index within the retrieved arrays for each color channel, as shown below:
int idx_mean = get_key_idx(ctx, KEY_IMAGE_MEAN);
int idx_std = get_key_idx(ctx, KEY_IMAGE_STD);
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);
}
The text was updated successfully, but these errors were encountered:
The current implementation of
clip_model_load()
seems incorrectly assigns mean and standard deviation values to theimage_mean
andimage_std
fields.The existing code fetches data for all three color channels (presumably RGB) but fails to iterate through the retrieved arrays. This results in all channels being assigned the first value of the respective
image_mean
andimage_std
arrays.The original code is as this:
To rectify this, the code should access the correct index within the retrieved arrays for each color channel, as shown below:
The text was updated successfully, but these errors were encountered: