Compare commits

...
Author SHA1 Message Date
yewentao256 a409cf42ce remove cuda graph copy
Signed-off-by: yewentao256 <zhyanwentao@126.com>
2025-12-22 21:13:20 +00:00
yewentao256 10cf1e482c reset 2025-12-22 21:12:46 +00:00
yewentao256 d9cba20ee0 Merge branch 'main' into wentao-fix-torch-compile-issue
Signed-off-by: yewentao256 <zhyanwentao@126.com>
2025-12-22 21:09:29 +00:00
yewentao256 a3da919005 reset 2025-12-22 21:09:07 +00:00
yewentao256 26e09a1cf7 fix torch inductor issue
Signed-off-by: yewentao256 <zhyanwentao@126.com>
2025-12-18 00:32:59 +00:00
4 changed files with 22 additions and 12 deletions
+7 -4
View File
@@ -113,8 +113,11 @@ class GraniteMoeMoE(nn.Module):
)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
# NOTE: hidden_states can have either 1D or 2D shape.
orig_shape = hidden_states.shape
assert hidden_states.dim() in (1, 2), (
"GraniteMoeMoE only supports 1D or 2D inputs"
)
num_tokens = hidden_states.shape[0]
is_input_1d = hidden_states.dim() == 1
hidden_states = hidden_states.view(-1, self.hidden_size)
if self.is_sequence_parallel:
@@ -128,10 +131,10 @@ class GraniteMoeMoE(nn.Module):
final_hidden_states = tensor_model_parallel_all_gather(
final_hidden_states, 0
)
num_tokens = orig_shape[0]
final_hidden_states = final_hidden_states[:num_tokens]
return final_hidden_states.view(orig_shape)
return final_hidden_states.squeeze(0) if is_input_1d else final_hidden_states
class GraniteMoeAttention(nn.Module):
+5 -3
View File
@@ -168,8 +168,10 @@ class Qwen2MoeSparseMoeBlock(nn.Module):
)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
# NOTE: hidden_states can have either 1D or 2D shape.
orig_shape = hidden_states.shape
assert hidden_states.dim() in (1, 2), (
"Qwen2MoeSparseMoeBlock only supports 1D or 2D inputs"
)
is_input_1d = hidden_states.dim() == 1
hidden_dim = hidden_states.shape[-1]
hidden_states = hidden_states.view(-1, hidden_dim)
@@ -185,7 +187,7 @@ class Qwen2MoeSparseMoeBlock(nn.Module):
final_hidden_states
)
return final_hidden_states.view(orig_shape)
return final_hidden_states.squeeze(0) if is_input_1d else final_hidden_states
class Qwen2MoeAttention(nn.Module):
+5 -3
View File
@@ -178,8 +178,10 @@ class Qwen3NextSparseMoeBlock(nn.Module):
)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
# NOTE: hidden_states can have either 1D or 2D shape.
orig_shape = hidden_states.shape
assert hidden_states.dim() in (1, 2), (
"Qwen3NextSparseMoeBlock only supports 1D or 2D inputs"
)
is_input_1d = hidden_states.dim() == 1
num_tokens, hidden_dim = hidden_states.shape
hidden_states = hidden_states.view(-1, hidden_dim)
@@ -211,7 +213,7 @@ class Qwen3NextSparseMoeBlock(nn.Module):
final_hidden_states
)
return final_hidden_states.view(orig_shape)
return final_hidden_states.squeeze(0) if is_input_1d else final_hidden_states
class Qwen3NextGatedDeltaNet(nn.Module, MambaBase):
+5 -2
View File
@@ -85,7 +85,10 @@ class FusedMoEBlock(nn.Module):
)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
orig_shape = hidden_states.shape
assert hidden_states.dim() in (1, 2), (
"FusedMoEBlock only supports 1D or 2D inputs"
)
is_input_1d = hidden_states.dim() == 1
hidden_dim = hidden_states.shape[-1]
hidden_states = hidden_states.view(-1, hidden_dim)
@@ -97,7 +100,7 @@ class FusedMoEBlock(nn.Module):
if self.tp_size > 1:
final_hidden_states = tensor_model_parallel_all_reduce(final_hidden_states)
return final_hidden_states.view(orig_shape)
return final_hidden_states.squeeze(0) if is_input_1d else final_hidden_states
class Step3TextMLP(nn.Module):