Skip to content

eplb draft #38

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

Open
wants to merge 12 commits into
base: zcx/eplb_layer_idx
Choose a base branch
from
Open
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
3,102 changes: 3,102 additions & 0 deletions ep_mapping_json_decode.json

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions ep_mapping_json_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import numpy as np
import json

# 配置参数
num_experts = 256
layers = 12 # 层数
np.random.seed(42) # 保持可复现

# 随机生成 weight:形状为 [layers, num_experts],每个专家处理 80~160 个 token
weight = np.random.randint(low=80, high=161, size=(layers, num_experts)).tolist()

# 构造数据
data = {
"num_groups": 4,
"num_nodes": 1,
"weight": weight # weight 的形状为 [layers, num_experts]
}

# 写入 JSON 文件
output_path = "/opt/workspace/workspace/lmdeploy_internLM/lmdeploy/ep_mapping_json_decode.json"
with open(output_path, "w") as f:
json.dump(data, f, indent=2)

# 打印信息
print("JSON 写入完成, weight 总和 =", np.sum(weight))
Loading