Skip to content

Commit

Permalink
fix(npu): ascend sampling real speaker (#788)
Browse files Browse the repository at this point in the history
Co-authored-by: shanshan shen <[email protected]>
  • Loading branch information
shen-shanshan and shanshan shen authored Oct 21, 2024
1 parent cff3b4e commit 0ec82fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ChatTTS/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,19 @@ def _load(
self.vocos = vocos
self.logger.log(logging.INFO, "vocos loaded.")

# computation of MelSpectrogram on npu is not support now, use cpu fallback.
dvae_device = torch.device("cpu") if "npu" in str(self.device) else device
dvae = DVAE(
decoder_config=asdict(self.config.dvae.decoder),
encoder_config=asdict(self.config.dvae.encoder),
vq_config=asdict(self.config.dvae.vq),
dim=self.config.dvae.decoder.idim,
coef=coef,
device=device,
device=dvae_device,
)
coef = str(dvae)
assert dvae_ckpt_path, "dvae_ckpt_path should not be None"
dvae.load_pretrained(dvae_ckpt_path, device)
dvae.load_pretrained(dvae_ckpt_path, dvae_device)
self.dvae = dvae.eval()
self.logger.log(logging.INFO, "dvae loaded.")

Expand Down

0 comments on commit 0ec82fe

Please sign in to comment.