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

将多卡/单卡的权重保存成同一种格式;支持shell脚本中data为多个字符串的输入;修改test文件 #43

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ZhikangNiu
Copy link

因为argparse的输入的input和output都是pathlib.path这个类,可以不需要引入os操作,结合官方的encodec的代码做出了以下修改

@ZhikangNiu
Copy link
Author

并且在我自己处理的时候可能一个文件夹下不全是.wav/.flac文件,因此我加入了--ext这个参数可以指定

@ZhikangNiu
Copy link
Author

@yangdongchao Hope you can review this pr

@ZhikangNiu ZhikangNiu changed the title use pathlib replace os 将多卡/单卡的权重保存成同一种格式;支持shell脚本中data为多个字符串的输入;修改test文件 Aug 28, 2023
@ZhikangNiu
Copy link
Author

修改后的shell脚本支持传入多个文件路径

train_data_dir="/data/LibriTTS/train-clean-100 /data/LibriTTS/train-clean-360 /data/LibriTTS/train-other-500"
valid_data_dir="/data/LibriTTS/test-clean"

@ZhikangNiu
Copy link
Author

@yt605155624

@@ -160,31 +174,26 @@ def test_batch():
print("args.target_bandwidths:", args.target_bandwidths)
if not args.input.exists():
fatal(f"Input file {args.input} does not exist.")
input_lists = os.listdir(args.input)
input_lists = list(args.input.glob(f"**/*.{args.ext}"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里这样写的话只能读取一种格式了,不能同时读取 *.mp3 和 *.wav

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但是好像一个文件夹下很少出现这种情况(?emmm 主要是有些文件夹下有对应的音频文件和转录的文件,所以我才这么写了orz

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我自己输入文件随便搞的,有各种格式,比如可以先列出所有文件,然后再把是 *.mp3 .wav,.flac 的筛选出来

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

明白了,先取所有文件,然后只保留特定的mp3,flac,wav这种格式的文件

@yt605155624
Copy link
Contributor

修改后的shell脚本支持传入多个文件路径

train_data_dir="/data/LibriTTS/train-clean-100 /data/LibriTTS/train-clean-360 /data/LibriTTS/train-other-500"
valid_data_dir="/data/LibriTTS/test-clean"

@NoFish-528 直接 train_data_dir="a b c" 在 py 里面接收到的好像是 ['a b c'], 好像必须要是, train_data_dir "a" "b" "c" ,py 接收到的才是 ['a', 'b', 'c'](必须不能有空格)?而且你还要在 py 里面处理下 train_data_dir 的读取方式?,因为原来是 str 现在是 list(str)

@ZhikangNiu
Copy link
Author

修改后的shell脚本支持传入多个文件路径

train_data_dir="/data/LibriTTS/train-clean-100 /data/LibriTTS/train-clean-360 /data/LibriTTS/train-other-500"
valid_data_dir="/data/LibriTTS/test-clean"

@NoFish-528 直接 train_data_dir="a b c" 在 py 里面接收到的好像是 ['a b c'], 好像必须要是, train_data_dir "a" "b" "c" ,py 接收到的才是 ['a', 'b', 'c'](必须不能有空格)?而且你还要在 py 里面处理下 train_data_dir 的读取方式?,因为原来是 str 现在是 list(str)

但是我测试过这个应该时可以的(

@yt605155624
Copy link
Contributor

修改后的shell脚本支持传入多个文件路径

train_data_dir="/data/LibriTTS/train-clean-100 /data/LibriTTS/train-clean-360 /data/LibriTTS/train-other-500"
valid_data_dir="/data/LibriTTS/test-clean"

@NoFish-528 直接 train_data_dir="a b c" 在 py 里面接收到的好像是 ['a b c'], 好像必须要是, train_data_dir "a" "b" "c" ,py 接收到的才是 ['a', 'b', 'c'](必须不能有空格)?而且你还要在 py 里面处理下 train_data_dir 的读取方式?,因为原来是 str 现在是 list(str)

但是我测试过这个应该时可以的(

再试试吧,我这不行,最好吧 shell 的输入和 args.train_data_dir 同时列出来看看

@ZhikangNiu
Copy link
Author

okk 晚一点重新提交一下

self.filenames.extend(glob.glob(audio_dir + "/*.wav"))
for sub_dir in audio_dir:
print(sub_dir)
self.filenames.extend(list(Path(sub_dir).glob("**/*.wav")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这里这样该就无法支持别的目录结构了,原始的写法是目录里面直接是 *.wav 文件,如果想支持多种类型的输入可以加判断

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants