mirror of
https://github.com/serp-ai/bark-with-voice-clone.git
synced 2025-12-15 03:07:58 +01:00
Force type as pytorch Tensor.type() has missing support for MPS.
See https://github.com/pytorch/pytorch/issues/78929
This commit is contained in:
@@ -464,7 +464,10 @@ def generate_text_semantic(
|
||||
sorted_indices_to_remove[0] = False
|
||||
relevant_logits[sorted_indices[sorted_indices_to_remove]] = -np.inf
|
||||
relevant_logits = torch.from_numpy(relevant_logits)
|
||||
relevant_logits = relevant_logits.to(logits_device).type(logits_dtype)
|
||||
if GLOBAL_ENABLE_MPS:
|
||||
relevant_logits = torch.tensor(relevant_logits, device="mps").to(torch.float)
|
||||
else:
|
||||
relevant_logits = relevant_logits.to(logits_device).type(logits_dtype)
|
||||
if top_k is not None:
|
||||
v, _ = torch.topk(relevant_logits, min(top_k, relevant_logits.size(-1)))
|
||||
relevant_logits[relevant_logits < v[-1]] = -float("Inf")
|
||||
|
||||
Reference in New Issue
Block a user