[Fix] GigaChat 3.5: build the stage boundaries once (#42480)
This commit is contained in:
@@ -2614,6 +2614,7 @@ class DeepseekV2DecoderLayer(nn.Module):
|
||||
prefix: str = "",
|
||||
alt_stream: Optional[torch.cuda.Stream] = None,
|
||||
skip_rope: bool = False,
|
||||
build_stages: bool = True,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.hidden_size = config.hidden_size
|
||||
@@ -2709,11 +2710,13 @@ class DeepseekV2DecoderLayer(nn.Module):
|
||||
|
||||
self._gfx95_quant_format = self._detect_gfx95_quant_format()
|
||||
|
||||
self.attn_boundary, self.ffn_boundary = self._build_stages(
|
||||
input_layernorm=self.input_layernorm,
|
||||
post_attention_layernorm=self.post_attention_layernorm,
|
||||
qkv_latent_func=self.self_attn.prepare_qkv_latent,
|
||||
)
|
||||
# A subclass that brings its own norms builds the stages after them.
|
||||
if build_stages:
|
||||
self.attn_boundary, self.ffn_boundary = self._build_stages(
|
||||
input_layernorm=self.input_layernorm,
|
||||
post_attention_layernorm=self.post_attention_layernorm,
|
||||
qkv_latent_func=self.self_attn.prepare_qkv_latent,
|
||||
)
|
||||
|
||||
def _build_stages(
|
||||
self,
|
||||
|
||||
@@ -365,6 +365,7 @@ class GigaChat35DecoderLayer(deepseek_v2.DeepseekV2DecoderLayer):
|
||||
is_nextn=is_nextn,
|
||||
prefix=prefix,
|
||||
alt_stream=alt_stream,
|
||||
build_stages=False,
|
||||
)
|
||||
|
||||
attn_layer_id = config.num_hidden_layers if is_nextn else layer_id
|
||||
|
||||
Reference in New Issue
Block a user