Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kamo-naoyuki committed May 13, 2022
1 parent 2625be7 commit 9cfd6af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions espnet/asr/pytorch_backend/asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ def recog(args):
# It seems quantized LSTM only supports non-packed sequence before torch 1.4.0.
# Reference issue: https://github.com/pytorch/pytorch/issues/27963
if (
torch.__version__ < V("1.4.0")
V(torch.__version__) < V("1.4.0")
and "lstm" in train_args.etype
and torch.nn.LSTM in q_config
):
Expand All @@ -999,7 +999,7 @@ def recog(args):

# Dunno why but weight_observer from dynamic quantized module must have
# dtype=torch.qint8 with torch < 1.5 although dtype=torch.float16 is supported.
if args.quantize_dtype == "float16" and torch.__version__ < V("1.5.0"):
if args.quantize_dtype == "float16" and V(torch.__version__) < V("1.5.0"):
raise ValueError(
"float16 dtype for dynamic quantization is not supported with torch "
"version < 1.5.0. Switching to qint8 dtype instead."
Expand Down
4 changes: 2 additions & 2 deletions espnet/asr/pytorch_backend/recog.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ def recog_v2(args):

# See https://github.com/espnet/espnet/pull/3616 for more information.
if (
torch.__version__ < V("1.4.0")
V(torch.__version__) < V("1.4.0")
and "lstm" in train_args.etype
and torch.nn.LSTM in q_config
):
raise ValueError(
"Quantized LSTM in ESPnet is only supported with torch 1.4+."
)

if args.quantize_dtype == "float16" and torch.__version__ < V("1.5.0"):
if args.quantize_dtype == "float16" and V(torch.__version__) < V("1.5.0"):
raise ValueError(
"float16 dtype for dynamic quantization is not supported with torch "
"version < 1.5.0. Switching to qint8 dtype instead."
Expand Down

0 comments on commit 9cfd6af

Please sign in to comment.