Parcourir la source

[FastPitch/PyT][HiFi-GAN/PyT] Unidecoder: disable PyTorch warnings in all speech models

Adrian Lancucki il y a 3 ans
Parent
commit
469df9b0ee

+ 1 - 1
PyTorch/SpeechRecognition/Jasper/common/filter_warnings.py

@@ -21,7 +21,7 @@ warnings.filterwarnings(
     message='positional arguments and argument "destination" are deprecated.'
     message='positional arguments and argument "destination" are deprecated.'
             ' nn.Module.state_dict will not accept them in the future.')
             ' nn.Module.state_dict will not accept them in the future.')
 
 
-# 22.08-py3 RC
+# 22.08-py3 container
 warnings.filterwarnings(
 warnings.filterwarnings(
     "ignore",
     "ignore",
     message="is_namedtuple is deprecated, please use the python checks")
     message="is_namedtuple is deprecated, please use the python checks")

+ 0 - 2
PyTorch/SpeechRecognition/Jasper/common/text/unidecoder/__init__.py

@@ -18,8 +18,6 @@ import warnings
 from .homoglyphs import homoglyphs
 from .homoglyphs import homoglyphs
 from .replacements import replacements
 from .replacements import replacements
 
 
-warnings.simplefilter('always', UserWarning)
-
 
 
 _replacements = {uni: asc for uni, asc in replacements}
 _replacements = {uni: asc for uni, asc in replacements}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}

+ 1 - 1
PyTorch/SpeechRecognition/QuartzNet/common/filter_warnings.py

@@ -21,7 +21,7 @@ warnings.filterwarnings(
     message='positional arguments and argument "destination" are deprecated.'
     message='positional arguments and argument "destination" are deprecated.'
             ' nn.Module.state_dict will not accept them in the future.')
             ' nn.Module.state_dict will not accept them in the future.')
 
 
-# 22.08-py3 RC
+# 22.08-py3 container
 warnings.filterwarnings(
 warnings.filterwarnings(
     "ignore",
     "ignore",
     message="is_namedtuple is deprecated, please use the python checks")
     message="is_namedtuple is deprecated, please use the python checks")

+ 0 - 2
PyTorch/SpeechRecognition/QuartzNet/common/text/unidecoder/__init__.py

@@ -18,8 +18,6 @@ import warnings
 from .homoglyphs import homoglyphs
 from .homoglyphs import homoglyphs
 from .replacements import replacements
 from .replacements import replacements
 
 
-warnings.simplefilter('always', UserWarning)
-
 
 
 _replacements = {uni: asc for uni, asc in replacements}
 _replacements = {uni: asc for uni, asc in replacements}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}

+ 1 - 1
PyTorch/SpeechSynthesis/FastPitch/common/filter_warnings.py

@@ -21,7 +21,7 @@ warnings.filterwarnings(
     message='positional arguments and argument "destination" are deprecated.'
     message='positional arguments and argument "destination" are deprecated.'
             ' nn.Module.state_dict will not accept them in the future.')
             ' nn.Module.state_dict will not accept them in the future.')
 
 
-# 22.08-py3 RC
+# 22.08-py3 container
 warnings.filterwarnings(
 warnings.filterwarnings(
     "ignore",
     "ignore",
     message="is_namedtuple is deprecated, please use the python checks")
     message="is_namedtuple is deprecated, please use the python checks")

+ 0 - 20
PyTorch/SpeechSynthesis/FastPitch/common/monkey_patch.py

@@ -1,20 +0,0 @@
-import re
-import warnings
-
-import torch
-
-
-major, minor, *_ = re.search('(\d+)\.(\d+)', torch.__version__).groups()
-
-if int(major) >= 1 and int(minor) >= 12:
-    # Mutes 'UserWarning: positional arguments and argument "destination"
-    # are deprecated. nn.Module.state_dict will not accept them in the future.'
-
-    def state_dict(self, *args, **kwargs):
-        warnings.filterwarnings("ignore")
-        ret = self._state_dict(*args, **kwargs)
-        warnings.filterwarnings("default")
-        return ret
-
-    torch.nn.Module._state_dict = torch.nn.Module.state_dict
-    torch.nn.Module.state_dict = state_dict

