Skip to content

Commit

Permalink
apply optional index filter
Browse files Browse the repository at this point in the history
  • Loading branch information
iiSeymour committed Jan 1, 2021
1 parent 0d664a2 commit 6ceed73
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bonito/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ def load_data(limit=None, directory=None, validation=False):
targets = np.load(os.path.join(directory, "references.npy"), mmap_mode='r')
lengths = np.load(os.path.join(directory, "reference_lengths.npy"), mmap_mode='r')

indices = os.path.join(directory, "indices.npy")
if os.path.exists(indices):
idx = np.load(indices, mmap_mode='r')
chunks = chunks[idx, :]
targets = targets[idx, :]
lengths = lengths[idx]

if limit:
chunks = chunks[:limit]
targets = targets[:limit]
Expand Down

0 comments on commit 6ceed73

Please sign in to comment.