Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Emrys365 committed Oct 1, 2023
1 parent 773831d commit 1bba669
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions espnet2/fileio/multi_sound_scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class MultiSoundScpReader(collections.abc.Mapping):
wav.scp is a text file that looks like the following:
key1 /some/path/a1.wav /another/path/a2.wav /yet/another/path/a3.wav
key2 /some/path/b1.wav /another/path/b2.wav /yet/another/path/b3.wav
key2 /some/path/b1.wav /another/path/b2.wav
key3 /some/path/c1.wav /another/path/c2.wav /yet/another/path/c3.wav
key4 /some/path/d1.wav /another/path/d2.wav /yet/another/path/d3.wav
key4 /some/path/d1.wav
...
>>> reader = SoundScpReader('wav.scp', stack_axis=0)
Expand Down
8 changes: 7 additions & 1 deletion espnet2/train/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,13 @@ def _random_crop_range(self, data_dict, num_spk, uid=None, max_trials=10):
]
length = speech_refs[0].shape[0]
tgt_length = self.speech_segment
assert length >= self.speech_segment, (length, tgt_length)
if length <= tgt_length:
if length < tgt_length:
logging.warning(

Check warning on line 1111 in espnet2/train/preprocessor.py

View check run for this annotation

Codecov / codecov/patch

espnet2/train/preprocessor.py#L1107-L1111

Added lines #L1107 - L1111 were not covered by tests
f"The sample ({uid}) is not cropped due to its short length "
f"({length} < {tgt_length})."
)
return 0, length

Check warning on line 1115 in espnet2/train/preprocessor.py

View check run for this annotation

Codecov / codecov/patch

espnet2/train/preprocessor.py#L1115

Added line #L1115 was not covered by tests

start = np.random.randint(0, length - tgt_length)
count = 1
Expand Down

0 comments on commit 1bba669

Please sign in to comment.