Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions egs/wsj/s5/steps/libs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
import sys
import threading

try:
import thread as thread_module
except:
import _thread as thread_module

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())

Expand Down Expand Up @@ -230,8 +235,7 @@ def background_command_waiter(command, popen_object, require_zero_status):
logger.error(str)
# thread.interrupt_main() sends a KeyboardInterrupt to the main
# thread, which will generally terminate the program.
import thread
thread.interrupt_main()
thread_module.interrupt_main()
else:
logger.warning(str)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def train_new_models(dir, iter, srand, num_jobs,
# work out the 1-based archive index.
archive_index = (k % num_archives) + 1
# previous : frame_shift = (k/num_archives) % frame_subsampling_factor
frame_shift = ((archive_index + k/num_archives)
frame_shift = ((archive_index + k//num_archives)
% frame_subsampling_factor)

multitask_egs_opts = common_train_lib.get_multitask_egs_opts(
Expand Down
4 changes: 2 additions & 2 deletions egs/wsj/s5/steps/libs/nnet3/train/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def halve_range_str(range_str):
halved_ranges = []
for r in ranges:
# a range may be either e.g. '64', or '128:256'
c = [str(max(1, int(x)/2)) for x in r.split(":")]
c = [str(max(1, int(x)//2)) for x in r.split(":")]
halved_ranges.append(":".join(c))
return ','.join(halved_ranges)

Expand Down Expand Up @@ -591,7 +591,7 @@ def get_model_combine_iters(num_iters, num_epochs,
models_to_combine.add(num_iters)
else:
subsample_model_factor = 1
num_iters_combine = min(max_models_combine, num_iters/2)
num_iters_combine = min(max_models_combine, num_iters//2)
models_to_combine = set(range(num_iters - num_iters_combine + 1,
num_iters + 1))

Expand Down