[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-iver56--torch-audiomentations":3,"tool-iver56--torch-audiomentations":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",148568,2,"2026-04-09T23:34:24",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":77,"owner_email":78,"owner_twitter":72,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":84,"last_commit_at":86,"license":87,"difficulty_score":88,"env_os":89,"env_gpu":90,"env_ram":91,"env_deps":92,"category_tags":99,"github_topics":101,"view_count":32,"oss_zip_url":78,"oss_zip_packed_at":78,"status":17,"created_at":117,"updated_at":118,"faqs":119,"releases":159},6036,"iver56\u002Ftorch-audiomentations","torch-audiomentations","Fast audio data augmentation in PyTorch. Inspired by audiomentations. Useful for deep learning.","torch-audiomentations 是一款专为 PyTorch 打造的高效音频数据增强工具，旨在加速深度学习模型的训练过程。它深受 audiomentations 项目启发，但针对性能进行了深度优化，核心解决了传统音频增强在大规模训练中速度慢、难以融入神经网络流水线的问题。\n\n这款工具特别适合从事语音识别、音频分类或音乐信息检索的 AI 研究人员与开发者使用。其最大的技术亮点在于将音频变换操作封装为 PyTorch 的原生 `nn.Module`，这意味着增强逻辑可以直接嵌入模型架构中，并支持在 GPU 上并行运行，从而大幅提升数据处理吞吐量。此外，它原生支持多通道音频批次处理，提供“按批次”、“按样本”和“按通道”三种灵活的增强模式，且大多数变换操作是可微分的，便于更复杂的模型优化。\n\n无论是需要在本地 CPU 快速验证想法，还是在云端 GPU 集群上进行大规模训练，torch-audiomentations 都能提供跨平台的稳定支持。通过简单的几行代码，用户即可构建包含增益调整、极性反转等多种效果的增强流水线，让音频数据的预处理变得更加流畅高效。","![torch-audiomentations](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fiver56_torch-audiomentations_readme_af1f14adddc4.png)\n---\n\n![Build status](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fci.yml?branch=main)\n[![Code coverage](https:\u002F\u002Fimg.shields.io\u002Fcodecov\u002Fc\u002Fgithub\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fmain.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fasteroid-team\u002Ftorch-audiomentations)\n[![Code Style: Black](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcode%20style-black-black.svg)](https:\u002F\u002Fgithub.com\u002Fambv\u002Fblack)\n[![DOI](https:\u002F\u002Fzenodo.org\u002Fbadge\u002FDOI\u002F10.5281\u002Fzenodo.14650813.svg)](https:\u002F\u002Fdoi.org\u002F10.5281\u002Fzenodo.14650813)\n\nAudio data augmentation in PyTorch. Inspired by [audiomentations](https:\u002F\u002Fgithub.com\u002Fiver56\u002Faudiomentations).\n\n* Supports CPU and GPU (CUDA) - speed is a priority\n* Supports batches of multichannel (or mono) audio\n* Transforms extend `nn.Module`, so they can be integrated as a part of a pytorch neural network model\n* Most transforms are differentiable\n* Three modes: `per_batch`, `per_example` and `per_channel`\n* Cross-platform compatibility\n* Permissive MIT license\n* Aiming for high test coverage\n\n# Setup\n\n![Python version support](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Ftorch-audiomentations)\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Ftorch-audiomentations.svg?style=flat)](https:\u002F\u002Fpypi.org\u002Fproject\u002Ftorch-audiomentations\u002F)\n[![Number of downloads from PyPI per month](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Ftorch-audiomentations.svg?style=flat)](https:\u002F\u002Fpypi.org\u002Fproject\u002Ftorch-audiomentations\u002F)\n\n`pip install torch-audiomentations`\n\n# Usage example\n\n```python\nimport torch\nfrom torch_audiomentations import Compose, Gain, PolarityInversion\n\n\n# Initialize augmentation callable\napply_augmentation = Compose(\n    transforms=[\n        Gain(\n            min_gain_in_db=-15.0,\n            max_gain_in_db=5.0,\n            p=0.5,\n        ),\n        PolarityInversion(p=0.5)\n    ]\n)\n\ntorch_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n\n# Make an example tensor with white noise.\n# This tensor represents 8 audio snippets with 2 channels (stereo) and 2 s of 16 kHz audio.\naudio_samples = torch.rand(size=(8, 2, 32000), dtype=torch.float32, device=torch_device) - 0.5\n\n# Apply augmentation. This varies the gain and polarity of (some of)\n# the audio snippets in the batch independently.\nperturbed_audio_samples = apply_augmentation(audio_samples, sample_rate=16000)\n```\n\n# Known issues\n\n* Target data processing is still in an experimental state ([#3](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F3)). Workaround: Use `freeze_parameters` and `unfreeze_parameters` for now if the target data is audio with the same shape as the input.\n* Using torch-audiomentations in a multiprocessing context can lead to memory leaks ([#132](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F132)). Workaround: If using torch-audiomentations in a multiprocessing context, it'll probably work better to run the transforms on CPU.\n* Multi-GPU \u002F DDP is not officially supported ([#136](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F136)). The author does not have a multi-GPU setup to test & fix this. Get in touch if you want to donate some hardware for this. Workaround: Run the transforms on single GPU instead.\n* `PitchShift` does not support small pitch shifts, especially for low sample rates ([#151](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F151)). Workaround: If you need small pitch shifts applied to low sample rates, use [PitchShift in audiomentations](https:\u002F\u002Fiver56.github.io\u002Faudiomentations\u002Fwaveform_transforms\u002Fpitch_shift\u002F) or [torch-pitch-shift](https:\u002F\u002Fgithub.com\u002FKentoNishi\u002Ftorch-pitch-shift\u002F) directly without the function for calculating efficient pitch-shift targets.\n\n# Contribute\n\nContributors welcome! \n[Join the Asteroid's slack](https:\u002F\u002Fjoin.slack.com\u002Ft\u002Fasteroid-dev\u002Fshared_invite\u002Fzt-cn9y85t3-QNHXKD1Et7qoyzu1Ji5bcA)\nto start discussing about `torch-audiomentations` with us.\n\n# Motivation: Speed\n\nWe don't want data augmentation to be a bottleneck in model training speed. Here is a\ncomparison of the time it takes to run 1D convolution:\n\n![Convolve execution times](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fiver56_torch-audiomentations_readme_1e1d9abbd747.png)\n\nNote: Not all transforms have a speedup this impressive compared to CPU. In general, running audio data augmentation on GPU is not always the best option. For more info, see this article: [https:\u002F\u002Fiver56.github.io\u002Faudiomentations\u002Fguides\u002Fcpu_vs_gpu\u002F](https:\u002F\u002Fiver56.github.io\u002Faudiomentations\u002Fguides\u002Fcpu_vs_gpu\u002F)\n\n# Current state\n\ntorch-audiomentations is in an early development stage, so the APIs are subject to change.\n\n# Waveform transforms\n\nEvery transform has `mode`, `p`, and `p_mode` -- the parameters that decide how the augmentation is performed.\n- `mode` decides how the randomization of the augmentation is grouped and applied.\n- `p` decides the on\u002Foff probability of applying the augmentation.   \n- `p_mode` decides how the on\u002Foff of the augmentation is applied.\n\nThis visualization shows how different combinations of `mode` and `p_mode` would perform an augmentation.    \n\n![Explanation of mode, p and p_mode](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fiver56_torch-audiomentations_readme_4853671240fa.png)\n    \n\n## AddBackgroundNoise\n\n_Added in v0.5.0_\n\nAdd background noise to the input audio.\n\n## AddColoredNoise\n\n_Added in v0.7.0_\n\nAdd colored noise to the input audio.\n\n## ApplyImpulseResponse\n\n_Added in v0.5.0_\n\nConvolve the given audio with impulse responses.\n\n## BandPassFilter\n\n_Added in v0.9.0_\n\nApply band-pass filtering to the input audio.\n\n## BandStopFilter\n\n_Added in v0.10.0_\n\nApply band-stop filtering to the input audio. Also known as notch filter.\n\n## Gain\n\n_Added in v0.1.0_\n\nMultiply the audio by a random amplitude factor to reduce or increase the volume. This\ntechnique can help a model become somewhat invariant to the overall gain of the input audio.\n\nWarning: This transform can return samples outside the [-1, 1] range, which may lead to\nclipping or wrap distortion, depending on what you do with the audio in a later stage.\nSee also https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FClipping_(audio)#Digital_clipping\n\n## HighPassFilter\n\n_Added in v0.8.0_\n\nApply high-pass filtering to the input audio.\n\n## Identity\n\n_Added in v0.11.0_\n\nThis transform returns the input unchanged. It can be used for simplifying the code\nin cases where data augmentation should be disabled.\n\n## LowPassFilter\n\n_Added in v0.8.0_\n\nApply low-pass filtering to the input audio.\n\n## PeakNormalization\n\n_Added in v0.2.0_\n\nApply a constant amount of gain, so that highest signal level present in each audio snippet\nin the batch becomes 0 dBFS, i.e. the loudest level allowed if all samples must be between\n-1 and 1.\n\nThis transform has an alternative mode (apply_to=\"only_too_loud_sounds\") where it only\napplies to audio snippets that have extreme values outside the [-1, 1] range. This is useful\nfor avoiding digital clipping in audio that is too loud, while leaving other audio\nuntouched.\n\n## PitchShift\n\n_Added in v0.9.0_\n\nPitch-shift sounds up or down without changing the tempo.\n\n## PolarityInversion\n\n_Added in v0.1.0_\n\nFlip the audio samples upside-down, reversing their polarity. In other words, multiply the\nwaveform by -1, so negative values become positive, and vice versa. The result will sound\nthe same compared to the original when played back in isolation. However, when mixed with\nother audio sources, the result may be different. This waveform inversion technique\nis sometimes used for audio cancellation or obtaining the difference between two waveforms.\nHowever, in the context of audio data augmentation, this transform can be useful when\ntraining phase-aware machine learning models.\n\n## Shift\n\n_Added in v0.5.0_\n\nShift the audio forwards or backwards, with or without rollover\n\n## ShuffleChannels\n\n_Added in v0.6.0_\n\nGiven multichannel audio input (e.g. stereo), shuffle the channels, e.g. so left can become right and vice versa.\nThis transform can help combat positional bias in machine learning models that input multichannel waveforms.\n\nIf the input audio is mono, this transform does nothing except emit a warning.\n\n## TimeInversion\n\n_Added in v0.10.0_\n\nReverse (invert) the audio along the time axis similar to random flip of\nan image in the visual domain. This can be relevant in the context of audio\nclassification. It was successfully applied in the paper\n[AudioCLIP: Extending CLIP to Image, Text and Audio](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2106.13043.pdf)\n\n\n# Changelog\n\n## Unreleased\n\n### Added\n\n* Add new transforms: `Mix`, `Padding`, `RandomCrop` and `SpliceOut`\n\n## [v0.12.0] - 2025-01-15\n\n### Removed\n\n* Remove `librosa` dependency in favor of `torchaudio`\n\n## [v0.11.2] - 2025-01-09\n\n### Fixed\n\n* Fix a device-related bug in `transform_parameters` when training on multiple GPUs\n* Fix a shape-related edge case bug in `AddColoredNoise`\n* Fix a bug where an incompatible Path data type was passed to torchaudio.info\n\n## [v0.11.1] - 2024-02-07\n\n### Changed\n\n* Add support for constant cutoff frequency in `LowPassFilter` and `HighPassFilter`\n* Add support for min_f_decay==max_f_decay in `AddColoredNoise`\n* Bump torchaudio dependency from >=0.7.0 to >=0.9.0\n\n### Fixed\n\n* Fix inaccurate type hints in `Shift`\n* Remove `set_backend` to avoid `UserWarning` from torchaudio\n\n## [v0.11.0] - 2022-06-29\n\n### Added\n\n* Add new transform: `Identity`\n* Add API for processing targets alongside inputs. Some transforms experimentally\n  support this feature already.\n\n### Changed\n\n* Add `ObjectDict` output type as alternative to `torch.Tensor`. This alternative is opt-in for\n  now (for backwards-compatibility), but note that the old output type (`torch.Tensor`) is\n  deprecated and support for it will be removed in a future version.\n* Allow specifying a file path, a folder path, a list of files or a list of folders to\n  `AddBackgroundNoise` and `ApplyImpulseResponse`\n* Require newer version of `torch-pitch-shift` to ensure support for torchaudio 0.11 in `PitchShift`\n\n### Fixed\n\n* Fix a bug where `BandPassFilter` didn't work on GPU\n\n## [v0.10.1] - 2022-03-24\n\n### Added\n\n* Add support for min SNR == max SNR in `AddBackgroundNoise`\n* Add support for librosa 0.9.0\n\n### Fixed\n\n* Fix a bug where loaded audio snippets were sometimes resampled to an incompatible\n length in `AddBackgroundNoise`\n\n## [v0.10.0] - 2022-02-11\n\n### Added\n\n* Implement `OneOf` and `SomeOf` for applying one or more of a given set of transforms\n* Implement new transforms: `BandStopFilter` and `TimeInversion`\n\n### Changed\n\n* Put `ir_paths` in transform_parameters in `ApplyImpulseResponse` so it is possible\n to inspect what impulse responses were used. This also gives `freeze_parameters()`\n the expected behavior.\n\n### Fixed\n\n* Fix a bug where the actual bandwidth was twice as large as expected in\n `BandPassFilter`. The default values have been updated accordingly.\n If you were previously specifying `min_bandwidth_fraction` and\u002For `max_bandwidth_fraction`,\n you now need to double those numbers to get the same behavior as before.\n\n## [v0.9.1] - 2021-12-20\n\n### Added\n\n* Officially mark python>=3.9 as supported\n\n## [v0.9.0] - 2021-10-11\n\n### Added\n\n* Add parameter `compensate_for_propagation_delay` in `ApplyImpulseResponse`\n* Implement `BandPassFilter`\n* Implement `PitchShift`\n\n### Removed\n\n* Support for torchaudio\u003C=0.6 has been removed\n\n## [v0.8.0] - 2021-06-15\n\n### Added\n\n* Implement `HighPassFilter` and `LowPassFilter`\n\n### Deprecated\n\n* Support for torchaudio\u003C=0.6 is deprecated and will be removed in the future\n\n### Removed\n\n* Support for pytorch\u003C=1.6 has been removed\n\n## [v0.7.0] - 2021-04-16\n\n### Added\n\n* Implement `AddColoredNoise`\n\n### Deprecated\n\n* Support for pytorch\u003C=1.6 is deprecated and will be removed in the future\n\n## [v0.6.0] - 2021-02-22\n\n### Added\n\n* Implement `ShuffleChannels`\n\n## [v0.5.1] - 2020-12-18\n\n### Fixed\n\n* Fix a bug where `AddBackgroundNoise` did not work on CUDA\n* Fix a bug where symlinked audio files\u002Ffolders were not found when looking for audio files\n* Use torch.fft.rfft instead of the torch.rfft (deprecated in pytorch 1.7) when possible. As a\nbonus, the change also improves performance in `ApplyImpulseResponse`.\n\n## [v0.5.0] - 2020-12-08\n\n### Added\n\n* Release `AddBackgroundNoise` and `ApplyImpulseResponse`\n* Implement `Shift`\n\n### Changed\n\n* Make `sample_rate` optional. Allow specifying `sample_rate` in `__init__` instead of `forward`. This means torchaudio transforms can be used in `Compose` now.\n\n### Removed\n\n* Remove support for 1-dimensional and 2-dimensional audio tensors. Only 3-dimensional audio\n tensors are supported now.\n\n### Fixed\n\n* Fix a bug where one could not use the `parameters` method of the `nn.Module` subclass\n* Fix a bug where files with uppercase filename extension were not found\n\n## [v0.4.0] - 2020-11-10\n\n### Added\n\n* Implement `Compose` for applying multiple transforms\n* Implement utility functions `from_dict` and `from_yaml` for loading data augmentation\nconfigurations from dict, json or yaml\n* Officially support differentiability in most transforms\n\n## [v0.3.0] - 2020-10-27\n\n### Added\n\n* Add support for alternative modes `per_batch` and `per_channel`\n\n### Changed\n\n* Transforms now return the input unchanged when they are in eval mode\n\n## [v0.2.0] - 2020-10-19\n\n### Added\n\n* Implement `PeakNormalization`\n* Expose `convolve` in the API\n\n### Changed\n\n* Simplify API for using CUDA tensors. The device is now inferred from the input tensor.\n\n## [v0.1.0] - 2020-10-12\n\n### Added\n\n* Initial release with `Gain` and `PolarityInversion`\n\n# Development\n\n## Setup\n\nA GPU-enabled development environment for torch-audiomentations can be created with conda:\n\n* `conda env create`\n\n## Run tests\n\n`pytest`\n\n## Conventions\n\n* Format python code with [black](https:\u002F\u002Fgithub.com\u002Fpsf\u002Fblack)\n* Use [Google-style docstrings](https:\u002F\u002Fgoogle.github.io\u002Fstyleguide\u002Fpyguide.html#381-docstrings)\n* Use explicit relative imports, not absolute imports\n\n# Acknowledgements\n\nThe development of torch-audiomentations is kindly backed by [Nomono](https:\u002F\u002Fnomono.co\u002F).\n\nThanks to [all contributors](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fgraphs\u002Fcontributors) who help improving torch-audiomentations.\n","![torch-audiomentations](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fiver56_torch-audiomentations_readme_af1f14adddc4.png)\n---\n\n![构建状态](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fci.yml?branch=main)\n[![代码覆盖率](https:\u002F\u002Fimg.shields.io\u002Fcodecov\u002Fc\u002Fgithub\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fmain.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fasteroid-team\u002Ftorch-audiomentations)\n[![代码风格：Black](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcode%20style-black-black.svg)](https:\u002F\u002Fgithub.com\u002Fambv\u002Fblack)\n[![DOI](https:\u002F\u002Fzenodo.org\u002Fbadge\u002FDOI\u002F10.5281\u002Fzenodo.14650813.svg)](https:\u002F\u002Fdoi.org\u002F10.5281\u002Fzenodo.14650813)\n\nPyTorch 中的音频数据增强。灵感来源于 [audiomentations](https:\u002F\u002Fgithub.com\u002Fiver56\u002Faudiomentations)。\n\n* 支持 CPU 和 GPU (CUDA) - 速度优先\n* 支持多通道（或单声道）音频批次\n* 变换扩展了 `nn.Module`，因此可以作为 PyTorch 神经网络模型的一部分进行集成\n* 大多数变换是可微的\n* 三种模式：`per_batch`、`per_example` 和 `per_channel`\n* 跨平台兼容性\n* 宽松的 MIT 许可证\n* 目标是高测试覆盖率\n\n# 安装\n\n![Python 版本支持](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Ftorch-audiomentations)\n[![PyPI 版本](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Ftorch-audiomentations.svg?style=flat)](https:\u002F\u002Fpypi.org\u002Fproject\u002Ftorch-audiomentations\u002F)\n[![每月 PyPI 下载量](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Ftorch-audiomentations.svg?style=flat)](https:\u002F\u002Fpypi.org\u002Fproject\u002Ftorch-audiomentations\u002F)\n\n`pip install torch-audiomentations`\n\n# 使用示例\n\n```python\nimport torch\nfrom torch_audiomentations import Compose, Gain, PolarityInversion\n\n\n# 初始化增强可调用对象\napply_augmentation = Compose(\n    transforms=[\n        Gain(\n            min_gain_in_db=-15.0,\n            max_gain_in_db=5.0,\n            p=0.5,\n        ),\n        PolarityInversion(p=0.5)\n    ]\n)\n\ntorch_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n\n# 创建一个包含白噪声的示例张量。\n# 该张量表示 8 个音频片段，每个片段有 2 个通道（立体声），时长 2 秒，采样率为 16 kHz。\naudio_samples = torch.rand(size=(8, 2, 32000), dtype=torch.float32, device=torch_device) - 0.5\n\n# 应用增强。这会独立地改变批次中（部分）音频片段的增益和极性。\nperturbed_audio_samples = apply_augmentation(audio_samples, sample_rate=16000)\n```\n\n# 已知问题\n\n* 目标数据处理仍处于实验阶段 ([#3](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F3))。解决方法：如果目标数据与输入具有相同形状，目前可以使用 `freeze_parameters` 和 `unfreeze_parameters`。\n* 在多进程环境中使用 torch-audiomentations 可能会导致内存泄漏 ([#132](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F132))。解决方法：如果在多进程环境中使用 torch-audiomentations，最好在 CPU 上运行变换。\n* 不正式支持多 GPU \u002F DDP ([#136](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F136))。作者没有多 GPU 配置来测试和修复此问题。如果您愿意为此捐赠硬件，请联系我们。解决方法：改用单 GPU 运行变换。\n* `PitchShift` 不支持小幅度音高变换，尤其是在低采样率下 ([#151](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fissues\u002F151))。解决方法：如果需要对低采样率音频应用小幅度音高变换，可以直接使用 [audiomentations 中的 PitchShift](https:\u002F\u002Fiver56.github.io\u002Faudiomentations\u002Fwaveform_transforms\u002Fpitch_shift\u002F) 或 [torch-pitch-shift](https:\u002F\u002Fgithub.com\u002FKentoNishi\u002Ftorch-pitch-shift\u002F)，而无需使用计算高效音高变换目标的函数。\n\n# 贡献\n\n欢迎贡献者！\n[加入 Asteroid 的 Slack](https:\u002F\u002Fjoin.slack.com\u002Ft\u002Fasteroid-dev\u002Fshared_invite\u002Fzt-cn9y85t3-QNHXKD1Et7qoyzu1Ji5bcA)\n与我们一起讨论 `torch-audiomentations`。\n\n# 动机：速度\n\n我们不希望数据增强成为模型训练速度的瓶颈。以下是运行 1D 卷积所需时间的比较：\n\n![卷积执行时间](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fiver56_torch-audiomentations_readme_1e1d9abbd747.png)\n\n注意：并非所有变换与 CPU 相比都有如此显著的速度提升。一般来说，在 GPU 上运行音频数据增强并不总是最佳选择。更多信息请参阅这篇文章：[https:\u002F\u002Fiver56.github.io\u002Faudiomentations\u002Fguides\u002Fcpu_vs_gpu\u002F](https:\u002F\u002Fiver56.github.io\u002Faudiomentations\u002Fguides\u002Fcpu_vs_gpu\u002F)\n\n# 当前状态\n\ntorch-audiomentations 处于早期开发阶段，因此 API 可能会发生变化。\n\n# 波形变换\n\n每个变换都具有 `mode`、`p` 和 `p_mode`——这些参数决定了增强如何执行。\n- `mode` 决定增强的随机化如何分组和应用。\n- `p` 决定应用增强的概率。\n- `p_mode` 决定增强的开启或关闭方式。\n\n此可视化展示了不同 `mode` 和 `p_mode` 组合如何执行增强。\n\n![mode、p 和 p_mode 解释](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fiver56_torch-audiomentations_readme_4853671240fa.png)\n    \n\n## AddBackgroundNoise\n\n*新增于 v0.5.0*\n\n向输入音频添加背景噪声。\n\n## AddColoredNoise\n\n*新增于 v0.7.0*\n\n向输入音频添加彩色噪声。\n\n## ApplyImpulseResponse\n\n*新增于 v0.5.0*\n\n将给定音频与冲激响应进行卷积。\n\n## BandPassFilter\n\n*新增于 v0.9.0*\n\n对输入音频应用带通滤波。\n\n## BandStopFilter\n\n*新增于 v0.10.0*\n\n对输入音频应用带阻滤波，也称为陷波滤波器。\n\n## Gain\n\n*新增于 v0.1.0*\n\n通过随机振幅因子乘以音频，以降低或增加音量。此技术可以帮助模型对输入音频的整体增益具有一定不变性。\n\n警告：此变换可能会返回超出 [-1, 1] 范围的样本，这可能导致削波或环绕失真，具体取决于后续对音频的处理方式。另请参阅 https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FClipping_(audio)#Digital_clipping\n\n## HighPassFilter\n\n*新增于 v0.8.0*\n\n对输入音频应用高通滤波。\n\n## Identity\n\n*新增于 v0.11.0*\n\n此变换返回未更改的输入。在需要禁用数据增强的情况下，可用于简化代码。\n\n## LowPassFilter\n\n*新增于 v0.8.0*\n\n对输入音频应用低通滤波。\n\n## PeakNormalization\n\n*新增于 v0.2.0*\n\n应用恒定增益，使批次中每个音频片段中的最高信号电平达到 0 dBFS，即当所有样本必须介于 -1 和 1 之间时允许的最响度级别。\n\n此变换有一个替代模式（apply_to=\"only_too_loud_sounds\"），仅对那些信号值严重超出 [-1, 1] 范围的音频片段应用增益。这有助于避免过响音频出现数字削波，同时保持其他音频不变。\n\n## PitchShift\n\n*新增于 v0.9.0*\n\n在不改变节奏的情况下升高或降低音高。\n\n## 极性反转\n\n_在 v0.1.0 中添加_\n\n将音频样本上下翻转，从而反转其极性。换句话说，就是将波形乘以 -1，使负值变为正值，反之亦然。单独播放时，结果听起来与原始音频相同。然而，当与其他音频源混合时，结果可能会有所不同。这种波形反转技术有时用于音频抵消或获取两个波形之间的差异。不过，在音频数据增强的背景下，这种变换在训练对相位敏感的机器学习模型时可能很有用。\n\n## 时移\n\n_在 v0.5.0 中添加_\n\n将音频向前或向后移动，可以选择是否循环。\n\n## 通道混洗\n\n_在 v0.6.0 中添加_\n\n对于多声道音频输入（例如立体声），可以随机混洗声道顺序，比如将左声道变为右声道，反之亦然。这种变换有助于缓解输入多声道波形的机器学习模型中的位置偏差问题。\n\n如果输入音频是单声道，则此变换不会产生任何效果，只会发出警告。\n\n## 时间反转\n\n_在 v0.10.0 中添加_\n\n类似于视觉领域中对图像进行随机翻转一样，沿着时间轴反转（倒置）音频。这在音频分类任务中可能具有一定的意义。该方法已在论文《AudioCLIP：将 CLIP 扩展至图像、文本和音频》中成功应用，详见 [arXiv:2106.13043](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2106.13043.pdf)。\n\n# 更改记录\n\n## 尚未发布\n\n### 新增\n\n* 添加新变换：`Mix`、`Padding`、`RandomCrop` 和 `SpliceOut`\n\n## [v0.12.0] - 2025-01-15\n\n### 移除\n\n* 移除对 `librosa` 的依赖，改为使用 `torchaudio`\n\n## [v0.11.2] - 2025-01-09\n\n### 修复\n\n* 修复在多 GPU 训练时 `transform_parameters` 中与设备相关的错误\n* 修复 `AddColoredNoise` 中与形状相关的边缘情况错误\n* 修复将不兼容的 Path 数据类型传递给 `torchaudio.info` 的问题\n\n## [v0.11.1] - 2024-02-07\n\n### 变更\n\n* 在 `LowPassFilter` 和 `HighPassFilter` 中增加对固定截止频率的支持\n* 在 `AddColoredNoise` 中增加对 `min_f_decay == max_f_decay` 的支持\n* 将 `torchaudio` 的最低版本要求从 >=0.7.0 提升至 >=0.9.0\n\n### 修复\n\n* 修复 `Shift` 中不准确的类型提示\n* 移除 `set_backend`，以避免 `torchaudio` 产生的 `UserWarning`\n\n## [v0.11.0] - 2022-06-29\n\n### 新增\n\n* 添加新变换：`Identity`\n* 增加处理目标与输入同时进行的 API。部分变换已经实验性地支持此功能。\n\n### 变更\n\n* 增加 `ObjectDict` 输出类型，作为 `torch.Tensor` 的替代选项。目前该替代选项为可选（出于向后兼容性考虑），但请注意，旧的输出类型（`torch.Tensor`）已被弃用，并将在未来的版本中完全移除。\n* 允许为 `AddBackgroundNoise` 和 `ApplyImpulseResponse` 指定文件路径、文件夹路径、文件列表或文件夹列表。\n* 要求使用更新版本的 `torch-pitch-shift`，以确保 `PitchShift` 能够兼容 `torchaudio 0.11`。\n\n### 修复\n\n* 修复 `BandPassFilter` 在 GPU 上无法正常工作的问题。\n\n## [v0.10.1] - 2022-03-24\n\n### 新增\n\n* 在 `AddBackgroundNoise` 中增加对最小信噪比等于最大信噪比的支持\n* 增加对 librosa 0.9.0 的支持。\n\n### 修复\n\n* 修复 `AddBackgroundNoise` 中加载的音频片段有时会被重新采样为不兼容长度的问题。\n\n## [v0.10.0] - 2022-02-11\n\n### 新增\n\n* 实现 `OneOf` 和 `SomeOf`，用于从一组变换中随机选择一个或多个应用\n* 实现新变换：`BandStopFilter` 和 `TimeInversion`\n\n### 变更\n\n* 将 `ir_paths` 放入 `ApplyImpulseResponse` 的 `transform_parameters` 中，以便检查所使用的脉冲响应。这也使 `freeze_parameters()` 表现出预期的行为。\n\n### 修复\n\n* 修复 `BandPassFilter` 中实际带宽是预期值两倍的问题。默认值已相应更新。如果您之前指定了 `min_bandwidth_fraction` 和\u002F或 `max_bandwidth_fraction`，现在需要将这些数值加倍才能获得与以前相同的效果。\n\n## [v0.9.1] - 2021-12-20\n\n### 新增\n\n* 正式声明支持 Python >=3.9。\n\n## [v0.9.0] - 2021-10-11\n\n### 新增\n\n* 在 `ApplyImpulseResponse` 中添加参数 `compensate_for_propagation_delay`\n* 实现 `BandPassFilter`\n* 实现 `PitchShift`\n\n### 移除\n\n* 已移除对 `torchaudio \u003C=0.6` 的支持。\n\n## [v0.8.0] - 2021-06-15\n\n### 新增\n\n* 实现 `HighPassFilter` 和 `LowPassFilter`\n\n### 弃用\n\n* 对 `torchaudio \u003C=0.6` 的支持已被弃用，未来将被移除。\n\n### 移除\n\n* 已移除对 PyTorch \u003C=1.6 的支持。\n\n## [v0.7.0] - 2021-04-16\n\n### 新增\n\n* 实现 `AddColoredNoise`\n\n### 弃用\n\n* 对 PyTorch \u003C=1.6 的支持已被弃用，未来将被移除。\n\n## [v0.6.0] - 2021-02-22\n\n### 新增\n\n* 实现 `ShuffleChannels`\n\n## [v0.5.1] - 2020-12-18\n\n### 修复\n\n* 修复 `AddBackgroundNoise` 在 CUDA 上无法正常工作的问题\n* 修复查找音频文件时无法找到符号链接的音频文件或文件夹的问题\n* 尽可能使用 `torch.fft.rfft` 替代 `torch.rfft`（已在 PyTorch 1.7 中弃用）。此外，这一改动还提升了 `ApplyImpulseResponse` 的性能。\n\n## [v0.5.0] - 2020-12-08\n\n### 新增\n\n* 发布 `AddBackgroundNoise` 和 `ApplyImpulseResponse`\n* 实现 `Shift`\n\n### 变更\n\n* 将 `sample_rate` 设置为可选。允许在 `__init__` 中指定 `sample_rate`，而不是在 `forward` 中指定。这意味着现在可以在 `Compose` 中使用 `torchaudio` 的变换。\n\n### 移除\n\n* 移除对 1 维和 2 维音频张量的支持。目前仅支持 3 维音频张量。\n\n### 修复\n\n* 修复无法使用 `nn.Module` 子类的 `parameters` 方法的问题\n* 修复无法找到文件扩展名为大写的文件的问题。\n\n## [v0.4.0] - 2020-11-10\n\n### 新增\n\n* 实现 `Compose` 以应用多个变换\n* 实现实用函数 `from_dict` 和 `from_yaml`，用于从字典、JSON 或 YAML 中加载数据增强配置\n* 正式支持大多数变换的可微性。\n\n## [v0.3.0] - 2020-10-27\n\n### 新增\n\n* 增加对 `per_batch` 和 `per_channel` 等替代模式的支持。\n\n### 变更\n\n* 变换在评估模式下会返回未经修改的输入。\n\n## [v0.2.0] - 2020-10-19\n\n### 新增\n\n* 实现 `PeakNormalization`\n* 在 API 中公开 `convolve`\n\n### 变更\n\n* 简化了使用 CUDA 张量的 API。设备现在会根据输入张量自动推断。\n\n## [v0.1.0] - 2020-10-12\n\n### 新增\n\n* 初始发布，包含 `Gain` 和 `PolarityInversion`。\n\n# 开发\n\n## 设置\n\n可以通过 conda 创建一个支持 GPU 的 torch-audiomentations 开发环境：\n\n* `conda env create`\n\n## 运行测试\n\n`pytest`\n\n## 规范\n\n* 使用 [black](https:\u002F\u002Fgithub.com\u002Fpsf\u002Fblack) 格式化 Python 代码\n* 使用 [Google 风格的文档字符串](https:\u002F\u002Fgoogle.github.io\u002Fstyleguide\u002Fpyguide.html#381-docstrings)\n* 使用显式的相对导入，而非绝对导入\n\n# 致谢\n\ntorch-audiomentations 的开发得到了 [Nomono](https:\u002F\u002Fnomono.co\u002F) 的大力支持。\n\n感谢所有为改进 torch-audiomentations 做出贡献的 [贡献者](https:\u002F\u002Fgithub.com\u002Fasteroid-team\u002Ftorch-audiomentations\u002Fgraphs\u002Fcontributors)。","# torch-audiomentations 快速上手指南\n\n`torch-audiomentations` 是一个基于 PyTorch 的音频数据增强库，专为深度学习模型训练设计。它支持 CPU 和 GPU 加速，可直接作为 `nn.Module` 集成到神经网络中，并支持批量多通道音频处理。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：跨平台支持 (Linux, macOS, Windows)\n*   **Python 版本**：建议 Python 3.8 及以上\n*   **核心依赖**：\n    *   `torch` (PyTorch)\n    *   `torchaudio` (版本 >= 0.9.0)\n*   **硬件加速**：可选 NVIDIA GPU (需安装对应的 CUDA 版本以启用 GPU 加速)\n\n## 安装步骤\n\n推荐使用 pip 进行安装。国内开发者建议使用清华或阿里镜像源以提升下载速度。\n\n**使用默认源安装：**\n```bash\npip install torch-audiomentations\n```\n\n**使用国内镜像源安装（推荐）：**\n```bash\npip install torch-audiomentations -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n## 基本使用\n\n以下示例展示了如何初始化一个包含增益调整 (`Gain`) 和极性反转 (`PolarityInversion`) 的增强管道，并将其应用于一个批次的立体声音频张量。\n\n```python\nimport torch\nfrom torch_audiomentations import Compose, Gain, PolarityInversion\n\n\n# 1. 初始化增强组合 (Compose)\napply_augmentation = Compose(\n    transforms=[\n        Gain(\n            min_gain_in_db=-15.0,\n            max_gain_in_db=5.0,\n            p=0.5,  # 50% 的概率应用此变换\n        ),\n        PolarityInversion(p=0.5)  # 50% 的概率应用此变换\n    ]\n)\n\n# 2. 设置设备 (自动检测 CUDA 或 CPU)\ntorch_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n\n# 3. 创建示例音频张量\n# 形状说明：(Batch_Size=8, Channels=2, Samples=32000)\n# 代表 8 段立体声音频，采样率 16kHz，时长 2 秒\naudio_samples = torch.rand(size=(8, 2, 32000), dtype=torch.float32, device=torch_device) - 0.5\n\n# 4. 应用增强\n# 注意：必须传入 sample_rate 参数\nperturbed_audio_samples = apply_augmentation(audio_samples, sample_rate=16000)\n\n# 输出结果形状与输入一致\nprint(perturbed_audio_samples.shape) \n```\n\n**关键特性提示：**\n*   **模式选择**：大多数变换支持 `per_batch`（整批统一）、`per_example`（每段音频独立）和 `per_channel`（每声道独立）三种随机化模式。\n*   **可微分性**：大部分变换是可微分的，适合端到端训练。\n*   **设备兼容**：代码会自动根据输入张量所在的设备（CPU\u002FGPU）执行运算，无需手动迁移变换对象。","某语音识别初创团队正在训练一个鲁棒的噪声环境语音命令识别模型，需要处理海量立体声音频数据。\n\n### 没有 torch-audiomentations 时\n- **训练速度受限**：传统增强库仅在 CPU 运行，数据预处理成为 GPU 训练的瓶颈，导致显卡经常空闲等待数据。\n- **集成流程繁琐**：增强逻辑独立于模型之外，需要在 DataLoader 中额外编写复杂的管道代码，难以实现端到端优化。\n- **多通道支持薄弱**：处理立体声或麦克风阵列数据时，往往需要手动循环处理每个声道，代码冗余且易出错。\n- **无法联合优化**：由于增强操作不可微，无法将数据增强策略作为模型的一部分进行梯度反向传播或联合调优。\n\n### 使用 torch-audiomentations 后\n- **GPU 加速显著提升**：直接利用 CUDA 在显卡上并行执行增益调整、极性反转等增强操作，消除了数据加载瓶颈，训练吞吐量翻倍。\n- **原生无缝集成**：增强变换继承自 `nn.Module`，可直接嵌入神经网络结构中，像普通网络层一样被调用和管理。\n- **高效批量处理**：原生支持多通道音频的批量（Batch）处理，一行代码即可同时对整个批次的立体声数据进行差异化增强。\n- **支持可微训练**：大多数变换具备可微性，为未来探索基于梯度的自适应数据增强策略奠定了技术基础。\n\ntorch-audiomentations 通过将音频增强深度融入 PyTorch 计算图并启用 GPU 加速，彻底解决了深度学习语音任务中的数据供给效率难题。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fiver56_torch-audiomentations_1e1d9abb.png","iver56","Iver Jordal","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fiver56_2468ce37.jpg","Machine learning, audio\u002Fmusic tech, computer vision, demoscene, web technology, games, startup.\r\n\r\nI mainly write Python. I also enjoy Go, C, Rust and JS.","ElevenLabs","Trondheim, Norway",null,"https:\u002F\u002Fgithub.com\u002Fiver56",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,1143,"2026-04-09T10:13:23","MIT",1,"Linux, macOS, Windows","非必需。支持 CPU 和 GPU (CUDA)。多 GPU\u002FDDP 官方不支持，建议在单 GPU 或 CPU 上运行以避免已知问题。未指定具体显存大小和 CUDA 版本要求。","未说明",{"notes":93,"python":94,"dependencies":95},"1. 该工具旨在加速音频数据增强，优先支持 GPU 但并非所有变换在 GPU 上都比 CPU 快。2. 已知在 multiprocessing（多进程）环境下使用可能导致内存泄漏，建议此时在 CPU 上运行变换。3. 官方不支持多 GPU (DDP) 设置。4. PitchShift 变换在低采样率下不支持微小的音高偏移。5. 目标数据处理功能仍处于实验阶段。6. v0.12.0 已移除 librosa 依赖，改用 torchaudio。","3.7+",[96,97,98],"torch","torchaudio>=0.9.0","torch-pitch-shift",[100,14,16],"音频",[102,103,104,105,106,107,108,109,110,111,112,113,114,115,116],"data-augmentation","pytorch","audio-data-augmentation","audio","waveform","dsp","audio-effects","machine-learning","deep-learning","music","sound","sound-processing","augmentation","python","differentiable-data-augmentation","2026-03-27T02:49:30.150509","2026-04-10T07:47:03.769281",[120,125,130,135,140,145,150,154],{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},27337,"为什么在使用 PitchShift 变换时会报错 \"No fast pitch-shift ratios could be computed\"，或者在 CPU 上运行速度极慢？","该错误通常发生在特定的采样率和变调范围组合下，导致无法计算快速的移调比率。此外，PitchShift 在 CPU 上本身就是一个计算密集型操作，速度较慢（audiomentations 的 CPU 版本通常快 3 倍）。如果某些移调因子导致 GPU 数据传输成为瓶颈或引发错误，建议在 CPU 上应用基于 CPU 的移调方案，或者调整 min\u002Fmax 范围（例如从 -0.2~0.2 调整为 -0.5~0.5 可能避免错误，但需视数据有效性而定）。","https:\u002F\u002Fgithub.com\u002Fiver56\u002Ftorch-audiomentations\u002Fissues\u002F151",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},27338,"遇到 \"TypeError: Invalid file: PosixPath(...)\" 错误时该如何解决？","这通常与音频后端配置有关。可以通过设置 torchaudio 的后端为 \"sox_io\" 来解决。请在代码初始化部分添加以下命令：\n`torchaudio.set_audio_backend(\"sox_io\")`\n这能确保文件路径处理的正确性和一致性。","https:\u002F\u002Fgithub.com\u002Fiver56\u002Ftorch-audiomentations\u002Fissues\u002F152",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},27339,"如何将多个音频文件加载到一个张量中进行批量处理？","你需要使用循环配合 `torchaudio.load()` 加载文件，然后将它们堆叠成一个多维张量。对于批处理，张量形状通常为 `(batch_size, num_samples)` 或 `(batch_size, channels, samples)`。注意，如果使用 `AddBackgroundNoise` 等变换，频繁加载小文件可能会造成 I\u002FO 瓶颈。在这种情况下，考虑直接使用张量或数组传入噪声数据，而不是每次都从磁盘加载文件路径列表，以减少开销。","https:\u002F\u002Fgithub.com\u002Fiver56\u002Ftorch-audiomentations\u002Fissues\u002F168",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},27340,"torch-audiomentations 是否支持多通道（multichannel）音频？张量形状应该是怎样的？","是的，库支持多通道音频。推荐的张量形状约定是 \"Channels First\"（通道在前），即形状为 `[batch_size, num_channels, num_samples]`。这种格式与波形处理惯例一致，也方便进行卷积操作（如 STFT）。虽然某些变换可能暂时只支持 2D 张量 `(batch_size, num_samples)`，但多通道支持正在逐步完善中。","https:\u002F\u002Fgithub.com\u002Fiver56\u002Ftorch-audiomentations\u002Fissues\u002F2",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},27341,"BaseWaveTransformation 是否支持批量（Batch）GPU 变换？如何处理批次数据？","目前的 `BaseWaveTransformation` 设计主要针对单条音频或将其误判为多通道音频。对于 `AddBackgroundNoise` 和 `AddImpulseResponse` 等特定变换，它们支持批次输入，期望的张量形状是 2D 的 `(batch_size, num_samples)`。如果你需要创建新的支持批次的变换，需注意当前架构对批次和多通道的区分逻辑，未来可能会有重构以更好地原生支持批次维度。","https:\u002F\u002Fgithub.com\u002Fiver56\u002Ftorch-audiomentations\u002Fissues\u002F39",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},27342,"如何通过配置文件实例化增强变换以保证实验的可复现性？","可以通过 YAML 配置文件来定义增强参数。例如，创建一个 `config.yaml` 文件，内容如下：\n```yaml\nCompose:\n    AddGaussianNoise:\n        min_amplitude: 0.001\n        max_amplitude: 0.015\n        p: 0.5\n    TimeStretch:\n        min_rate: 0.8\n        max_rate: 1.25\n        p: 0.5\n```\n然后在 Python 代码中使用 `torch_audiomentations.from_config(yaml.load(fp))` 加载配置。这需要确保环境中已安装 `yaml` 库。","https:\u002F\u002Fgithub.com\u002Fiver56\u002Ftorch-audiomentations\u002Fissues\u002F25",{"id":151,"question_zh":152,"answer_zh":153,"source_url":129},27343,"哪些增强变换是可微分（differentiable）的，可以用于模型的前向传播函数中？","并非所有的增强变换都是可微分的。目前库中没有明确标记所有变换的可微分状态。如果你计划将增强引入模型的前向函数（forward function）进行端到端训练，建议逐个测试变换是否支持梯度回传，或者查阅具体变换的源码实现。维护者曾提到这是一个值得关注的点，但尚未提供完整的白名单。",{"id":155,"question_zh":156,"answer_zh":157,"source_url":158},27344,"如何优化 Shift 变换的执行时间？","经过对比测试，使用 `torch.roll` 实现的移位操作比传统方法更快且更节省内存。库中已经采用了这种优化方案。如果发现执行时间仍然较长，请确保使用的是最新版本，并检查是否在其他环节（如数据加载或 GPU 传输）存在瓶颈。","https:\u002F\u002Fgithub.com\u002Fiver56\u002Ftorch-audiomentations\u002Fissues\u002F41",[160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224],{"id":161,"version":162,"summary_zh":78,"released_at":163},180462,"v0.12.0","2025-01-15T09:05:36",{"id":165,"version":166,"summary_zh":78,"released_at":167},180463,"v0.11.2","2025-01-09T12:34:44",{"id":169,"version":170,"summary_zh":170,"released_at":171},180464,"v0.11.1","2024-02-07T10:02:11",{"id":173,"version":174,"summary_zh":78,"released_at":175},180465,"v0.11.0","2022-06-29T08:44:53",{"id":177,"version":178,"summary_zh":78,"released_at":179},180466,"v0.10.1","2022-03-24T09:09:29",{"id":181,"version":182,"summary_zh":78,"released_at":183},180467,"v0.10.0","2022-02-11T14:53:33",{"id":185,"version":186,"summary_zh":78,"released_at":187},180468,"v0.9.1","2022-02-11T14:53:19",{"id":189,"version":190,"summary_zh":78,"released_at":191},180469,"v0.9.0","2022-02-11T14:52:53",{"id":193,"version":194,"summary_zh":78,"released_at":195},180470,"v0.8.0","2022-02-11T14:52:42",{"id":197,"version":198,"summary_zh":78,"released_at":199},180471,"v0.7.0","2022-02-11T14:52:29",{"id":201,"version":202,"summary_zh":78,"released_at":203},180472,"v0.6.0","2022-02-11T14:51:39",{"id":205,"version":206,"summary_zh":78,"released_at":207},180473,"v0.5.1","2022-02-11T14:51:29",{"id":209,"version":210,"summary_zh":78,"released_at":211},180474,"v0.5.0","2022-02-11T14:51:06",{"id":213,"version":214,"summary_zh":78,"released_at":215},180475,"v0.4.0","2022-02-11T14:50:58",{"id":217,"version":218,"summary_zh":78,"released_at":219},180476,"v0.3.0","2022-02-11T14:50:49",{"id":221,"version":222,"summary_zh":78,"released_at":223},180477,"v0.2.0","2022-02-11T14:50:08",{"id":225,"version":226,"summary_zh":78,"released_at":227},180478,"v0.1.0","2022-02-11T14:49:55"]