Skip to content

Commit

Permalink
#fix 1)enable mps device 2) fix bug in reference audio scenario (#714)
Browse files Browse the repository at this point in the history
* #fix 1)enable mps device 2)fix bug in reference audio scenario

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: xiaokai <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 7, 2024
1 parent 62eae26 commit 9f881ed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/inference_engine/reference_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def load_by_id(
# If the references are not already loaded, encode them
prompt_tokens = [
self.encode_reference(
decoder_model=self.decoder_model,
# decoder_model=self.decoder_model,
reference_audio=audio_to_bytes(str(ref_audio)),
enable_reference_audio=True,
)
Expand Down
5 changes: 5 additions & 0 deletions tools/run_webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ def parse_args():
args = parse_args()
args.precision = torch.half if args.half else torch.bfloat16

# Check if MPS is available
if torch.backends.mps.is_available():
args.device = "mps"
logger.info("mps is available, running on mps.")

# Check if CUDA is available
if not torch.cuda.is_available():
logger.info("CUDA is not available, running on CPU.")
Expand Down
5 changes: 5 additions & 0 deletions tools/server/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def __init__(

self.precision = torch.half if half else torch.bfloat16

# Check if MPS is available
if torch.backends.mps.is_available():
self.device = "mps"
logger.info("mps is available, running on mps.")

# Check if CUDA is available
if not torch.cuda.is_available():
self.device = "cpu"
Expand Down

0 comments on commit 9f881ed

Please sign in to comment.