Skip to content

Commit 3569fe4

Browse files
committed
Fixing pre-hook errors.
Signed-off-by: Stanislaw Wozniak <[email protected]>
1 parent e472f94 commit 3569fe4

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

tests/models/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def check_available_online(
163163
{"1b": "EleutherAI/pythia-1.4b"}),
164164
"GraniteForCausalLM": _HfExamplesInfo("ibm/PowerLM-3b"),
165165
"GraniteMoeForCausalLM": _HfExamplesInfo("ibm/PowerMoE-3b"),
166-
"GraniteMoeHybridForCausalLM": _HfExamplesInfo("ibm-research/granite-4.0-tiny-test"),
166+
"GraniteMoeHybridForCausalLM": _HfExamplesInfo("ibm-research/granite-4.0-tiny-test"), # noqa: E501
167167
"GraniteMoeSharedForCausalLM": _HfExamplesInfo("ibm-research/moe-7b-1b-active-shared-experts"), # noqa: E501
168168
"Grok1ModelForCausalLM": _HfExamplesInfo("hpcai-tech/grok-1",
169169
trust_remote_code=True),

vllm/model_executor/models/granitemoehybrid.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ def __init__(
239239
rotary_dim=self.head_dim,
240240
max_position=config.max_position_embeddings,
241241
base=int(config.rope_theta),
242-
rope_scaling=config.rope_scaling if hasattr(config, "rope_scaling") \
242+
rope_scaling=config.rope_scaling \
243+
if hasattr(config, "rope_scaling") \
243244
and config.rope_scaling is not None else None,
244245
is_neox_style=True,
245246
)
@@ -404,7 +405,7 @@ def _load_expert(n, p, name, shard_id, expert_id):
404405
n = n.replace("A_log", "A")
405406

406407
# Logic analogous to: https://github.com/vllm-project/vllm/blob/f49e5aff11c986ed4d45202b1716c5d74786efa9/vllm/model_executor/models/granitemoeshared.py#L215
407-
# Mapping different experts' layout: from HF (input_linear, output_linear, router)
408+
# Mapping different experts' layout: from HF (input_linear, output_linear, router)
408409
# to vLLM (experts_w13({e}.w1, {e}.w2), experts_w3({e}.w3), gate)
409410
if n.endswith('.block_sparse_moe.input_linear.weight'):
410411
for e in range(p.size(0)):
@@ -425,7 +426,7 @@ def _load_expert(n, p, name, shard_id, expert_id):
425426
'.block_sparse_moe.output_linear.weight',
426427
f".block_sparse_moe.experts.{e}.w2.weight")
427428
w2_param = p[e]
428-
_load_expert(n.replace('.output_linear.', '.experts.w2_'),
429+
_load_expert(n.replace('.output_linear.', '.experts.w2_'),
429430
w2_param, w2_name, shard_id='w2', expert_id=e)
430431
elif n.endswith('.block_sparse_moe.router.layer.weight'):
431432
gate_name = n.replace('.block_sparse_moe.router.layer.weight',
@@ -437,8 +438,8 @@ def _load_expert(n, p, name, shard_id, expert_id):
437438
return loaded_params
438439

439440

440-
class GraniteMoeHybridForCausalLM(nn.Module, HasInnerState, SupportsLoRA, SupportsPP,
441-
IsHybrid, SupportsV0Only, SupportsQuant):
441+
class GraniteMoeHybridForCausalLM(nn.Module, HasInnerState, SupportsLoRA,
442+
SupportsPP, IsHybrid, SupportsV0Only, SupportsQuant):
442443
packed_modules_mapping = {}
443444
embedding_modules = {
444445
"embed_tokens": "input_embeddings",

vllm/model_executor/models/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"GPTNeoXForCausalLM": ("gpt_neox", "GPTNeoXForCausalLM"),
6666
"GraniteForCausalLM": ("granite", "GraniteForCausalLM"),
6767
"GraniteMoeForCausalLM": ("granitemoe", "GraniteMoeForCausalLM"),
68-
"GraniteMoeHybridForCausalLM": ("granitemoehybrid", "GraniteMoeHybridForCausalLM"),
68+
"GraniteMoeHybridForCausalLM": ("granitemoehybrid", "GraniteMoeHybridForCausalLM"), # noqa: E501
6969
"GraniteMoeSharedForCausalLM": ("granitemoeshared", "GraniteMoeSharedForCausalLM"), # noqa: E501
7070
"GritLM": ("gritlm", "GritLM"),
7171
"Grok1ModelForCausalLM": ("grok1", "Grok1ForCausalLM"),

0 commit comments

Comments
 (0)