我通过pip安装Soundfile安装了Soundfile。 这是我的密码:
import soundfile as sf
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = sf.read(batch["file"])
batch["speech"] = speech_array
batch["sampling_rate"] = sampling_rate
batch["target_text"] = batch["text"]
return batch
timit = timit.map(speech_file_to_array_fn, remove_columns=timit.column_names["train"], num_proc=4)
但它给出了一个命名错误名称错误:未定义名称“sf”
我看不出这个问题,我在jupyter笔记本上工作
降级到版本0.10.2为我解决了问题(pip安装声音文件==0.10.2)
相关问题 更多 >
编程相关推荐