Skip to content

Fix: CPU/AMD GPU support and Windows Japanese-username setup#243

Open
baysun2024-oss wants to merge 2 commits into
litagin02:masterfrom
baysun2024-oss:windows-jp-setup
Open

Fix: CPU/AMD GPU support and Windows Japanese-username setup#243
baysun2024-oss wants to merge 2 commits into
litagin02:masterfrom
baysun2024-oss:windows-jp-setup

Conversation

@baysun2024-oss

Copy link
Copy Markdown

Summary

This PR adds support for running Style-Bert-VITS2 on Windows machines with AMD GPUs (no NVIDIA/CUDA) and Japanese usernames, and fixes several issues encountered during setup and training.

Changes

Training scripts (train_ms.py, train_ms_jp_extra.py)

  • Guard all CUDA calls behind torch.cuda.is_available() 窶・training now works on CPU-only machines
  • Use gloo backend with USE_LIBUV=0 on Windows (CPU PyTorch builds lack libuv)
  • Replace all .cuda(local_rank) / .to(local_rank) calls with .to(device) where device is resolved at runtime
  • Fix DistributedDataParallel initialization to omit device_ids when running on CPU
  • Guard torch.cuda.empty_cache() calls

transcribe.py

  • Auto-detect CUDA availability for default --device and --compute_type arguments
  • Fall back to int8 when CPU is used with an incompatible float16/bfloat16 compute type

gradio_tabs/dataset.py

  • Same compute_type auto-detection for the WebUI transcription tab

style_bert_vits2/utils/subprocess.py

  • Set PYTHONIOENCODING=utf-8 in subprocess environment to prevent UnicodeDecodeError (Shift-JIS) on Japanese Windows

style_bert_vits2/models/utils/checkpoints.py

  • Pass weights_only=False to torch.load 窶・PyTorch 2.6 changed the default to True, which breaks loading existing checkpoints containing custom classes

requirements-custom.txt (new)

  • Filtered requirements file excluding torch, torchaudio, faster-whisper for use in CPU-only installs

setup_windows_jp.ps1 + SETUP_WINDOWS_JP.md (new)

  • Automated PowerShell setup script and manual guide for Windows + Japanese username environments
  • Covers: VC++ runtime, Python 3.10 to ASCII path (C:\Python310), uv venv creation, CPU torch install, all known quirks

Background

On Windows with a Japanese username (e.g. C:\Users\蟾昜ク願イエ螟ァ\), the standard setup fails because:

  • uv installs Python to a path with Japanese characters, breaking venv resolution
  • Subprocess encoding defaults to Shift-JIS on Japanese Windows
  • PyTorch 2.6 tightened torch.load defaults (CVE-2025-32434), breaking model loading

On AMD GPU machines with no CUDA, all training scripts assumed CUDA unconditionally.

Testing

Verified end-to-end on Windows 11 Pro with AMD Radeon GPU (CPU-only PyTorch 2.6.0+cpu):

  • All 5 preprocessing steps complete successfully
  • Training runs without errors (CPU, single process, gloo backend)

baysun2024 and others added 2 commits April 25, 2026 21:17
For environments where the Windows username contains non-ASCII characters
(e.g. Japanese), the standard uv-managed Python installation ends up in a
path like C:\Users\川上貴大\AppData\Roaming\uv\python\... which causes the
venv's python.exe to fail with "No Python at '...\????\...'" due to code
page issues in some PowerShell sessions.

This commit adds:
- setup_windows_jp.ps1: automated setup script that works around all
  known Windows/Japanese-username issues (ASCII Python path, CPU-only
  PyTorch, faster-whisper version pinning, soxr dependency, transformers
  4.x compatibility)
- SETUP_WINDOWS_JP.md: step-by-step manual guide covering the same
  workarounds with troubleshooting for each known error

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- train_ms.py, train_ms_jp_extra.py: guard all CUDA calls behind
  torch.cuda.is_available(); use gloo backend with USE_LIBUV=0 on
  Windows; replace .cuda(local_rank) with .to(device) throughout;
  fix DDP to omit device_ids when running on CPU; guard empty_cache()
- transcribe.py: auto-detect CUDA for default device/compute_type;
  fall back to int8 when CPU is used with a float16/bfloat16 type
- gradio_tabs/dataset.py: same compute_type auto-detection for WebUI
- style_bert_vits2/utils/subprocess.py: set PYTHONIOENCODING=utf-8
  in subprocess env to prevent Shift-JIS decode errors on Windows
- style_bert_vits2/models/utils/checkpoints.py: pass weights_only=False
  to torch.load (torch 2.6 changed the default; breaks model loading)
- setup_windows_jp.ps1, SETUP_WINDOWS_JP.md: update to torch 2.6.0+cpu
  (required by transformers 4.57+ CVE-2025-32434 security check)
- requirements-custom.txt: add filtered requirements excluding torch,
  torchaudio, faster-whisper to avoid CPU torch being overwritten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants