mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-09-08 08:34:19 +00:00
Fix warnings.
This commit is contained in:
parent
d79f5fecf7
commit
9105e3871e
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import warnings
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
@ -503,6 +504,8 @@ def modified_beam_search(
|
|||||||
for i in range(batch_size):
|
for i in range(batch_size):
|
||||||
topk_log_probs, topk_indexes = ragged_log_probs[i].topk(beam)
|
topk_log_probs, topk_indexes = ragged_log_probs[i].topk(beam)
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore")
|
||||||
topk_hyp_indexes = (topk_indexes // vocab_size).tolist()
|
topk_hyp_indexes = (topk_indexes // vocab_size).tolist()
|
||||||
topk_token_indexes = (topk_indexes % vocab_size).tolist()
|
topk_token_indexes = (topk_indexes % vocab_size).tolist()
|
||||||
|
|
||||||
@ -614,6 +617,8 @@ def _deprecated_modified_beam_search(
|
|||||||
topk_hyp_indexes = topk_indexes // logits.size(-1)
|
topk_hyp_indexes = topk_indexes // logits.size(-1)
|
||||||
topk_token_indexes = topk_indexes % logits.size(-1)
|
topk_token_indexes = topk_indexes % logits.size(-1)
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore")
|
||||||
topk_hyp_indexes = topk_hyp_indexes.tolist()
|
topk_hyp_indexes = topk_hyp_indexes.tolist()
|
||||||
topk_token_indexes = topk_token_indexes.tolist()
|
topk_token_indexes = topk_token_indexes.tolist()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user