set z3 leaf for deepseek v2 (#1809) [skip ci]

* set z3 leaf for deepseek v2

* add deepseek v2 chat template
This commit is contained in:
Wing Lian
2024-08-06 09:30:46 -04:00
committed by GitHub
parent fbbeb4fee0
commit 35d5e59d78
5 changed files with 10 additions and 3 deletions

View File

@@ -25,12 +25,12 @@ SUPPORTED_MULTIPACK_MODEL_TYPES = [
]
def patch_for_multipack(model_type, model_name=None):
def patch_for_multipack(model_type, model_name=None, is_remote_code=False):
if model_type == "gemmoe":
patch_remote(model_name, ".configuration_gemmoe", ".modeling_gemmoe")
elif model_type == "deepseek_v2":
patch_remote(model_name, ".configuration_deepseek", ".modeling_deepseek")
elif hasattr(transformers, "modeling_flash_attention_utils"):
elif hasattr(transformers, "modeling_flash_attention_utils") and not is_remote_code:
transformers.modeling_flash_attention_utils._get_unpad_data = ( # pylint: disable=protected-access
get_unpad_data
)