Skip to content

Commit 1f8e1c5

Browse files
authored
fix bug (#2200)
* fix bug * fix bug * fix lint * fix bug * revert the modification * fix lint * fix bug * fix bug * fix bug
1 parent 67b28a5 commit 1f8e1c5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

wenet/transformer/asr_model.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,16 @@ def __init__(
5050

5151
super().__init__()
5252
# note that eos is the same as sos (equivalent ID)
53-
self.sos = special_tokens.get("sos", vocab_size - 1)
54-
self.eos = special_tokens.get("eos", vocab_size - 1)
53+
self.sos = (
54+
vocab_size - 1
55+
if special_tokens is None
56+
else special_tokens.get("sos", vocab_size - 1)
57+
)
58+
self.eos = (
59+
vocab_size - 1
60+
if special_tokens is None
61+
else special_tokens.get("eos", vocab_size - 1)
62+
)
5563
self.vocab_size = vocab_size
5664
self.special_tokens = special_tokens
5765
self.ignore_id = ignore_id

0 commit comments

Comments
 (0)