TFLite: Windows support + cross-platform CI (supersedes #66)#67
Merged
Conversation
… dispatch
- weights.py: ensure_local materializes files via symlink -> hardlink -> copy
(Windows without Developer Mode can't create symlinks, WinError 1314);
prints which fallback was used the first time one occurs
- sa3_tflite.py / install.py / examples.py: guarded stdout/stderr
reconfigure(encoding=utf-8) so box-drawing/emoji banners survive legacy
cp1252 consoles, plus os.system('') on nt to enable ANSI/VT in cmd.exe
- sa3_tflite.py: --play now dispatches per platform (afplay on macOS,
stdlib winsound on Windows, aplay on Linux with a printed-path fallback);
dispatcher split into _play_backend() for import-testing
- platform-aware ffmpeg/python install hints (brew / apt / winget);
examples.py knows .venv\Scripts\python.exe and sa3.bat on Windows
All changes are no-ops on macOS/Linux.
- sa3.bat / install.bat: batch twins of ./sa3 and ./install.sh — plain python -m venv + pip (no uv), prefer .venv\Scripts\python.exe, forward all args; CRLF-pinned via a scoped .gitattributes - README: Windows subsection under Install (install.bat / sa3.bat usage, ai-edge-litert win_amd64 wheels for Python 3.10-3.13, optional ffmpeg via winget/choco, LongPathsEnabled registry note for deep HF-cache paths); --play wording updated to the per-platform players
New workflow runs on every OS ai-edge-litert ships wheels for (manylinux
x86_64 + aarch64, win_amd64, macosx_12_0_arm64 — hence no macos-13 and no
windows-arm): pip install requirements, byte-compile all scripts, import the
LiteRT Interpreter, then run scripts/test_windows_compat.py (stdlib unittest,
no model downloads):
1. ensure_local link-or-copy fallback with a monkeypatched hf_hub_download
(incl. forced symlink-privilege failure and forced hardlink failure)
2. sa3_tflite.py --help + the examples block in fresh interpreters with
PYTHONUTF8/PYTHONIOENCODING stripped (native console code page)
3. --play backend dispatch per platform without playing audio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows support for the TFLite route, with a cross-platform CI matrix proving it. Supersedes #66 — @betweentwomidnights' commit is included verbatim (cherry-picked, authorship preserved); if squash-merging, please keep the
Co-authored-by: betweentwomidnights <b2mkevin@gmail.com>trailer.What's fixed
termios/ttyimport guard (Support TFLite CLI on Windows #66): the CLI now starts on Windows; the model picker uses the numeric fallback there (arrow keys stay on POSIX).ensure_localnow tries symlink → hardlink (os.link, privilege-free, zero-copy) →shutil.copy2. On stock Windows (no Developer Mode) the oldsymlink_toraised WinError 1314 on the very first lazy download — every fresh install hit it.━ ▸ ▶ ✓ ⚠ ↓+ emoji) crashed withUnicodeEncodeErroron cp1252 consoles. Guardedsys.stdout/stderr.reconfigure(encoding="utf-8", errors="replace")in the three entry scripts;os.system("")on NT enables VT colors in legacy cmd.--play: platform dispatch —afplay(macOS, unchanged),winsound.PlaySound(Windows, stdlib),aplayor print-the-path (Linux).sa3.bat+install.bat(CRLF-pinned via a scoped.gitattributes) and a README Windows section (ai-edge-litert shipswin_amd64wheels for Py 3.10–3.13; winget/choco ffmpeg;LongPathsEnablednote). Error hints are platform-aware instead of brew-only.sys.executable.split('/'), examples' invocation strings).Everything is a guarded no-op on macOS/Linux.
CI:
.github/workflows/tflite-cross-platform.ymlMatrix = exactly the ai-edge-litert wheel-support envelope:
ubuntu-latest,ubuntu-24.04-arm,windows-latest,macos-latest(no macOS-Intel / Windows-ARM wheels exist). Per OS: install requirements,py_compileall scripts, LiteRT import, and a 9-test stdlib suite with zero model downloads — including a forced WinError-1314 symlink failure (asserting the hardlink/copy chain),--help+ the emoji examples run in fresh interpreters withPYTHONUTF8/PYTHONIOENCODINGstripped (genuinely exercising the encoding fix on the runners' native pipes), and per-platform--playdispatch selection. ~1.5 runner-minutes per push touchingoptimized/tflite/**.All four jobs green on the first run: https://github.com/Stability-AI/stable-audio-3/actions/runs/29368663141 (windows-latest: 9/9 tests, hardlink fallback confirmed in the log).
Not verifiable without an interactive Windows box
Actual
winsoundplayback (dispatch is tested, audio out isn't), the interactive feel of the numeric picker and.batflows, and unprivileged real-HF downloads (the forced-failure test covers the chain deterministically). A quick smoke from any Windows user would close these.