MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / plot_batch_scaling

Function plot_batch_scaling

benchmarking/plot-triton-bench.py:102–182  ·  view source on GitHub ↗
(bdf_long: pd.DataFrame)

Source from the content-addressed store, hash-verified

100
101
102def plot_batch_scaling(bdf_long: pd.DataFrame):
103 fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 3))
104 palette = _provider_palette(bdf_long["provider"])
105 markers = _provider_markers(bdf_long["provider"])
106
107 sns.lineplot(
108 bdf_long,
109 x="n_hidden_states",
110 y="time[ms]",
111 hue="provider",
112 style="provider",
113 markers=markers,
114 dashes=False,
115 ax=ax1,
116 palette=palette,
117 )
118 ax1.set_xscale("log")
119 ax1.set_yscale("log")
120 unique_n_hidden = sorted(bdf_long["n_hidden_states"].unique())
121 ax1.set_xticks(unique_n_hidden, labels=[int(x) for x in unique_n_hidden])
122 ax1.xaxis.set_minor_locator(plt.NullLocator())
123 yfmt = plt.ScalarFormatter()
124 yfmt.set_scientific(False)
125 ax1.yaxis.set_major_formatter(yfmt)
126 ax1.yaxis.set_minor_formatter(yfmt)
127 ax1.grid(alpha=0.5, which="both")
128 ax1.set_xlabel("Batch Size")
129 ax1.set_ylabel("Time (ms)")
130 ax1.annotate(
131 "lower is better",
132 xy=(0.98, 0.02),
133 xycoords="axes fraction",
134 ha="right",
135 va="bottom",
136 fontsize=8,
137 color="gray",
138 style="italic",
139 )
140 ax1.legend_.remove()
141
142 sns.lineplot(
143 bdf_long,
144 x="n_hidden_states",
145 y="samples/ms",
146 hue="provider",
147 style="provider",
148 markers=markers,
149 dashes=False,
150 ax=ax2,
151 palette=palette,
152 )
153 ax2.set_xscale("log")
154 ax2.set_xticks(unique_n_hidden, labels=[int(x) for x in unique_n_hidden])
155 ax2.xaxis.set_minor_locator(plt.NullLocator())
156 ax2.grid(alpha=0.5)
157 ax2.set_xlabel("Batch Size")
158 ax2.set_ylabel("Samples/ms")
159 ax2.annotate(

Callers 1

Calls 2

_provider_paletteFunction · 0.85
_provider_markersFunction · 0.85

Tested by

no test coverage detected