fix(studio): strip color-font glyphs from READMEs on Linux - #9465
InfoSage05 wants to merge 5 commits into
Conversation
…etuning example with WER/CER metrics Adds explicit model routing for PaddlePaddle/PaddleOCR-VL-1.6 in the unsloth registry (org=PaddlePaddle, base_name=PaddleOCR, multimodal), disables compile optimization for this trust_remote_code model in loader.py, and provides a comprehensive finetuning example with WER/CER OCR benchmark evaluation via jiwer.
The Linux Complete AppImage (unslothai#9113) bundles its own WebKitGTK/Skia instead of using the host's. That bundled Skia build asserts and freezes the app when rendering a COLRv1 color font glyph, e.g. plain emoji or flags. Model Hub previews a repo's README as soon as its tab opens, and README content is arbitrary Hugging Face markdown that routinely contains exactly that. Strip pictographs, regional-indicator flag pairs, and the modifiers that force color-font rendering (VS-16, ZWJ, skin tones, flag tag characters) before the README reaches the renderer, gated to Linux only since Mac/Windows do not hit this renderer. Fixes unslothai#9453
hf-readme.ts imports @/-aliased modules that the plain `node --test`
runner cannot resolve, so a direct unit test on stripColorFontTriggers
failed with ERR_MODULE_NOT_FOUND. Moving the pure function to
color-font-triggers.ts (no aliased imports) makes it importable from
tests/, matching every other lib/*.test.ts in this suite.
Also swap the skin-tone modifier range for \p{Emoji_Modifier} to
satisfy no-misleading-character-class.
for more information, see https://pre-commit.ci
|
@danielhanchen please have a look at this! |
|
Confirmed the strip hooks into prepareReadmeBody in studio/frontend/src/features/hub/catalog/model-readme.tsx, and the reported assert comes from the AppImage's bundled Skia. This branch also carries the PaddleOCR registry and example additions, so could you split those out and keep the strip scoped to the AppImage rather than all Linux, since a distro WebKitGTK renders these glyphs fine? |
|
Thanks for the review! I've updated the branch with the requested changes:
|
|
Confirmed prepareReadmeBody in studio/frontend/src/features/hub/catalog/model-readme.tsx still passes raw README markdown straight through, so the Linux path from #9453 is untouched today. This branch also adds the PaddleOCR-VL example and registry entries, which are unrelated to the freeze, so could you split those out and leave just the hub README change here? |
|
The README strip in studio/frontend/src/features/hub/catalog/model-readme.tsx is keyed on deviceType === "linux", so every Linux install loses emoji in model cards even where the renderer is fine, and the branch also carries the PaddleOCR-VL registry and example. Could you narrow the gate to the affected bundled runtime and split the PaddleOCR work into its own PR? |
|
Main now avoids this crash in the Linux AppImage by bundling a CBDT emoji font and rejecting host COLRv1 fonts in studio/src-tauri/linux/appimage-fonts.conf (via #9473), so I do not think the README stripping is needed any more. Sorry for the slow review, and thanks for putting it together. |
Summary
Opening the Model Hub tab freezes the app on the Linux "Complete" AppImage (
0_1_801_beta), requiring a force-quit. The console shows a Skia assertion failure incolrv1_configure_skpaint-> which is an out-of-bounds vector access while rendering a COLRv1 color font glyph (plain emoji/flags). This regressed after #9113 switched the Linux AppImage from the host's own WebKitGTK to one bundled from the build machine, replacing whichever (working) WebKitGTK/Skia build each user's distro shipped with one specific build that appears to carry this bug.The Model Hub tab auto-previews the first row's README as soon as it opens (split view). READMEs are arbitrary Hugging Face markdown and routinely contain emoji/flags where it exactly what triggers the crash. This PR strips color-font-triggering characters (pictographs, regional-indicator flag pairs, VS-16, ZWJ, skin-tone modifiers, flag tag characters) from README content before it reaches the renderer, gated to Linux only so Mac/Windows keep rendering emoji as before.
Root Cause
The root cause is the Linux Complete AppImage's bundled WebKitGTK/Skia build asserting on a COLRv1 color-stop table (
colrv1_configure_skpaint,studio/src-tauripackaging from #9113) when the Model Hub tab's auto-previewed README (studio/frontend/src/features/hub/catalog/model-readme.tsx) renders ordinary emoji/flag characters from Hugging Face model card content.Changes
studio/frontend/src/features/hub/lib/color-font-triggers.ts(new): purestripColorFontTriggers()—> strips\p{Extended_Pictographic},\p{Regional_Indicator}(flag pairs),\p{Emoji_Modifier}(skin tones), VS-16, ZWJ, and flag tag characters. Kept dependency-free (no@/-aliased imports) so it is directly unit-testable.studio/frontend/src/features/hub/catalog/model-readme.tsx:prepareReadmeBody()now callsstripColorFontTriggers()on the README body, gated tousePlatformStore.getState().deviceType === "linux"only.studio/frontend/tests/hub-readme-color-font.test.ts(new): unit tests covering a plain pictograph emoji, a regional-indicator flag pair, a ZWJ family sequence, a VS-16 star/checkmark, and confirming plain markdown/code/links/arrows are left untouched.Reproduction
Reported in #9453: on the Linux Complete AppImage (
0_1_801_beta), opening the Model Hub tab freezes the app; only force-quit recovers. Console shows:Not independently reproduced in this environment (no Linux AppImage available here) and hence the fix targets the concrete, evidence-backed trigger (arbitrary emoji/flags in HF README content reaching a known-buggy bundled Skia build), verified via full frontend typecheck/build/test rather than an on-device repro.
Testing
Checklist
npm run typecheck)npm run build)npx eslint ...)Fixes #9453)Fixes #9453