Skip to content

Add support for local model path in from_pretrained methods#426

Open
mattoofahad wants to merge 1 commit intoresemble-ai:masterfrom
mattoofahad:master
Open

Add support for local model path in from_pretrained methods#426
mattoofahad wants to merge 1 commit intoresemble-ai:masterfrom
mattoofahad:master

Conversation

@mattoofahad
Copy link

Add support for local model path in from_pretrained methods

Enhanced the from_pretrained class methods in both ChatterboxMultilingualTTS, ChatterboxTTS, ChatterboxVC and ChatterboxTurboTTS to accept an optional model_snapshot_path parameter via kwargs.

Changes

  • Modified from_pretrained methods to accept **kwargs
  • Added logic to check for model_snapshot_path parameter
  • If model_snapshot_path exists and is valid, the method uses the local path directly, skipping HuggingFace snapshot download
  • If model_snapshot_path is not provided or doesn't exist, falls back to the default behavior of downloading from HuggingFace

Benefits

  • Allows users to load models from local directories without re-downloading
  • Reduces bandwidth usage and initialization time for users with cached models
  • Maintains backward compatibility - existing code without model_snapshot_path works unchanged
  • Graceful fallback ensures robustness

Usage Example

# Use local model path (skips download)
model = ChatterboxMultilingualTTS.from_pretrained(
    device=device, 
    model_snapshot_path="/path/to/local/model"
)

# Default behavior (downloads from HuggingFace)
model = ChatterboxMultilingualTTS.from_pretrained(device=device)

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.

1 participant