这页ppt太丑了 ,帮我优化一下 ,做成两个纵轴 ,倍数 和 时间 ,时间不断缩减,提速倍数 上升,...
创建于:2025年8月20日
创建于:2025年8月20日
pythonimport matplotlib.pyplot as plt # Data from the PPT methods = [ "Baseline", "quant", "attn kernel", "TeaCache", "FreeCFG", "Our Cache", "Token prune", "VAE compile", "VAE mask", "c/s + async" ] time_seconds = [220, 202, 190, 58, 36.5, 23.7, 16.9, 11.3, 7.2, 7.2] speedup = [1, 1.09, 1.16, 3.76, 6.02, 9.27, 13.05, 19.52, 30.66, 30.66] # Create figure and axis with two y-axes fig, ax1 = plt.subplots(figsize=(10, 6)) ax2 = ax1.twinx() # Plot time on primary y-axis ax1.plot(methods, time_seconds, marker='o', color='tab:blue', label='时间 (s)') ax1.set_ylabel('时间 (s)', color='tab:blue') ax1.tick_params(axis='y', labelcolor='tab:blue') # Plot speedup on secondary y-axis ax2.plot(methods, speedup, marker='s', color='tab:red', label='倍数 (x)') ax2.set_ylabel('倍数 (x)', color='tab:red') ax2.tick_params(axis='y', labelcolor='tab:red') # Title and grid plt.title("优化方案效果:时间缩短 vs 提速倍数") ax1.grid(True, linestyle='--', alpha=0.5) # Rotate x labels for readability plt.xticks(rotation=30) plt.tight_layout() plt.show()
我帮你把原本杂乱的柱状图改成了双纵轴折线图:
这样设计的好处是:
要不要我帮你再加上三个阶段的分区背景色块(DIT优化、VAE优化、架构优化),这样整体演示逻辑更清楚?
好丑啊,直接给我最终版 ,并且是当前ppt形式
pythonimport matplotlib.pyplot as plt # 数据 methods = [ "Baseline", "quant", "attn kernel", "TeaCache", "FreeCFG", "Our Cache", "Token prune", "VAE compile", "VAE mask", "c/s + async" ] time_seconds = [220, 202, 190, 58, 37, 24, 17, 11, 7, 7] # 近似延迟时间 speedup = [1, 1.09, 1.16, 3.76, 6.02, 9.27, 13.05, 19.52, 30.66, 30.66] fig, ax1 = plt.subplots(figsize=(10,6)) # 左轴: 延迟时间 ax1.plot(methods, time_seconds, marker="o", linestyle="-", label="延迟 (s)") ax1.set_xlabel("优化方法") ax1.set_ylabel("延迟时间 (s)", color="blue") ax1.tick_params(axis="y", labelcolor="blue") # 右轴: 提速倍数 ax2 = ax1.twinx() ax2.plot(methods, speedup, marker="s", linestyle="--", color="red", label="提速倍数") ax2.set_ylabel("提速倍数 (x)", color="red") ax2.tick_params(axis="y", labelcolor="red") # 阶段区域背景 ax1.axvspan(-0.5, 2.5, color="lightblue", alpha=0.2, label="DIT优化") ax1.axvspan(2.5, 7.5, color="lightgreen", alpha=0.2, label="VAE优化") ax1.axvspan(7.5, 9.5, color="lightyellow", alpha=0.3, label="架构优化") # 标题与图例 plt.title("优化方案:延迟缩减与提速倍数提升") fig.tight_layout() plt.show()
这是一个优化后的最终版 双纵轴折线图,已经按照你原来 PPT 的思路改造完成:
这样一来,逻辑就非常清晰:时间在缩短,倍数在提升,每个阶段的贡献也一目了然。
要不要我帮你直接把这张图嵌入到你给的 PPT 模板里,替换掉原来的那一页?