Skip to content

Commit

Permalink
Throw exception in CorpusReader.train_batch_gen() if no training utte…
Browse files Browse the repository at this point in the history
…rances are found.
  • Loading branch information
oadams committed Aug 20, 2018
1 parent cb5d5ea commit 6f30a05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions persephone/corpus_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,14 @@ def make_batches(self, utterance_fns: Sequence[Path]) -> List[Sequence[Path]]:
def train_batch_gen(self) -> Iterator:
""" Returns a generator that outputs batches in the training data."""

if len(self.train_fns) == 0:
raise PersephoneException("No training data available; cannot
generate training batches.")

# Create batches of batch_size and shuffle them.
fn_batches = self.make_batches(self.train_fns)


if self.rand:
random.shuffle(fn_batches)

Expand Down

0 comments on commit 6f30a05

Please sign in to comment.