Skip to content

Commit

Permalink
Add attribute check to support git-base autotp (#6688)
Browse files Browse the repository at this point in the history
Git-base model is an image-text model. After supporting the llama3.2
vision model, we set num_kv_heads dynamically.
Git-base only includes vision_config, so we need to add an attribute
check for vision_config/text_config when setting num_kv_heads.

Co-authored-by: Logan Adams <[email protected]>
  • Loading branch information
Yejing-Lai and loadams authored Oct 31, 2024
1 parent 9b54731 commit c7f58c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deepspeed/module_inject/replace_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ def replace_wo_policy(module, all_reduce_linears, prefix="", state_dict=None):
if hasattr(model_config, "vision_config"):
if "MllamaVisionEncoderLayer" in str(module):
num_kv_heads = _autotp.get_model_num_kv_heads(model_config.vision_config)
else:
elif hasattr(model_config, "text_config"):
num_kv_heads = _autotp.get_model_num_kv_heads(model_config.text_config)
else:
num_kv_heads = _autotp.get_model_num_kv_heads(model_config)
else:
num_kv_heads = _autotp.get_model_num_kv_heads(model_config)

Expand Down

0 comments on commit c7f58c8

Please sign in to comment.