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

clip: Fix llama-llava-clip-quantize-cli quantization error under CUDA backend #12566

Merged
merged 2 commits into from
Mar 26, 2025

Conversation

Ivy233
Copy link
Contributor

@Ivy233 Ivy233 commented Mar 25, 2025

Link to issue 12564. This PR provides a possible solution, which is to move all the quantization processes to the CPU backend. Since it is not a real inference process, the performance does not seem to be so sensitive.

Make sure to read the contributing guidelines before submitting a PR

…t will cause ggml_fp16_to_fp32 to report an error when trying to access video memory. You need to switch to the CPU backend to run quantize.

After the fix, it will automatically run in the CPU backend and will no longer be bound to CUDA.
@@ -45,7 +45,7 @@ struct clip_context_params {
};

// deprecated, use clip_init
CLIP_API struct clip_ctx * clip_model_load(const char * fname, int verbosity);
CLIP_API struct clip_ctx * clip_model_load(const char * fname, const int verbosity=1, const bool use_gpu=true);
Copy link
Collaborator

@ngxson ngxson Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change the signature of this function, many downstream binding will break.

Instead, use clip_init and set use_gpu via clip_context_params

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the const int verbosity=1 will fail to compile in C, some users use this header file in C projects.

…nd change the call in clip_model_quantize to clip_init.
@Ivy233 Ivy233 requested a review from ngxson March 26, 2025 11:12
@ngxson ngxson merged commit 02082f1 into ggml-org:master Mar 26, 2025
48 checks passed
@Ivy233 Ivy233 deleted the fix-clip-quantize-use_gpu branch March 27, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants