[ROCm] Fix and optimize GPT-J-style MRoPE (#49906)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
@@ -38,6 +38,7 @@ def generate_test_data(
|
||||
|
||||
class MRoPETestInfo(NamedTuple):
|
||||
model_name: str
|
||||
is_neox_style: bool = True
|
||||
# https://github.com/pytorch/pytorch/blob/main/torch/testing/_comparison.py#L1317
|
||||
atol: float = 1e-2
|
||||
rtol: float = 1.6e-2
|
||||
@@ -45,7 +46,10 @@ class MRoPETestInfo(NamedTuple):
|
||||
|
||||
|
||||
MODELS_TO_TEST = [
|
||||
MRoPETestInfo(model_name="zai-org/GLM-4.1V-9B-Thinking"),
|
||||
MRoPETestInfo(
|
||||
model_name="zai-org/GLM-4.1V-9B-Thinking",
|
||||
is_neox_style=False,
|
||||
),
|
||||
MRoPETestInfo(model_name="Qwen/Qwen2-VL-7B-Instruct"),
|
||||
MRoPETestInfo(model_name="Qwen/Qwen2-VL-72B-Instruct"),
|
||||
MRoPETestInfo(model_name="Qwen/Qwen2.5-VL-72B-Instruct"),
|
||||
@@ -92,7 +96,7 @@ def test_mrope(
|
||||
if hasattr(config, "head_dim")
|
||||
else config.hidden_size // total_num_heads
|
||||
)
|
||||
is_neox_style = True
|
||||
is_neox_style = model_info.is_neox_style
|
||||
|
||||
max_position = config.max_position_embeddings
|
||||
|
||||
@@ -162,7 +166,7 @@ def test_mrope_torch_compile_tracing(
|
||||
if hasattr(config, "head_dim")
|
||||
else config.hidden_size // total_num_heads
|
||||
)
|
||||
is_neox_style = True
|
||||
is_neox_style = model_info.is_neox_style
|
||||
max_position = config.max_position_embeddings
|
||||
|
||||
mrope_helper_class = get_rope(
|
||||
|
||||
Reference in New Issue
Block a user