Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mcore_bridge/model/gpts/deepseek_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def _set_param(self, param, tensor, scale_inv):
tensor = fp4_to_fp8(tensor)
tensor = tensor.reshape(*param.shape)
scale_inv = scale_inv.reshape(-1, scale_inv.shape[-1])
tensor = Fp8Dequantizer().convert(tensor, scale_inv)
tensor = Fp8Dequantizer(block_size='auto').convert(tensor, scale_inv)
if self._is_fp8_param(param):
param._high_precision_init_val.copy_(tensor)
param.data.copy_(tensor)
Expand Down
2 changes: 1 addition & 1 deletion src/mcore_bridge/model/mm_gpts/gemma4.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
from megatron.core.transformer.moe.moe_layer import MoELayer
from megatron.core.transformer.spec_utils import build_module
from megatron.core.utils import make_viewless_tensor, nvtx_range_pop, nvtx_range_push
from swift.utils import get_logger
from torch import Tensor, nn
from transformers import AutoModel, PretrainedConfig
from transformers.utils.versions import require_version
from typing import Optional, Tuple

from mcore_bridge.bridge import MultimodalGPTBridge
from mcore_bridge.config import ModelConfig
from mcore_bridge.utils import get_logger

from ..constant import ModelType
from ..gpt_model import GPTModel
Expand Down
4 changes: 3 additions & 1 deletion src/mcore_bridge/utils/dequantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

class Fp8Dequantizer:

def __init__(self, block_size: Tuple[int, int] = (None, None)):
def __init__(self, block_size: Tuple[int, int] = (128, 128)):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The type annotation for block_size is Tuple[int, int], but the implementation now accepts None and 'auto' as valid inputs. This mismatch will cause static type checkers (like mypy) to report errors. Update the type hint to accurately reflect the allowed types.

Suggested change
def __init__(self, block_size: Tuple[int, int] = (128, 128)):
def __init__(self, block_size: Union[Tuple[Optional[int], Optional[int]], str, None] = (128, 128)):

# Set to None to enable automatic selection.
if block_size in {None, 'auto'}:
block_size = (None, None)
self.block_size = block_size

def convert(
Expand Down
Loading