24-12-28-pytorch深度学习中音频I/O 中遇到的问题汇总

文章目录

pytorch深度学习中音频I/O 中遇到的问题汇总

问题1:音频文件格式的读取问题

参考链接:torchaudio 加载wav报错 Couldn't find appropriate backend to handle uri *** and format None

主要是音频格式读取的问题,读取 '.wav' 或 '.gsm' 文件

python 复制代码
metadata = torchaudio.info(SAMPLE_WAV)
print(metadata)

metadata = torchaudio.info(SAMPLE_GSM)
print(metadata)

这里的办法处理参考上面的链接外,可以采用在pytorch终端中 pip install soundfile 的办法。

可以通过一下代码查看 soundfile 库文件提供的可打开的文件格式。

python 复制代码
import soundfile as sf
print(sf.available_formats())

问题2:音频文件绘图问题

参考链接:OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.解决

主要问题,会报下面一大堆话,如下所示:

python 复制代码
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program.
That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. 
As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. 
For more information, please see http://www.intel.com/software/products/support/.

主要问题是:多个环境中有这个 libiomp5md.dll 动态库,解决办法除了参考上面链接外。

(1) 可以使用 everything 软件,查找 libiomp5md.dll ,可以看到多个 libiomp5md.dll 文件,可以只留下所使用环境中的 libiomp5md.dll 文件,其他的 libiomp5md.dll 文件重命名为 libiomp5md__.dll

(2)或者 精准定位,只重命名 \Python312\site-packages\torch\lib 下的 libiomp5md.dll

小结

  看教程是一回事,自己做起来又是另一回事,会发现很多层出不穷的问题,多记录,多思考,多查资料,慢慢积累,终有所获。

相关推荐
元Y亨H1 分钟前
Python - FastAPI 全方位介绍
python·fastapi
沐籽李11 分钟前
Roche 团队如何设计酸性 pH 激活的 anti-CD3 抗体
人工智能·aidd·抗体设计·ph敏感抗体
aaaa9547266513 分钟前
2026最新5款AI编程工具平替实测合集|Claude Code低成本迭代深度对比
人工智能·microsoft
Larcher25 分钟前
从零实现 RAG 语义搜索——让 AI 听懂你的"弦外之音"
人工智能
Larcher26 分钟前
从零搭建文件读取 MCP 服务——让 AI 拥有读文件的能力
人工智能
西瓜橙30 分钟前
别再让 AI 一把梭:我用 Loop Engineering 把 AI编程 拽进可验证闭环
人工智能
艾莉丝努力练剑42 分钟前
OpenCode AI 编程:Ubuntu 24.04 环境安装与使用指南
linux·服务器·网络·人工智能·tcp/ip·ubuntu
华山令狐虫1 小时前
DBAPI AI 写 SQL:支持动态 SQL 与参数占位符,自然语言一键生成
数据库·人工智能·sql·dbapi
一次旅行1 小时前
DeepSeek-V4 原厂直供模型即将登陆腾讯云!峰谷定价详解 + 实战调用指南
人工智能·腾讯云·ai编程
阿里云大数据AI技术1 小时前
DataWorks Data Agent的演进与工程化实践
人工智能·agent