mirror of
https://github.com/wassname/TTS.git
synced 2026-10-27 12:30:27 +08:00
python compat update for contextlib
This commit is contained in:
1 parent
c80225544e
commit
ea976b0543
1 file changed
+5
-2
@@ -3,7 +3,7 @@ import glob
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from contextlib import nullcontext
|
||||
import contextlib
|
||||
|
||||
import torch
|
||||
|
||||
@@ -12,7 +12,10 @@ def set_amp_context(mixed_precision):
|
||||
if mixed_precision:
|
||||
cm = torch.cuda.amp.autocast()
|
||||
else:
|
||||
cm = nullcontext()
|
||||
if os.python.version<=3.6:
|
||||
cm = contextlib.suppress()
|
||||
else:
|
||||
cm = nullcontext()
|
||||
return cm
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user