Skip to content

Commit

Permalink
fix(task): fix estimation of training set size (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrenchKrab authored Feb 8, 2024
1 parent e611d1c commit c3cc56c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
### Fixes

- fix(task): fix random generators
- fix(task): fix estimation of training set size

### Improvements

Expand Down
5 changes: 4 additions & 1 deletion pyannote/audio/tasks/segmentation/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,11 @@ def collate_fn(self, batch, stage="train"):

def train__len__(self):
# Number of training samples in one epoch
train_file_ids = np.where(
self.prepared_data["audio-metadata"]["subset"] == Subsets.index("train")
)[0]

duration = np.sum(self.prepared_data["audio-annotated"])
duration = np.sum(self.prepared_data["audio-annotated"][train_file_ids])
return max(self.batch_size, math.ceil(duration / self.duration))

def prepare_validation(self, prepared_data: Dict):
Expand Down

0 comments on commit c3cc56c

Please sign in to comment.