-
Notifications
You must be signed in to change notification settings - Fork 310
bugfix: vlm models(language-only part) inference error, without --ena… #1230
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,12 @@ def context_forward( | |
|
|
||
| from lightllm.server.router.model_infer.infer_batch import g_infer_context | ||
|
|
||
| cpu_embed_cache_tensor = g_infer_context.cpu_embed_cache_client.cpu_embed_cache_tensor | ||
| cpu_embed_cache_client = g_infer_context.cpu_embed_cache_client | ||
| cpu_embed_cache_tensor = ( | ||
| torch.empty((0, 0, hidden_size), dtype=dtype, device=device) | ||
| if cpu_embed_cache_client is None | ||
| else cpu_embed_cache_client.cpu_embed_cache_tensor | ||
| ) | ||
|
Comment on lines
+37
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| infer_state.cpu_embed_cache_tensor = cpu_embed_cache_tensor | ||
|
|
||
| assert cpu_embed_cache_tensor.shape[2] == hidden_size, ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,12 @@ def context_forward(self, input_ids, infer_state: LlamaInferStateInfo, layer_wei | |
|
|
||
| from lightllm.server.router.model_infer.infer_batch import g_infer_context | ||
|
|
||
| cpu_embed_cache_tensor = g_infer_context.cpu_embed_cache_client.cpu_embed_cache_tensor | ||
| cpu_embed_cache_client = g_infer_context.cpu_embed_cache_client | ||
| cpu_embed_cache_tensor = ( | ||
| torch.empty((0, 0, hidden_size), dtype=dtype, device=device) | ||
| if cpu_embed_cache_client is None | ||
| else cpu_embed_cache_client.cpu_embed_cache_tensor | ||
| ) | ||
|
Comment on lines
+51
to
+56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic for safely initializing |
||
|
|
||
| assert cpu_embed_cache_tensor.shape[2] == hidden_size, ( | ||
| f"Dimension mismatch: text weight dimension is {hidden_size}, " | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this logic correctly handles the case where
cpu_embed_cache_clientisNone, it is duplicated inqwen3_vlandqwen_vlpre-layer inference files. To improve maintainability and avoid repeating code, consider extracting this logic into a shared helper method in the base classLlamaMultimodalPreLayerInfer.