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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions main_loop_tf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import hashlib
try:
from itertools import izip_longest as zip_longest
except:
except ImportError:
from itertools import zip_longest
import json
import logging
Expand Down Expand Up @@ -940,12 +940,15 @@ def epoch_begin(self):
simple_value=self.epoch_id + 1)
summary = tf.Summary(value=[summary_val])
self.summary_writer.add_summary(summary, self.epoch_id)
bar_format = '{n_fmt}/{total_fmt}{desc}{percentage:3.0f}%|{bar}| '
bar_format += '[{elapsed}<{remaining},{rate_fmt}{postfix}]'
bar_format = (
'{n_fmt}/{total_fmt}({postfix[step]:3d}) Ep {postfix[epoch]:d}:'
' {percentage:3.0f}%|{bar}| [{elapsed}<{remaining},{rate_fmt},'
' D={postfix[D]:.2f}s, loss={postfix[loss]:.3f}]')
self.pbar = tqdm(total=self.train.nbatches,
initial=self.global_step_val % self.train.nbatches,
dynamic_ncols=True,
bar_format=bar_format)
bar_format=bar_format,
postfix=dict([(0, 0)], step=0, epoch=0, D=0, loss=0))

def batch_begin(self):
iter_start = time()
Expand Down Expand Up @@ -1026,11 +1029,11 @@ def batch_do(self):
self.loss_value = fetch_dict['avg_loss']

def batch_end(self):
self.pbar.set_description('({:3d}) Ep {:d}'.format(
self.global_step_val + 1, self.epoch_id + 1))
avg_loss = self._fetch_dict['avg_loss']
self.pbar.set_postfix({'D': '{:.2f}s'.format(self._t_data_load),
'loss': '{:.3f}'.format(avg_loss)})
self.pbar.postfix.update(
step=self.global_step_val + 1,
epoch=self.epoch_id + 1,
D=self._t_data_load,
loss=self._fetch_dict['avg_loss'])
self.pbar.update(1)
self.global_step_val += 1

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=['numpy', 'tensorflow', 'tqdm', 'python-gflags'],
install_requires=['numpy', 'tensorflow', 'tqdm>=4.22.0', 'python-gflags'],

# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
Expand Down