Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Fix MAX_STEPS = 0 error by add suggestion and exit (#1195)
Browse files Browse the repository at this point in the history
## What this patch does to fix the issue.
Change the minimum no. of `MAX_STEPS` to 1.

## Link to any relevant issues or pull requests.
#1194
  • Loading branch information
oatawa1 authored Sep 3, 2020
1 parent 1a95803 commit 2b80ed1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions blueoil/cmd/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from datetime import datetime
import math
import os
import sys

import tensorflow as tf
from tensorflow.core.util.event_pb2 import SessionLog
Expand Down Expand Up @@ -192,8 +193,14 @@ def start_training(config, profile_step):
# Calculate max steps. The priority of config.MAX_EPOCHS is higher than config.MAX_STEPS.
if "MAX_EPOCHS" in config:
max_steps = int(train_dataset.num_per_epoch / config.BATCH_SIZE * config.MAX_EPOCHS)
if max_steps < 1:
print("The max_steps is less than 1, consider reduce BATCH_SIZE. exit.", file=sys.stderr)
sys.exit(1)
else:
max_steps = config.MAX_STEPS
if max_steps < 1:
print("The max_steps is less than 1, consider set MAX_STEPS greater than 0. exit.", file=sys.stderr)
sys.exit(1)

progbar = Progbar(max_steps)
if rank == 0:
Expand Down

0 comments on commit 2b80ed1

Please sign in to comment.