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

Enabled and optimized GLM-4v-9b on Gaudi #691

Open
wants to merge 5 commits into
base: habana_main
Choose a base branch
from

Conversation

gyou2021
Copy link

@gyou2021 gyou2021 commented Jan 16, 2025

  1. Enabled the multimodal model GLM-4v-9b on Gaudi.
  2. Optimized the model:
    1. Removed graph recompile caused by the image and different batch size;
    2. Reduced tokenization times to once.

Example:
python examples/offline_inference_vision_language.py -m glm4v

output, _ = self.dense(out)

if is_hpu:
q = q.reshape(B, L, self.num_heads_per_rank,

Choose a reason for hiding this comment

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

define a HPUMultiHeadAttention to process this

Copy link
Author

Choose a reason for hiding this comment

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

Done. Thank you for your comments.

@@ -1,10 +1,10 @@
# Adapted from

Choose a reason for hiding this comment

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

Please revert file mode to 100644, same for other files.

@@ -963,7 +961,18 @@ def _prepare_prompt(
pad=0,
dtype=torch.long,
device='cpu')

if len(multi_modal_kwargs_list

Choose a reason for hiding this comment

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

@yma11 Please take a look

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

Successfully merging this pull request may close these issues.

2 participants