Conversation
There was a problem hiding this comment.
Python 模块命名通常不用数字开头.
Streamlit 1.28+ 推荐使用 st.navigation 而不是依赖文件系统顺序。
There was a problem hiding this comment.
推荐使用这种结构:
dashboard/
├── app.py
├── pages/
│ ├── init.py
│ ├── communication.py # 原 1_comm.py
│ ├── operator.py # 原 2_ops.py
│ └── inference.py # 原 3_infer.py
dashboard/pages/2_ops.py
Outdated
| project_root = Path(__file__).parent.parent | ||
| sys.path.append(str(project_root)) | ||
|
|
||
| from components.header import render_header | ||
| from utils.data_loader import InfiniMetricsDataLoader | ||
| from utils.visualizations import ( | ||
| create_summary_table_ops, | ||
| plot_timeseries_auto, | ||
| ) | ||
|
|
||
| st.set_page_config(page_title="算子测试分析 | InfiniMetrics", page_icon="⚡", layout="wide") | ||
|
|
||
| if "data_loader" not in st.session_state: | ||
| st.session_state.data_loader = InfiniMetricsDataLoader() |
There was a problem hiding this comment.
这部分在另外两个文件中也有,可以尝试抽成公共函数
创建 dashboard/common.py
# dashboard/common.py
import streamlit as st
import sys
from pathlib import Path
def init_page(page_title: str, page_icon: str):
"""通用页面初始化"""
project_root = Path(__file__).parent.parent
sys.path.append(str(project_root))
st.set_page_config(page_title=page_title, page_icon=page_icon, layout="wide")
if "data_loader" not in st.session_state:
from utils.data_loader import InfiniMetricsDataLoader
st.session_state.data_loader = InfiniMetricsDataLoader()
使用:
from common import init_page
from components.header import render_header
init_page("通信测试分析 | InfiniMetrics", "🔗")
render_header()
dashboard/pages/1_comm.py
Outdated
| # Run selector | ||
| st.markdown("### 选择测试运行") | ||
|
|
||
| # ✅ Run ID 模糊搜索(真正生效) |
dashboard/utils/visualizations.py
Outdated
| return fig | ||
|
|
||
|
|
||
| def plot_latency_vs_size( |
There was a problem hiding this comment.
这个函数跟plot_bandwidth_vs_size 很相似,可以合并一下
| st.markdown("---") | ||
| st.markdown("## 🧠 筛选条件") | ||
|
|
||
| ACCELERATOR_LABELS = { |
There was a problem hiding this comment.
看看能不能复用这个类:https://github.com/InfiniTensor/InfiniMetrics/blob/master/infinimetrics/common/constants.py#L15
这种显卡的枚举最好只在一个地方维护
| c3.metric( | ||
| "TTFT", f"{core['ttft_ms']:.2f} ms" if core["ttft_ms"] else "-" | ||
| ) |
baominghelly
left a comment
There was a problem hiding this comment.
可以参考一下我的comment改一下
| 通用页面初始化: | ||
| - 设置 Streamlit 页面配置 | ||
| - 初始化 DataLoader | ||
| - 设置项目路径 |
|
dashboard启动方式可以更新到docs/quickstart.md文件 |
描述:
新增 dashboard/ 目录,包含 Streamlit 可视化平台
支持通信测试(comm)、算子测试(ops)、推理测试(infer)分析页面
页面功能:筛选条件、Run ID 搜索、多运行对比、性能图表、数据表格、配置详情
结果展示:
1.在本地启动 Streamlit 服务:
2.打开浏览器访问 http://localhost:8506 就能看到 Dashboard 界面:
