MCPcopy Create free account
hub / github.com/ckd0817/LLM-Interview-Code / MoE

Class MoE

ffn/MoE.py:15–116  ·  view source on GitHub ↗

混合专家模型模块 结构: 1. Router: 计算每个 token 对每个专家的得分 2. Top-K 选择: 选择得分最高的 K 个专家 3. 专家计算: 被选中的专家对 token 进行处理 4. 加权融合: 根据路由得分加权融合专家输出 Args: model_dim: 输入/输出维度 num_experts: 专家数量 top_k: 每个 token 激活的专家数量

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

MoE.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected