Update autoregressive.py

Fix AttributeError: module 'torch.backends.cuda' has no attribute 'is_available'
This commit is contained in:
NourEldin Osama 2023-08-11 20:08:19 +03:00 committed by GitHub
parent 41e917f99f
commit 4d4a423971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -375,14 +375,14 @@ class UnifiedVoice(nn.Module):
self.mel_head,
kv_cache=kv_cache,
)
if use_deepspeed and half and torch.backends.cuda.is_available():
if use_deepspeed and half and torch.cuda.is_available():
import deepspeed
self.ds_engine = deepspeed.init_inference(model=self.inference_model,
mp_size=1,
replace_with_kernel_inject=True,
dtype=torch.float16)
self.inference_model = self.ds_engine.module.eval()
elif use_deepspeed and torch.backends.cuda.is_available():
elif use_deepspeed and torch.cuda.is_available():
import deepspeed
self.ds_engine = deepspeed.init_inference(model=self.inference_model,
mp_size=1,