Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the merge audio dirs job for fairseq training #454

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion fairseq/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,19 @@ def run(self):
continue
base_name = os.path.basename(file)
dst = os.path.join(self.out_audio_dir_path, base_name)
os.symlink(file, dst)
if not os.path.exists(dst) and os.path.realpath(dst) != file:
os.symlink(file, dst)
elif os.path.exists(dst) and os.path.realpath(dst) != file:
i = 2
new_dst = f"{os.path.splitext(dst)[0]}_{i}.{self.file_extension}"
while os.path.exists(new_dst):
if os.path.realpath(new_dst) == file:
break
else:
i += 1
new_dst = f"{os.path.splitext(dst)[0]}_{i}.{self.file_extension}"
if os.path.realpath(new_dst) != file:
os.symlink(file, new_dst)


class CreateManifestJob(Job):
Expand Down
Loading