+ 0 - 2
PyTorch/SpeechSynthesis/FastPitch/common/text/unidecoder/__init__.py

@@ -18,8 +18,6 @@ import warnings
 from .homoglyphs import homoglyphs
 from .homoglyphs import homoglyphs
 from .replacements import replacements
 from .replacements import replacements
 
 
-warnings.simplefilter('always', UserWarning)
-
 
 
 _replacements = {uni: asc for uni, asc in replacements}
 _replacements = {uni: asc for uni, asc in replacements}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}

+ 1 - 1
PyTorch/SpeechSynthesis/HiFi-GAN/common/filter_warnings.py

@@ -21,7 +21,7 @@ warnings.filterwarnings(
     message='positional arguments and argument "destination" are deprecated.'
     message='positional arguments and argument "destination" are deprecated.'
             ' nn.Module.state_dict will not accept them in the future.')
             ' nn.Module.state_dict will not accept them in the future.')
 
 
-# 22.08-py3 RC
+# 22.08-py3 container
 warnings.filterwarnings(
 warnings.filterwarnings(
     "ignore",
     "ignore",
     message="is_namedtuple is deprecated, please use the python checks")
     message="is_namedtuple is deprecated, please use the python checks")

+ 0 - 20
PyTorch/SpeechSynthesis/HiFi-GAN/common/monkey_patch.py

@@ -1,20 +0,0 @@
-import re
-import warnings
-
-import torch
-
-
-major, minor, *_ = re.search('(\d+)\.(\d+)', torch.__version__).groups()
-
-if int(major) >= 1 and int(minor) >= 12:
-    # Mutes 'UserWarning: positional arguments and argument "destination"
-    # are deprecated. nn.Module.state_dict will not accept them in the future.'
-
-    def state_dict(self, *args, **kwargs):
-        warnings.filterwarnings("ignore")
-        ret = self._state_dict(*args, **kwargs)
-        warnings.filterwarnings("default")
-        return ret
-
-    torch.nn.Module._state_dict = torch.nn.Module.state_dict
-    torch.nn.Module.state_dict = state_dict

+ 0 - 2
PyTorch/SpeechSynthesis/HiFi-GAN/common/text/unidecoder/__init__.py

@@ -18,8 +18,6 @@ import warnings
 from .homoglyphs import homoglyphs
 from .homoglyphs import homoglyphs
 from .replacements import replacements
 from .replacements import replacements
 
 
-warnings.simplefilter('always', UserWarning)
-
 
 
 _replacements = {uni: asc for uni, asc in replacements}
 _replacements = {uni: asc for uni, asc in replacements}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}

+ 0 - 2
PyTorch/SpeechSynthesis/Tacotron2/notebooks/conversationalai/client/speech_ai_demo/utils/tacotron2/unidecoder/__init__.py

@@ -18,8 +18,6 @@ import warnings
 from .homoglyphs import homoglyphs
 from .homoglyphs import homoglyphs
 from .replacements import replacements
 from .replacements import replacements
 
 
-warnings.simplefilter('always', UserWarning)
-
 
 
 _replacements = {uni: asc for uni, asc in replacements}
 _replacements = {uni: asc for uni, asc in replacements}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}

+ 0 - 2
PyTorch/SpeechSynthesis/Tacotron2/tacotron2/text/unidecoder/__init__.py

@@ -18,8 +18,6 @@ import warnings
 from .homoglyphs import homoglyphs
 from .homoglyphs import homoglyphs
 from .replacements import replacements
 from .replacements import replacements
 
 
-warnings.simplefilter('always', UserWarning)
-
 
 
 _replacements = {uni: asc for uni, asc in replacements}
 _replacements = {uni: asc for uni, asc in replacements}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}
 _homoglyphs = {g: asc for asc, glyphs in homoglyphs.items() for g in glyphs}