Skip to content

Commit 6894384

Browse files
committed
Fix detection of already encoded audio tracks in encode step
1 parent ea01fe3 commit 6894384

File tree

1 file changed

+5
-7
lines changed
  • src/stem_continuation_dataset_generator/steps

1 file changed

+5
-7
lines changed

src/stem_continuation_dataset_generator/steps/encode.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,14 @@ def encode(params: Tuple[S3FileSystem, str, str, str]):
2727
relative_path = os.path.relpath(file_dir, source_directory)
2828
file_output_directory = os.path.join(output_directory, relative_path)
2929
fs.makedirs(file_output_directory, exist_ok=True)
30-
31-
first_chunk_file_name = os.path.basename(file_path).split('.')[0] + '-c0.pkl'
32-
first_chunk_file_path = os.path.join(file_output_directory, first_chunk_file_name)
33-
34-
if not fs.exists(first_chunk_file_path):
30+
31+
output_filename = os.path.basename(file_path)
32+
output_file_path = os.path.join(file_output_directory, output_filename)
33+
34+
if not fs.exists(output_file_path):
3535
with fs.open(file_path, 'rb') as file:
3636
encoded_audio, frame_rate = encode_file(file, device)
3737

38-
output_filename = os.path.basename(file_path).split('.')[0] + '.pkl'
39-
output_file_path = os.path.join(file_output_directory, output_filename)
4038
if not fs.exists(output_file_path):
4139
with fs.open(output_file_path, 'wb') as output_file:
4240
pickle.dump(encoded_audio.detach().to('cpu'), output_file)

0 commit comments

Comments
 (0)