Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@CISC
Copy link
Collaborator

@CISC CISC commented Nov 1, 2025

Required for proper handling of Qwen3-VL DeepStack embeds.

May change more than currently necessary for future use, f.ex. in llama-context (or maybe even not enough), please review carefully!

Fixes #16908

@65a
Copy link
Contributor

65a commented Nov 1, 2025

The hidden state size (e.g. for embeddings, control vectors) for Qwen3VL under Transformers is 5120, not 20480. It may be relevant here? I don't fully get what is supposed to happen with DeepStack embeds, but they aren't used during inference for normal embeddings, I think?

Tested this. It works correctly with a 1d cvector of the size 5120, and for basic MTMD use cases. Thanks!

@ngxson

This comment was marked as outdated.

@ngxson
Copy link
Collaborator

ngxson commented Nov 2, 2025

Hmm, please ignore what I said earlier.

Indeed, I think there is currently a misunderstanding here. The n_embd_full refer to the length of the input embedding, not the output. For example, I can have an input of n_embd_full = n_embd*4, but the model will always return n_embd as output. Therefore, this naming can be quite confusing.

I would suggest calling it n_embd_inp instead. Just need to pay attention to use n_embd when dealing with batch output.

@CISC CISC changed the title hparams : add n_embd_full to support extended embed hparams : add n_embd_inp() to support extended embed Nov 3, 2025
@CISC CISC requested review from ggerganov and ngxson November 3, 2025 21:16
const int n_embd = hparams.n_embd;
ggml_tensor * b = ggml_new_tensor_4d(ctx, GGML_TYPE_F32, n_embd, w->ne[1], 1, 1);
const int n_embd_inp = hparams.n_embd_inp();
ggml_tensor * b = ggml_new_tensor_4d(ctx, GGML_TYPE_F32, n_embd_inp, w->ne[1], 1, 1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm unsure if this is correct as well...

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think either n_embd_inp or n_embd should not be very important. at least for now, models that use this ops will have n_embd_inp == n_embd

@65a
Copy link
Contributor

65a commented Nov 7, 2025

I tested the latest commit in this series and it works for text and image processing successfully with a cvector applied.

@CISC
Copy link
Collaborator Author

CISC commented Nov 7, 2025

I tested the latest commit in this series and it works for text and image processing successfully with a cvector applied.

I will test again later today, but feel free to do so too before that.

@github-actions github-actions bot added the model Model specific label Nov 7, 2025
@65a
Copy link
Contributor

65a commented Nov 7, 2025

feel free to do so too before that.

Tested again on the latest commit. Seems to work great, MTMD and text work with a cvector applied. cvector is still working as expected.

@CISC CISC merged commit 9008027 into master Nov 7, 2025
63 of 69 checks passed
@CISC CISC deleted the cisc/support-extended-embd branch November 7, 2025 18:28
@CISC CISC mentioned this pull request Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples model Model specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: Control vectors for Qwen3VL fail due to n_embd size

5 participants