Skip to content

Commit

Permalink
keras: fix resume
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed May 2, 2021
1 parent 3f899b9 commit 68d91f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
17 changes: 4 additions & 13 deletions tests/tests_keras.py
Expand Up @@ -38,9 +38,7 @@ def test_keras(capsys):
desc="training",
data_size=len(x),
batch_size=batch_size,
verbose=0,
)],
)
verbose=0)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
Expand All @@ -59,9 +57,7 @@ def test_keras(capsys):
desc="training",
data_size=len(x),
batch_size=batch_size,
verbose=2,
)],
)
verbose=2)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
Expand All @@ -74,8 +70,7 @@ def test_keras(capsys):
epochs=epochs,
batch_size=batch_size,
verbose=False,
callbacks=[TqdmCallback(desc="training", verbose=2)],
)
callbacks=[TqdmCallback(desc="training", verbose=2)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
Expand All @@ -90,11 +85,7 @@ def test_keras(capsys):
epochs=epochs,
batch_size=batch_size,
verbose=False,
callbacks=[TqdmCallback(
desc="training",
verbose=2
)],
)
callbacks=[TqdmCallback(desc="training", verbose=0)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
Expand Down
3 changes: 2 additions & 1 deletion tqdm/keras.py
Expand Up @@ -74,7 +74,8 @@ def on_train_begin(self, *_, **__):

def on_epoch_begin(self, epoch, *_, **__):
if self.epoch_bar.n < epoch:
self.epoch_bar.update(epoch-self.epoch_bar.n)
ebar = self.epoch_bar
ebar.n = ebar.last_print_n = ebar.initial = epoch
if self.verbose:
params = self.params.get
total = params('samples', params(
Expand Down

0 comments on commit 68d91f5

Please sign in to comment.