Skip to content

Commit f59f263

Browse files
authored
fix: readme and gen_backend_boilerplate (#2658)
1 parent a3ba09d commit f59f263

2 files changed

Lines changed: 75 additions & 9 deletions

File tree

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,39 @@ Lemonade supports multiple inference engines for LLM, speech, TTS, and image gen
246246
<td>Vulkan-capable GPUs</td>
247247
<td>Windows, Linux</td>
248248
</tr>
249+
<tr>
250+
<td rowspan="6"><strong>Audio generation</strong></td>
251+
<td rowspan="3"><code>thinksound</code> (experimental)</td>
252+
<td><code>rocm</code></td>
253+
<td>Supported AMD ROCm iGPU/dGPU families (ROCm via TheRock)</td>
254+
<td>Windows, Linux</td>
255+
</tr>
256+
<tr>
257+
<td><code>cuda</code></td>
258+
<td>NVIDIA GPUs</td>
259+
<td>Windows, Linux</td>
260+
</tr>
261+
<tr>
262+
<td><code>vulkan</code></td>
263+
<td>Vulkan-capable GPUs</td>
264+
<td>Windows, Linux</td>
265+
</tr>
266+
<tr>
267+
<td rowspan="3"><code>acestep</code> (experimental)</td>
268+
<td><code>rocm</code></td>
269+
<td>Supported AMD ROCm iGPU/dGPU families (ROCm via TheRock)</td>
270+
<td>Windows, Linux</td>
271+
</tr>
272+
<tr>
273+
<td><code>cuda</code></td>
274+
<td>NVIDIA GPUs</td>
275+
<td>Windows, Linux</td>
276+
</tr>
277+
<tr>
278+
<td><code>vulkan</code></td>
279+
<td>Vulkan-capable GPUs</td>
280+
<td>Windows, Linux</td>
281+
</tr>
249282
<tr>
250283
<td rowspan="5"><strong>Image generation</strong></td>
251284
<td rowspan="5"><code>sd-cpp</code></td>
@@ -273,6 +306,23 @@ Lemonade supports multiple inference engines for LLM, speech, TTS, and image gen
273306
<td>Apple Silicon GPU</td>
274307
<td>macOS</td>
275308
</tr>
309+
<tr>
310+
<td rowspan="3"><strong>3D generation</strong></td>
311+
<td rowspan="3"><code>trellis</code> (experimental)</td>
312+
<td><code>rocm</code></td>
313+
<td>Supported AMD ROCm iGPU/dGPU families (ROCm via TheRock)</td>
314+
<td>Windows, Linux</td>
315+
</tr>
316+
<tr>
317+
<td><code>cuda</code></td>
318+
<td>NVIDIA GPUs</td>
319+
<td>Windows, Linux</td>
320+
</tr>
321+
<tr>
322+
<td><code>vulkan</code></td>
323+
<td>Vulkan-capable GPUs</td>
324+
<td>Windows, Linux</td>
325+
</tr>
276326
</tbody>
277327
</table>
278328
<!-- END GENERATED: backends-matrix -->

docs/tools/gen_backend_boilerplate.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,15 @@ def md_escape(text: str) -> str:
124124
return str(text).replace("|", "\\|")
125125

126126

127+
# Preferred README ordering, not an allow-list. Modalities not listed here are
128+
# appended deterministically so future backends cannot be silently omitted.
127129
MODALITY_ORDER = [
128130
"Text generation",
129131
"Speech-to-text",
130132
"Text-to-speech",
133+
"Audio generation",
131134
"Image generation",
135+
"3D generation",
132136
]
133137
OS_LABEL = {"windows": "Windows", "linux": "Linux", "macos": "macOS"}
134138
OS_ORDER = ["windows", "linux", "macos"]
@@ -150,17 +154,31 @@ def _ordered(recipes: dict) -> list:
150154
return sorted(recipes.items(), key=lambda kv: kv[1].get("order", 999))
151155

152156

157+
def _ordered_modalities(by_mod: dict[str, list]) -> list[str]:
158+
"""Return known modalities first, then future modalities deterministically."""
159+
preferred = [mod for mod in MODALITY_ORDER if mod in by_mod]
160+
additional = sorted(set(by_mod) - set(MODALITY_ORDER))
161+
return preferred + additional
162+
163+
153164
def render_readme_matrix(recipes: dict) -> str:
154165
# Group descriptor-backed recipes by modality, in descriptor registry order.
155-
by_mod: dict[str, list] = {m: [] for m in MODALITY_ORDER}
166+
# MODALITY_ORDER controls presentation only; it must never filter recipes.
167+
by_mod: dict[str, list] = {}
156168
for recipe, info in _ordered(recipes):
157-
mod = info.get("modality")
158-
if not mod or mod not in by_mod:
169+
support_rows = info.get("support", [])
170+
if not support_rows:
159171
continue
172+
mod = info.get("modality")
173+
if not mod:
174+
sys.exit(
175+
f"Backend '{recipe}' has support rows but no documentation modality"
176+
)
177+
160178
# Merge support rows sharing a (backend, device summary); union their OS.
161179
merged: list[dict] = []
162180
seen: dict[tuple, dict] = {}
163-
for row in info.get("support", []):
181+
for row in support_rows:
164182
key = (row["backend"], row.get("device_summary", ""))
165183
if key in seen:
166184
seen[key]["os"] |= set(row.get("os", []))
@@ -173,7 +191,7 @@ def render_readme_matrix(recipes: dict) -> str:
173191
seen[key] = d
174192
merged.append(d)
175193
if merged:
176-
by_mod[mod].append((recipe, info, merged))
194+
by_mod.setdefault(mod, []).append((recipe, info, merged))
177195

178196
out = [
179197
"<table>",
@@ -188,11 +206,9 @@ def render_readme_matrix(recipes: dict) -> str:
188206
" </thead>",
189207
" <tbody>",
190208
]
191-
for mod in MODALITY_ORDER:
209+
for mod in _ordered_modalities(by_mod):
192210
recipes_in = by_mod[mod]
193-
if not recipes_in:
194-
continue
195-
mod_span = sum(len(m) for _, _, m in recipes_in)
211+
mod_span = sum(len(merged) for _, _, merged in recipes_in)
196212
first_mod = True
197213
for recipe, info, merged in recipes_in:
198214
engine = f"<code>{recipe}</code>" + (

0 commit comments

Comments
 (0)