[MyPy] Fix mypy for vllm/lora (#41722)
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
This commit is contained in:
@@ -111,19 +111,27 @@ def try_get_optimal_moe_lora_config(
|
||||
# base MoE weight's block-wise quantization, so block_shape is omitted
|
||||
# from the config lookup — the non-quantized branch in get_default_config
|
||||
# ignores it anyway.
|
||||
config = try_get_optimal_moe_config(w1_shape, w2_shape, top_k, dtype, M).copy()
|
||||
raw_config = try_get_optimal_moe_config(w1_shape, w2_shape, top_k, dtype, M)
|
||||
config: dict[str, int | None] = dict(raw_config)
|
||||
if op_type in [
|
||||
"fused_moe_lora_w13_shrink",
|
||||
"fused_moe_lora_w2_shrink",
|
||||
]:
|
||||
block_size_n = config.get("BLOCK_SIZE_N")
|
||||
config["BLOCK_SIZE_N"] = min(
|
||||
config.get("BLOCK_SIZE_N", 64), next_power_of_2(rank)
|
||||
block_size_n if block_size_n is not None else 64,
|
||||
next_power_of_2(rank),
|
||||
)
|
||||
elif op_type in [
|
||||
"fused_moe_lora_w13_expand",
|
||||
"fused_moe_lora_w2_expand",
|
||||
]:
|
||||
block_size_k = config.get("BLOCK_SIZE_K")
|
||||
config["BLOCK_SIZE_K"] = max(
|
||||
16, min(config.get("BLOCK_SIZE_K", 32), next_power_of_2(rank))
|
||||
16,
|
||||
min(
|
||||
block_size_k if block_size_k is not None else 32,
|
||||
next_power_of_2(rank),
|
||||
),
|
||||
)
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user