Skip to content

feat: HuggingFace Hub auto-download and sample rate defaults - #376

Open
bluecrystaladmin wants to merge 2 commits into
OpenBMB:mainfrom
bluecrystalsolutions:pr/hf-training
Open

feat: HuggingFace Hub auto-download and sample rate defaults#376
bluecrystaladmin wants to merge 2 commits into
OpenBMB:mainfrom
bluecrystalsolutions:pr/hf-training

Conversation

@bluecrystaladmin

Copy link
Copy Markdown

Fixes #375

Add snapshot_download() resolution for pretrained_path so users can specify a HF model ID (e.g., 'openbmb/VoxCPM2') directly.

Changes:

  • Default pretrained_path falls back to Hub ID when no local dirs exist
  • _resolve_pretrained_path() helper downloads from Hub on first use
  • Training and inference resolve path before reading config.json
  • Default sample_rate corrected to 16000 (matches AudioVAE expectation)

Enables zero-setup usage: the WebUI auto-downloads the model on first run.

Add snapshot_download() resolution for pretrained_path so users can
specify a HF model ID (e.g., 'openbmb/VoxCPM2') directly.

Changes:
- Default pretrained_path falls back to Hub ID when no local dirs exist
- _resolve_pretrained_path() helper downloads from Hub on first use
- Training and inference resolve path before reading config.json
- Default sample_rate corrected to 16000 (matches AudioVAE expectation)

Enables zero-setup usage: the WebUI auto-downloads the model on first run.
@a710128

a710128 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Thanks for the fix! One suggestion: core.py's VoxCPM.from_pretrained() (core.py:151-161) already implements the same "local dir vs. Hub ID -> snapshot_download" logic — it'd be nice to extract that into a small shared helper and reuse it here instead of adding two more slightly different implementations (this would also avoid the fragile "/" in path heuristic in _resolve_pretrained_path, which can misclassify relative local paths as Hub IDs).

Replace _resolve_pretrained_path() (fragile '/' heuristic) with a shared
resolve_model_path() helper in core.py that uses os.path.isdir() — the
same robust check from VoxCPM.from_pretrained().

- New resolve_model_path() in core.py, exported from voxcpm package
- from_pretrained() delegates to resolve_model_path()
- Training WebUI imports and uses the same shared helper
- Eliminates duplicate resolution logic and '/' misclassification of
  relative local paths as Hub IDs

Per upstream review on PR OpenBMB#376.
@a710128

a710128 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Nice cleanup, thanks! One small leftover: scripts/train_voxcpm_finetune.py still has its own inline resolve block — could swap that for resolve_model_path() too for full consistency.

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.

Training WebUI: auto-download models from HuggingFace Hub

3 participants