Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a unit test for MoE layer. #7069

Merged
merged 1 commit into from
May 16, 2024
Merged

Add a unit test for MoE layer. #7069

merged 1 commit into from
May 16, 2024

Conversation

qihqi
Copy link
Collaborator

@qihqi qihqi commented May 15, 2024

No description provided.

@qihqi qihqi requested a review from lsy323 May 15, 2024 23:12
@lsy323 lsy323 merged commit 8247aec into master May 16, 2024
3 checks passed
self.w3 = nn.Parameter(torch.empty(config.num_experts, config.intermediate_size, config.dim))

def forward(self, x: Tensor, expert_indices: Tensor) -> Tensor:
w1_weights = self.w1[expert_indices] # [T, A, D, D]
Copy link
Collaborator

Choose a reason for hiding this comment

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

The memory consumption here seems pretty high? It's like you have num_token duplicated weights? So this will not introduce extra storage? Or maybe you are just considering inference where T is just 1?

zpcore pushed a commit that referenced this pull request May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants