mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-29 07:05:14 -07:00
Update LocalProvider to manage model size dynamically and clean up build scripts
- Introduced a new attribute `_current_model_size` in `LocalProvider` to store the current model size, allowing for dynamic configuration during generation. - Updated the `generate` method to use the current model size instead of a hardcoded value. - Modified the `load_model` method to track the requested model size. - Removed platform-specific extension handling from the build scripts for both CPU and CUDA providers to streamline the build process.
This commit is contained in:
@@ -25,6 +25,7 @@ class LocalProvider:
|
|||||||
"""
|
"""
|
||||||
self.base_url = base_url.rstrip('/')
|
self.base_url = base_url.rstrip('/')
|
||||||
self.client = httpx.AsyncClient(timeout=300.0) # 5 minute timeout for generation
|
self.client = httpx.AsyncClient(timeout=300.0) # 5 minute timeout for generation
|
||||||
|
self._current_model_size = "1.7B" # Default model size
|
||||||
|
|
||||||
async def generate(
|
async def generate(
|
||||||
self,
|
self,
|
||||||
@@ -42,7 +43,7 @@ class LocalProvider:
|
|||||||
"voice_prompt": voice_prompt,
|
"voice_prompt": voice_prompt,
|
||||||
"language": language,
|
"language": language,
|
||||||
"seed": seed,
|
"seed": seed,
|
||||||
"model_size": "1.7B", # TODO: Make configurable
|
"model_size": self._current_model_size,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
@@ -116,9 +117,9 @@ class LocalProvider:
|
|||||||
|
|
||||||
async def load_model(self, model_size: str) -> None:
|
async def load_model(self, model_size: str) -> None:
|
||||||
"""Load TTS model."""
|
"""Load TTS model."""
|
||||||
# Model loading is handled automatically by the provider server
|
# Track the requested model size - the provider server will load it
|
||||||
# when generate() is called, so this is a no-op
|
# when generate() is called with this size
|
||||||
pass
|
self._current_model_size = model_size
|
||||||
|
|
||||||
def unload_model(self) -> None:
|
def unload_model(self) -> None:
|
||||||
"""Unload model to free memory."""
|
"""Unload model to free memory."""
|
||||||
|
|||||||
@@ -56,10 +56,6 @@ def build_provider():
|
|||||||
'--hidden-import', 'librosa',
|
'--hidden-import', 'librosa',
|
||||||
])
|
])
|
||||||
|
|
||||||
# Platform-specific extensions
|
|
||||||
if platform.system() == "Windows":
|
|
||||||
args[2] = 'tts-provider-pytorch-cpu.exe'
|
|
||||||
|
|
||||||
args.extend([
|
args.extend([
|
||||||
'--noconfirm',
|
'--noconfirm',
|
||||||
'--clean',
|
'--clean',
|
||||||
|
|||||||
@@ -58,10 +58,6 @@ def build_provider():
|
|||||||
'--hidden-import', 'librosa',
|
'--hidden-import', 'librosa',
|
||||||
])
|
])
|
||||||
|
|
||||||
# Platform-specific extensions
|
|
||||||
if platform.system() == "Windows":
|
|
||||||
args[2] = 'tts-provider-pytorch-cuda.exe'
|
|
||||||
|
|
||||||
args.extend([
|
args.extend([
|
||||||
'--noconfirm',
|
'--noconfirm',
|
||||||
'--clean',
|
'--clean',
|
||||||
|
|||||||
Reference in New Issue
Block a user