[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-xinjli--allosaurus":3,"tool-xinjli--allosaurus":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 真正成长为懂上",149489,2,"2026-04-10T11:32:46",[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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[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},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"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":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":77,"owner_twitter":77,"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":97,"github_topics":99,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":104,"updated_at":105,"faqs":106,"releases":137},6310,"xinjli\u002Fallosaurus","allosaurus","Allosaurus is a pretrained universal phone recognizer for more than 2000 languages","Allosaurus 是一款预训练的通用音素识别工具，能够自动从音频文件中提取出超过 2000 种语言的音素序列。它主要解决了传统语音识别系统依赖特定语言数据、难以覆盖全球小众语言的痛点，让开发者无需重新训练模型即可处理多语种音频分析任务。\n\n这款工具特别适合语音技术研究人员、自然语言处理开发者以及需要构建多语言语音应用的企业团队使用。无论是进行语言学研究、构建语音助手，还是开发跨语言翻译系统，Allosaurus 都能提供基础的音素标注支持。普通用户若对语音分析感兴趣，也可通过简单命令快速体验。\n\n其核心技术亮点在于基于“多语言异音系统”架构，仅需一个统一模型即可适配全球约 230 种国际音标（IPA）音素。用户既可以通过命令行快速处理 WAV 格式音频，也能在 Python 代码中直接调用接口。工具支持自动重采样和单声道处理，并允许指定特定语言音素集以提升识别准确率。作为开源项目，Allosaurus 降低了多语言语音处理的门槛，为全球化语音技术应用提供了灵活高效的基础设施。","# Allosaurus\n\n![CI Test](https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Factions\u002Fworkflows\u002Fpython.yml\u002Fbadge.svg)\n\nAllosaurus is a pretrained universal phone recognizer. It can be used to recognize phones in more than 2000 languages.\n\nThis tool is based on our ICASSP 2020 work [Universal Phone Recognition with a Multilingual Allophone System](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2002.11800.pdf)\n\n![Architecture](arch.png?raw=true \"Architecture\")\n\n## Get Started\n\n### Install\nAllosaurus is available from pip\n```bash\npip install allosaurus\n```\n \nYou can also clone this repository and install \n```bash\npython setup.py install\n```\n\n### Quick start\nThe basic usage is pretty simple, your input is an wav audio file and output is a sequence of phones.\n\n```bash\npython -m allosaurus.run  -i \u003Caudio>\n```\n\nFor example, you can try using the attached sample file in this repository. Guess what's in this audio file :)\n```bash\npython -m allosaurus.run -i sample.wav\næ l u s ɔ ɹ s\n```\n\nYou can also use allosaurus directly in python\n```python\nfrom allosaurus.app import read_recognizer\n\n# load your model\nmodel = read_recognizer()\n\n# run inference -> æ l u s ɔ ɹ s\nmodel.recognize('sample.wav')\n```\n\nFor full features and details, please refer to the following sections.\n\n## Inference \nThe command line interface is as follows:\n \n```bash\npython -m allosaurus.run [--lang \u003Clanguage name>] [--model \u003Cmodel name>] [--device_id \u003Cgpu_id>] [--output \u003Coutput_file>] [--topk \u003Cint>] -i \u003Caudio file\u002Fdirectory>\n```\nIt will recognize the narrow phones in the audio file(s).\nOnly the input argument is mandatory, other options can ignored. Please refer to following sections for their details. \n\nThere is also a simple python interface as follows:\n```python\nfrom allosaurus.app import read_recognizer\n\n# load your model by the \u003Cmodel name>, will use 'latest' if left empty\nmodel = read_recognizer(model)\n\n# run inference on \u003Caudio_file> with \u003Clang>, lang will be 'ipa' if left empty\nmodel.recognize(audio_file, lang)\n```\n\nThe details of arguments in both interface are as follows:\n### Input\nThe input can be a single file or a directory containing multiple audio files.\n\nIf the input is a single file, it will output only the phone sequence; if the input is a directory, it will output both the file name and phone sequence, results will be sorted by file names. \n\nThe audio file(s) should be in the following format:\n\n* It should be a wav file. If the audio is not in the wav format, please convert your audio to a wav format using sox or ffmpeg in advance.\n\n* The sampling rate can be arbitrary, we will automatically resample them based on models' requirements.\n\n* We assume the audio is a mono-channel audio.\n\n### Output\nThe output is by default stdout (i.e. it will print all results to terminal).\n\nIf you specify a file as the output, then all output will be directed to that file.\n\n### Language\nThe `lang` option is the language id. It is to specify the phone inventory you want to use.\nThe default option is `ipa` which tells the recognizer to use the the entire inventory (around 230 phones).\n\nGenerally, specifying the language inventory can improve your recognition accuracy.\n\nYou can check the full language list with the following command. The number of available languages is around 2000. \n```bash\npython -m allosaurus.bin.list_lang\n```\n\nTo check language's inventory you can use following command\n```bash\npython -m allosaurus.bin.list_phone [--lang \u003Clanguage name>]\n```\n\nFor example,\n```bash\n# to get English phone inventory\n# ['a', 'aː', 'b', 'd', 'd̠', 'e', 'eː', 'e̞', 'f', 'h', 'i', 'iː', 'j', 'k', 'kʰ', 'l', 'm', 'n', 'o', 'oː', 'p', 'pʰ', 'r', 's', 't', 'tʰ', 't̠', 'u', 'uː', 'v', 'w', 'x', 'z', 'æ', 'ð', 'øː', 'ŋ', 'ɐ', 'ɐː', 'ɑ', 'ɑː', 'ɒ', 'ɒː', 'ɔ', 'ɔː', 'ɘ', 'ə', 'əː', 'ɛ', 'ɛː', 'ɜː', 'ɡ', 'ɪ', 'ɪ̯', 'ɯ', 'ɵː', 'ɹ', 'ɻ', 'ʃ', 'ʉ', 'ʉː', 'ʊ', 'ʌ', 'ʍ', 'ʒ', 'ʔ', 'θ']\npython -m allosaurus.bin.list_phone --lang eng\n\n# you can also skip lang option to get all inventory\n#['I', 'a', 'aː', 'ã', 'ă', 'b', 'bʲ', 'bʲj', 'bʷ', 'bʼ', 'bː', 'b̞', 'b̤', 'b̥', 'c', 'd', 'dʒ', 'dʲ', 'dː', 'd̚', 'd̥', 'd̪', 'd̯', 'd͡z', 'd͡ʑ', 'd͡ʒ', 'd͡ʒː', 'd͡ʒ̤', 'e', 'eː', 'e̞', 'f', 'fʲ', 'fʷ', 'fː', 'g', 'gʲ', 'gʲj', 'gʷ', 'gː', 'h', 'hʷ', 'i', 'ij', 'iː', 'i̞', 'i̥', 'i̯', 'j', 'k', 'kx', 'kʰ', 'kʲ', 'kʲj', 'kʷ', 'kʷʼ', 'kʼ', 'kː', 'k̟ʲ', 'k̟̚', 'k͡p̚', 'l', 'lʲ', 'lː', 'l̪', 'm', 'mʲ', 'mʲj', 'mʷ', 'mː', 'n', 'nj', 'nʲ', 'nː', 'n̪', 'n̺', 'o', 'oː', 'o̞', 'o̥', 'p', 'pf', 'pʰ', 'pʲ', 'pʲj', 'pʷ', 'pʷʼ', 'pʼ', 'pː', 'p̚', 'q', 'r', 'rː', 's', 'sʲ', 'sʼ', 'sː', 's̪', 't', 'ts', 'tsʰ', 'tɕ', 'tɕʰ', 'tʂ', 'tʂʰ', 'tʃ', 'tʰ', 'tʲ', 'tʷʼ', 'tʼ', 'tː', 't̚', 't̪', 't̪ʰ', 't̪̚', 't͡s', 't͡sʼ', 't͡ɕ', 't͡ɬ', 't͡ʃ', 't͡ʃʲ', 't͡ʃʼ', 't͡ʃː', 'u', 'uə', 'uː', 'u͡w', 'v', 'vʲ', 'vʷ', 'vː', 'v̞', 'v̞ʲ', 'w', 'x', 'x̟ʲ', 'y', 'z', 'zj', 'zʲ', 'z̪', 'ä', 'æ', 'ç', 'çj', 'ð', 'ø', 'ŋ', 'ŋ̟', 'ŋ͡m', 'œ', 'œ̃', 'ɐ', 'ɐ̞', 'ɑ', 'ɑ̱', 'ɒ', 'ɓ', 'ɔ', 'ɔ̃', 'ɕ', 'ɕː', 'ɖ̤', 'ɗ', 'ə', 'ɛ', 'ɛ̃', 'ɟ', 'ɡ', 'ɡʲ', 'ɡ̤', 'ɡ̥', 'ɣ', 'ɣj', 'ɤ', 'ɤɐ̞', 'ɤ̆', 'ɥ', 'ɦ', 'ɨ', 'ɪ', 'ɫ', 'ɯ', 'ɯ̟', 'ɯ̥', 'ɰ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɵ', 'ɸ', 'ɹ', 'ɹ̩', 'ɻ', 'ɻ̩', 'ɽ', 'ɾ', 'ɾj', 'ɾʲ', 'ɾ̠', 'ʀ', 'ʁ', 'ʁ̝', 'ʂ', 'ʃ', 'ʃʲː', 'ʃ͡ɣ', 'ʈ', 'ʉ̞', 'ʊ', 'ʋ', 'ʋʲ', 'ʌ', 'ʎ', 'ʏ', 'ʐ', 'ʑ', 'ʒ', 'ʒ͡ɣ', 'ʔ', 'ʝ', 'ː', 'β', 'β̞', 'θ', 'χ', 'ә', 'ḁ']\npython -m allosaurus.bin.list_phone\n```\n\n### Model\nThe `model` option is to select model for inference.\nThe default option is `latest`, it is pointing to the latest model you downloaded. \nIt will automatically download the latest model during your first inference if you do not have any local models. \n\n\nWe intend to train new models and continuously release them. The update might include both acoustic model binary files and phone inventory. \nTypically, the model's name indicates its training date, so usually a higher model id should be expected to perform better.\n\nTo download a new model, you can run following command.\n\n```bash\npython -m allosaurus.bin.download_model -m \u003Cmodel>\n```\n\nIf you do not know the model name, \nyou can just use `latest` as model's name and it will automatically download the latest model.\n\nWe note that updating to a new model will not delete the original models. All the models will be stored under `pretrained` directory where you installed allosaurus.\nYou might want to fix your model to get consistent results during one experiment.  \n\nTo see which models are available in your local environment, you can check with the following command\n```bash\npython -m allosaurus.bin.list_model\n```\n\nTo delete a model, you can use the following command. This might be useful when you are fine-tuning your models mentioned later. \n```bash\npython -m allosaurus.bin.remove_model\n```\n\nCurrent available models are the followings\n\n#### Language Independent Model (Universal Model) \nThe universal models predict language-independent phones and covers many languages. This is the default model allosaurus will try to download and use.\n If you cannot find your language on the language dependent models, please use this universal model instead. \n\n| Model | Target Language | Description |\n| --- | --- | --- |\n| `uni2005` | Universal | This is the `latest` model (previously named as `200529`) |\n\n#### Language Dependent Model\nWe are planning to deliver language-dependent models for some widely-used languages. The models here are trained with the target language specifically.\nIt should perform much better than the universal model for the target language. Those models will not be downloaded automatically. Please use the `download_model` command above to download, and use `--model` flag during inference. \n\n| Model | Target Language | Description |\n| --- | --- | --- |\n| `eng2102` | English (eng) | English only model|\n\n### Device\n`device_id` controls which device to run the inference.\n\nBy default, device_id will be -1, which indicates the model will only use CPUs.  \n\nHowever, if you have GPU, You can use them for inference by specifying device_id to a single GPU id. (note that multiple GPU inference is not supported)\n\n### Timestamp\nYou can retrieve an approximate timestamp for each recognized phone by using `timestamp` argument.\n\n```bash \npython -m allosaurus.run --timestamp=True -i sample.wav \n0.210 0.045 æ\n0.390 0.045 l\n0.450 0.045 u\n0.540 0.045 s\n0.630 0.045 ɔ\n0.720 0.045 ɹ\n0.870 0.045 s\n```\n\nThe format here in each line is `start_timestamp duration phone` where the `start_timestamp` and `duration` are shown in seconds.\n\nNote that the current timestamp is only an approximation. It is provided by the CTC model, which might not be accurate in some cases due to its nature. \n\nThe same interface is also available in python as follows:\n\n```python\nmodel = read_recognizer()\nmodel.recognize('.\u002Fsample.wav', timestamp=True)\n```\n\n\n### Top K\nSometimes generating more phones might be helpful. Specifying the top-k arg will generate k phones at each emitting frame. Default is 1.\n \n```bash\n# default topk is 1\npython -m allosaurus.run -i sample.wav\næ l u s ɔ ɹ s\n\n# output top 5 probable phones at emitting frame, \"|\" is used to delimit frames (no delimiter when topk=1)\n# probability is attached for each phone, the left most phone is the most probable phone \n# \u003Cblk> is blank which can be ignored.\npython -m allosaurus.run -i sample.wav --topk=5\næ (0.577) ɛ (0.128) ɒ (0.103) a (0.045) ə (0.021) | l (0.754) l̪ (0.196) lː (0.018) ʁ (0.007) ʀ (0.006) | u (0.233) ɨ (0.218) uː (0.104) ɤ (0.070) ɪ (0.066) | s (0.301) \u003Cblk> (0.298) z (0.118) s̪ (0.084) sː (0.046) | ɔ (0.454) ɑ (0.251) \u003Cblk> (0.105) ɹ̩ (0.062) uə (0.035) | ɹ (0.867) ɾ (0.067) \u003Cblk> (0.024) l̪ (0.018) r (0.015) | s (0.740) z (0.191) s̪ (0.039) zʲ (0.009) sː (0.003)\n```\n\n### Phone Emission\nYou can tell the model to emit more phones or less phones by changing the `--emit` or `-e` argument.\n\n```bash\n# default emit is 1.0\npython -m allosaurus.run -i sample.wav \næ l u s ɔ ɹ s\n\n# emit more phones when emit > 1\npython -m allosaurus.run -e 1.2 -i sample.wav \næ l u s f h ɔ ɹ s\n\n# emit less phones when emit \u003C 1\npython -m allosaurus.run -e 0.8 -i sample.wav \næ l u ɹ s\n```\n\n\n## Inventory Customization\nThe default phone inventory might not be the inventory you would like to use, so we provide several commands here for you to customize your own inventory.\n\nWe have mentioned that you can check your current (default) inventory with following command.\n```bash\npython -m allosaurus.bin.list_phone --lang \u003Clanguage name>\n```\n\nThe current phone inventory file can be dumped into a file\n```bash\n# dump the phone file\npython -m allosaurus.bin.write_phone --lang \u003Clanguage name> --output \u003Ca path to save this file>\n```\n\nIf you take a look at the file, it is just a simple format where each line represents a single phone. For example, the following one is the English file \n```\na\naː\nb\nd\n...\n```\n\nYou can customize this file to add or delete IPAs you would like. Each line should only contain one IPA phone without any space. It might be easier to debug later if IPAs are sorted, but it is not required.\n\nNext, update your model's inventory by the following command\n```bash\npython -m allosaurus.bin.update_phone --lang \u003Clanguage name> --input \u003Cthe file you customized)\n``` \n\nThen the file has been registered in your model, run the list_phone command again and you could see that it is now using your updated inventory\n```bash\npython -m allosaurus.bin.list_phone --lang \u003Clanguage name>\n```\n\nNow, if you run the inference again, you could also see the results also reflect your updated inventory.\n\nEven after your update, you can easily switch back to the original inventory. In this case, your updated file will be deleted.\n```bash\npython -m allosaurus.bin.restore_phone --lang \u003Clanguage name>\n```\n\n## Prior Customization\nYou can also change the results by adjusting the prior probability for each phone. \nThis can help you reduce the unwanted phones or increase the wanted phones.\n\nFor example, in the sample file, we get the output \n```bash\næ l u s ɔ ɹ s\n```\nSuppose you think the first phone is wrong, and would like to reduce the probability of this phone, you can create a new file ```prior.txt``` as follows\n```text\næ -10.0\n```\n\nThe file can contain multiple lines and each line has information for each phone. \nThe first field is your target phone and the second field is the log-based score to adjust your probability. Positive score means you want to boost its prediction, \nnegative score will suppress its prediction. In this case, we can get a new result\n\n```bash\npython -m allosaurus.run -i=sample.wav --lang=eng --prior=prior.txt \nɛ l u s ɔ ɹ s\n```\n\nwhere you can see ```æ``` is suppressed and another vowel ```ɛ``` replaced it.\n\nAnother application of prior is to change the number of total output phones. You might want more phones outputs or less phones outputs.\nIn this case, you can change the score for the ```\u003Cblk>``` which corresponds to the silence phone.\n\nA positive ```\u003Cblk>``` score will add more silence, therefore decrease the number of outputs, similarly, a negative ```\u003Cblk>``` will increase the outputs. The following example illustrates this.\n```text\n\n# \u003Cblk> 1.0\npython -m allosaurus.run -i=sample.wav --lang=eng --prior=prior.txt \næ l u ɔ ɹ s\n\n# \u003Cblk> -1.0\n$ python -m allosaurus.run -i=sample.wav --lang=eng --prior=prior.txt \næ l u s f ɔ ɹ s\n```\n\nThe first example reduces one phone and the second example adds a new phone.\n\n## Fine-Tuning\nWe notice that the pretrained models might not be accurate enough for some languages, \nso we also provide a fine-tuning tool here to allow users to further improve their model by adapting to their data.\nCurrently, it is only limited to fine-tuned with one language.\n\n### Prepare\nTo fine-tune your data, you need to prepare audio files and their transcriptions.\nFirst, please create one data directory (name can be arbitrary), inside the data directory, create a `train` directory and a `validate` directory.\nObviously, the `train` directory will contain your training set, and the `validate` directory will be the validation set. \n\nEach directory should contain the following two files:\n* `wave`: this is a file associating utterance with its corresponding audios \n* `text`: this is a file associating utterance with its phones.\n\n#### wave\n`wave` is a txt file mapping each utterance to your wav files. Each line should be prepared as follows:\n```txt\nutt_id \u002Fpath\u002Fto\u002Fyour\u002Faudio.wav\n```\n\nHere `utt_id` denotes the utterance id, it can be an arbitrary string as long as it is unique in your dataset.\nThe `audio.wav` is your wav file as mentioned above, it should be a mono-channel wav format, but sampling rate can be arbitrary (the tool would automatically resample if necessary)\nThe delimiter used here is space.\n\nTo get the best fine-tuning results, each audio file should not be very long. We recommend to keep each utterance shorter than 10 seconds. \n  \n#### text\n`text` is another txt file mapping each utterance to your transcription. Each line should be prepared as follows\n```txt\nutt_id phone1 phone2 ...\n```\n\nHere `utt_id` is again the utterance id and should match with the corresponding wav file.\nThe phone sequences came after utterance id is your phonetic transcriptions of the wav file.\nThe phones here should be restricted to the phone inventory of your target language.\nPlease make sure all your phones are already registered in your target language by the `list_phone` command\n\n### Feature Extraction\nNext, we will extract feature from both the `wave` file and `text` file.\nWe assume that you already prepared `wave` file and `text` file in BOTH `train` directory and `validate` directory\n\n\n#### Audio Feature\nTo prepare the audio features, run the following command on both your `train` directory and `validate` directory. \n\n```bash\n# command to prepare audio features\npython -m allosaurus.bin.prep_feat --model=some_pretrained_model --path=\u002Fpath\u002Fto\u002Fyour\u002Fdirectory (train or validate)\n```\n\nThe `path` should be pointing to the train or the validate directory, the `model` should be pointing to your traget pretrained model. If unspecified, it will use the latest model. \nIt will generate three files `feat.scp`, `feat.ark` and `shape`.\n \n* The first one is an file indexing each utterance into a offset of the second file.\n\n* The second file is a binary file containing all audio features. \n\n* The third one contains the feature dimension information  \n\nIf you are curious, the `scp` and `ark` formats are standard file formats used in Kaldi.\n\n### Text Feature\nTo prepare the text features, run the following command again on both your `train` directory and `validate` directory. \n\n```bash\n# command to prepare token\npython -m allosaurus.bin.prep_token --model=\u003Csome_pretrained_model> --lang=\u003Cyour_target_language_id> --path=\u002Fpath\u002Fto\u002Fyour\u002Fdirectory (train or validate)\n```\n\nThe `path` and `model` should be the same as the previous command. The `lang` is the 3 character ISO language id of this dataset.\nNote that you should already verify the the phone inventory of this language id contains all of your phone transcriptions.\nOtherwise, the extraction here might fail.\n\nAfter this command, it will generate a file called `token` which maps each utterance to the phone id sequences.\n\n\n### Training\nNext, we can start fine-tuning our model with the dataset we just prepared. The fine-tuning command is very simple.\n\n```bash\n# command to fine_tune your data\npython -m allosaurus.bin.adapt_model --pretrained_model=\u003Cpretrained_model> --new_model=\u003Cyour_new_model> --path=\u002Fpath\u002Fto\u002Fyour\u002Fdata\u002Fdirectory --lang=\u003Cyour_target_language_id> --device_id=\u003Cdevice_id> --epoch=\u003Cepoch>\n```\nThere are couple of other optional arguments available here, but we describe the required arguments. \n \n* `pretrained_model` should be the same model you specified before in the `prep_token` and `prep_feat`.\n \n* `new_model` can be an arbitrary model name (Actually, it might be easier to manage if you give each model the same format as the pretrained model (i.e. YYMMDD))\n\n* The `path` should be pointing to the parent directory of your `train` and `validate` directories.\n\n* The `lang` is the language id you specified in `prep_token`\n\n* The `device_id` is the GPU id for fine-tuning, if you do not have any GPU, use -1 as device_id. Multiple GPU is not supported.\n\n* `epoch` is the number of your training epoch\n\n\nDuring the training, it will show some information such as loss and phone error rate for both your training set and validation set.\nAfter each epoch, the model would be evaluated with the validation set and would save this checkpoint if its validation phone error rate is better than previous ones.\nAfter the specified `epoch` has finished, the fine-tuning process will end and the new model should be available.\n\n### Testing\nAfter your training process, the new model should be available in your model list. use the `list_model` command to check your new model is available now\n\n```bash\n# command to check all your models\npython -m allosaurus.bin.list_model\n```\n\nIf it is available, then this new model can be used in the same style as any other pretrained models. \nJust run the inference to use your new model. \n```bash\npython -m allosaurus.run --lang \u003Clanguage id> --model \u003Cyour new model> --device_id \u003Cgpu_id> -i \u003Caudio>\n```\n\n\n\n## Acknowledgements\nThis work uses part of the following codes and inventories. In particular, we heavily used AlloVera and Phoible to build this model's phone inventory.  \n\n* [AlloVera](https:\u002F\u002Fgithub.com\u002Fdmort27\u002Fallovera): For pretraining the model with correct allophone mappings \n* [Phoible](https:\u002F\u002Fgithub.com\u002Fphoible\u002Fdev): For language specific phone inventory \n* [python_speech_features](https:\u002F\u002Fgithub.com\u002Fjameslyons\u002Fpython_speech_features): For mfcc, filter bank feature extraction\n* [fairseq](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Ffairseq): For some utilities\n* [kaldi_io](https:\u002F\u002Fgithub.com\u002Fvesis84\u002Fkaldi-io-for-python): For kaldi scp, ark reader and writer\n\n## Reference\nPlease cite the following paper if you use code in  your work.\n\nIf you have any advice or suggestions, please feel free to send email to me (xinjianl [at] cs.cmu.edu) or submit an issue in this repo. Thanks!    \n\n```BibTex\n@inproceedings{li2020universal,\n  title={Universal phone recognition with a multilingual allophone system},\n  author={Li, Xinjian and Dalmia, Siddharth and Li, Juncheng and Lee, Matthew and Littell, Patrick and Yao, Jiali and Anastasopoulos, Antonios and Mortensen, David R and Neubig, Graham and Black, Alan W and Florian, Metze},\n  booktitle={ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},\n  pages={8249--8253},\n  year={2020},\n  organization={IEEE}\n}\n```\n","# 异特龙\n\n![CI 测试](https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Factions\u002Fworkflows\u002Fpython.yml\u002Fbadge.svg)\n\n异特龙是一款预训练的通用音素识别器。它可以用于识别超过2000种语言中的音素。\n\n该工具基于我们在 ICASSP 2020 上发表的工作 [使用多语言同位异音系统进行通用音素识别](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2002.11800.pdf)。\n\n![架构](arch.png?raw=true \"Architecture\")\n\n## 快速入门\n\n### 安装\n异特龙可以通过 pip 安装：\n```bash\npip install allosaurus\n```\n\n你也可以克隆本仓库并安装：\n```bash\npython setup.py install\n```\n\n### 快速开始\n基本用法非常简单：输入是一个 WAV 音频文件，输出是一串音素序列。\n\n```bash\npython -m allosaurus.run  -i \u003Caudio>\n```\n\n例如，你可以尝试使用本仓库中附带的示例文件。猜猜这段音频里是什么内容吧 :)\n```bash\npython -m allosaurus.run -i sample.wav\næ l u s ɔ ɹ s\n```\n\n你也可以直接在 Python 中使用异特龙：\n```python\nfrom allosaurus.app import read_recognizer\n\n# 加载你的模型\nmodel = read_recognizer()\n\n# 运行推理 -> æ l u s ɔ ɹ s\nmodel.recognize('sample.wav')\n```\n\n有关完整功能和详细信息，请参阅以下章节。\n\n## 推理\n命令行界面如下：\n```bash\npython -m allosaurus.run [--lang \u003Clanguage name>] [--model \u003Cmodel name>] [--device_id \u003Cgpu_id>] [--output \u003Coutput_file>] [--topk \u003Cint>] -i \u003Caudio file\u002Fdirectory>\n```\n它会识别音频文件中的窄音素。\n\n只有输入参数是必需的，其他选项可以忽略。请参阅后续章节了解它们的详细信息。\n\n此外，还有一个简单的 Python 接口如下：\n```python\nfrom allosaurus.app import read_recognizer\n\n# 根据 \u003Cmodel name> 加载模型，若留空则使用 'latest'\nmodel = read_recognizer(model)\n\n# 对 \u003Caudio_file> 进行推理，指定 \u003Clang>，若留空则默认为 'ipa'\nmodel.recognize(audio_file, lang)\n```\n\n两种接口中参数的详细说明如下：\n### 输入\n输入可以是一个单独的文件，也可以是一个包含多个音频文件的目录。\n\n如果输入是一个文件，它只会输出音素序列；如果输入是一个目录，它会同时输出文件名和音素序列，并按文件名排序。\n\n音频文件应符合以下格式：\n* 必须是 WAV 文件。如果音频不是 WAV 格式，请提前使用 sox 或 ffmpeg 将其转换为 WAV 格式。\n* 采样率可以任意，我们会根据模型的要求自动重新采样。\n* 我们假设音频是单声道音频。\n\n### 输出\n默认情况下，输出是标准输出（即所有结果都会打印到终端）。\n\n如果你指定了一个文件作为输出，则所有输出都会被重定向到该文件。\n\n### 语言\n`lang` 选项是语言标识符，用于指定你想要使用的音素库。\n\n默认选项是 `ipa`，表示识别器将使用完整的音素库（约 230 个音素）。\n\n通常，指定语言音素库可以提高识别准确率。\n\n你可以通过以下命令查看完整的语言列表。可用的语言数量约为 2000 种。\n```bash\npython -m allosaurus.bin.list_lang\n```\n\n要查看特定语言的音素库，可以使用以下命令：\n```bash\npython -m allosaurus.bin.list_phone [--lang \u003Clanguage name>]\n```\n\n例如：\n```bash\n# 获取英语音素库\n# ['a', 'aː', 'b', 'd', 'd̠', 'e', 'eː', 'e̞', 'f', 'h', 'i', 'iː', 'j', 'k', 'kʰ', 'l', 'm', 'n', 'o', 'oː', 'p', 'pʰ', 'r', 's', 't', 'tʰ', 't̠', 'u', 'uː', 'v', 'w', 'x', 'z', 'æ', 'ð', 'øː', 'ŋ', 'ɐ', 'ɐː', 'ɑ', 'ɑː', 'ɒ', 'ɒː', 'ɔ', 'ɔː', 'ɘ', 'ə', 'əː', 'ɛ', 'ɛː', 'ɜː', 'ɡ', 'ɪ', 'ɪ̯', 'ɯ', 'ɵː', 'ɹ', 'ɻ', 'ʃ', 'ʉ', 'ʉː', 'ʊ', 'ʌ', 'ʍ', 'ʒ', 'ʔ', 'θ']\npython -m allosaurus.bin.list_phone --lang eng\n\n# 你也可以不指定 lang 选项来获取全部音素库\n#['I', 'a', 'aː', 'ã', 'ă', 'b', 'bʲ', 'bʲj', 'bʷ', 'bʼ', 'bː', 'b̞', 'b̤', 'b̥', 'c', 'd', 'dʒ', 'dʲ', 'dː', 'd̚', 'd̥', 'd̪', 'd̯', 'd͡z', 'd͡ʑ', 'd͡ʒ', 'd͡ʒː', 'd͡ʒ̤', 'e', 'eː', 'e̞', 'f', 'fʲ', 'fʷ', 'fː', 'g', 'gʲ', 'gʲj', 'gʷ', 'gː', 'h', 'hʷ', 'i', 'ij', 'iː', 'i̞', 'i̥', 'i̯', 'j', 'k', 'kx', 'kʰ', 'kʲ', 'kʲj', 'kʷ', 'kʷʼ', 'kʼ', 'kː', 'k̟ʲ', 'k̟̚', 'k͡p̚', 'l', 'lʲ', 'lː', 'l̪', 'm', 'mʲ', 'mʲj', 'mʷ', 'mː', 'n', 'nj', 'nʲ', 'nː', 'n̪', 'n̺', 'o', 'oː', 'o̞', 'o̥', 'p', 'pf', 'pʰ', 'pʲ', 'pʲj', 'pʷ', 'pʷʼ', 'pʼ', 'pː', 'p̚', 'q', 'r', 'rː', 's', 'sʲ', 'sʼ', 'sː', 's̪', 't', 'ts', 'tsʰ', 'tɕ', 'tɕʰ', 'tʂ', 'tʂʰ', 'tʃ', 'tʰ', 'tʲ', 'tʷʼ', 'tʼ', 'tː', 't̚', 't̪', 't̪ʰ', 't̪̚', 't͡s', 't͡sʼ', 't͡ɕ', 't͡ɬ', 't͡ʃ', 't͡ʃʲ', 't͡ʃʼ', 't͡ʃː', 'u', 'uə', 'uː', 'u͡w', 'v', 'vʲ', 'vʷ', 'vː', 'v̞', 'v̞ʲ', 'w', 'x', 'x̟ʲ', 'y', 'z', 'zj', 'zʲ', 'z̪', 'ä', 'æ', 'ç', 'çj', 'ð', 'ø', 'ŋ', 'ŋ̟', 'ŋ͡m', 'œ', 'œ̃', 'ɐ', 'ɐ̞', 'ɑ', 'ɑ̱', 'ɒ', 'ɓ', 'ɔ', 'ɔ̃', 'ɕ', 'ɕː', 'ɖ̤', 'ɗ', 'ə', 'ɛ', 'ɛ̃', 'ɟ', 'ɡ', 'ɡʲ', 'ɡ̤', 'ɡ̥', 'ɣ', 'ɣj', 'ɤ', 'ɤɐ̞', 'ɤ̆', 'ɥ', 'ɦ', 'ɨ', 'ɪ', 'ɫ', 'ɯ', 'ɯ̟', 'ɯ̥', 'ɰ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɵ', 'ɸ', 'ɹ', 'ɹ̩', 'ɻ', 'ɻ̩', 'ɽ', 'ɾ', 'ɾj', 'ɾʲ', 'ɾ̠', 'ʀ', 'ʁ', 'ʁ̝', 'ʂ', 'ʃ', 'ʃʲː', 'ʃ͡ɣ', 'ʈ', 'ʉ̞', 'ʊ', 'ʋ', 'ʋʲ', 'ʌ', 'ʎ', 'ʏ', 'ʐ', 'ʑ', 'ʒ', 'ʒ͡ɣ', 'ʔ', 'ʝ', 'ː', 'β', 'β̞', 'θ', 'χ', 'ә', 'ḁ']\npython -m allosaurus.bin.list_phone\n```\n\n### 模型\n`model` 选项用于选择用于推理的模型。\n默认选项是 `latest`，它指向您下载的最新模型。\n如果您本地没有模型，在首次推理时会自动下载最新的模型。\n\n\n我们计划训练新模型并持续发布。更新可能包括声学模型二进制文件和音素清单。\n通常，模型名称会标明其训练日期，因此较高的模型 ID 通常意味着更好的性能。\n\n要下载新模型，您可以运行以下命令：\n\n```bash\npython -m allosaurus.bin.download_model -m \u003Cmodel>\n```\n\n如果您不知道模型名称，\n可以直接使用 `latest` 作为模型名称，系统会自动下载最新模型。\n\n请注意，更新到新模型不会删除原有模型。所有模型都会存储在您安装 Allosaurus 的 `pretrained` 目录下。\n在一次实验中，您可能希望固定使用某个特定模型以获得一致的结果。\n\n要查看本地环境中有哪些可用模型，可以使用以下命令：\n```bash\npython -m allosaurus.bin.list_model\n```\n\n要删除某个模型，可以使用以下命令。这在后续进行模型微调时可能会很有用：\n```bash\npython -m allosaurus.bin.remove_model\n```\n\n当前可用的模型如下：\n\n#### 语言无关模型（通用模型）\n通用模型能够预测与语言无关的音素，覆盖多种语言。这是 Allosaurus 默认尝试下载和使用的模型。\n如果您在语言相关模型中找不到您的语言，请改用此通用模型。\n\n| 模型 | 目标语言 | 描述 |\n| --- | --- | --- |\n| `uni2005` | 通用 | 这是 `latest` 模型（之前名为 `200529`） |\n\n#### 语言相关模型\n我们计划为一些广泛使用的语言提供语言相关模型。这些模型是专门针对目标语言训练的。\n对于目标语言而言，它们的表现应该远优于通用模型。这些模型不会自动下载。请使用上述 `download_model` 命令进行下载，并在推理时使用 `--model` 标志。\n\n| 模型 | 目标语言 | 描述 |\n| --- | --- | --- |\n| `eng2102` | 英语 (eng) | 仅适用于英语的模型 |\n\n### 设备\n`device_id` 控制着在哪种设备上运行推理。\n默认情况下，`device_id` 为 -1，表示模型将仅使用 CPU。\n然而，如果您有 GPU，可以通过将 `device_id` 设置为某个 GPU 的编号来利用 GPU 进行推理。（注意：不支持多 GPU 推理）\n\n### 时间戳\n您可以通过使用 `timestamp` 参数获取每个识别出的音素的大致时间戳。\n\n```bash\npython -m allosaurus.run --timestamp=True -i sample.wav \n0.210 0.045 æ\n0.390 0.045 l\n0.450 0.045 u\n0.540 0.045 s\n0.630 0.045 ɔ\n0.720 0.045 ɹ\n0.870 0.045 s\n```\n\n每一行的格式为 `开始时间戳 持续时间 音素`，其中 `开始时间戳` 和 `持续时间` 以秒为单位。\n\n需要注意的是，当前的时间戳仅为近似值。它是通过 CTC 模型提供的，由于其特性，在某些情况下可能不够准确。\n\n同样的接口也可以在 Python 中使用，如下所示：\n\n```python\nmodel = read_recognizer()\nmodel.recognize('.\u002Fsample.wav', timestamp=True)\n```\n\n\n### Top K\n有时生成更多的音素可能会有所帮助。指定 `top-k` 参数会在每个发音帧生成 k 个音素。默认值为 1。\n\n```bash\n# 默认 topk 是 1\npython -m allosaurus.run -i sample.wav\næ l u s ɔ ɹ s\n\n# 输出每个发音帧中最有可能的 5 个音素，用 `|` 分隔各帧（当 topk=1 时无分隔符）\n# 每个音素后面附有概率，最左边的音素是最有可能的音素\n# `\u003Cblk>` 表示空白音素，可忽略。\npython -m allosaurus.run -i sample.wav --topk=5\næ (0.577) ɛ (0.128) ɒ (0.103) a (0.045) ə (0.021) | l (0.754) l̪ (0.196) lː (0.018) ʁ (0.007) ʀ (0.006) | u (0.233) ɨ (0.218) uː (0.104) ɤ (0.070) ɪ (0.066) | s (0.301) \u003Cblk> (0.298) z (0.118) s̪ (0.084) sː (0.046) | ɔ (0.454) ɑ (0.251) \u003Cblk> (0.105) ɹ̩ (0.062) uə (0.035) | ɹ (0.867) ɾ (0.067) \u003Cblk> (0.024) l̪ (0.018) r (0.015) | s (0.740) z (0.191) s̪ (0.039) zʲ (0.009) sː (0.003)\n```\n\n### 音素发射率\n您可以通过更改 `--emit` 或 `-e` 参数来控制模型发出更多或更少音素。\n\n```bash\n# 默认发射率为 1.0\npython -m allosaurus.run -i sample.wav\næ l u s ɔ ɹ s\n\n# 当 emit > 1 时，模型会发出更多音素\npython -m allosaurus.run -e 1.2 -i sample.wav\næ l u s f h ɔ ɹ s\n\n# 当 emit \u003C 1 时，模型会发出较少音素\npython -m allosaurus.run -e 0.8 -i sample.wav\næ l u ɹ s\n```\n\n\n## 音素清单自定义\n默认的音素清单可能并不是您想要使用的清单，因此我们提供了若干命令供您自定义自己的音素清单。\n\n我们已经提到，您可以通过以下命令查看当前的（默认）音素清单：\n```bash\npython -m allosaurus.bin.list_phone --lang \u003C语言名称>\n```\n\n当前的音素清单文件可以导出到一个文件中：\n```bash\n# 导出音素文件\npython -m allosaurus.bin.write_phone --lang \u003C语言名称> --output \u003C保存该文件的路径>\n```\n\n如果您查看该文件，会发现它是一个简单的格式，每行代表一个音素。例如，以下是英语的音素清单：\n```\na\naː\nb\nd\n...\n```\n\n您可以自定义此文件，添加或删除您需要的国际音标。每行应只包含一个国际音标，且不能有空格。虽然按顺序排列国际音标有助于后续调试，但这并非强制要求。\n\n接下来，使用以下命令更新您的模型音素清单：\n```bash\npython -m allosaurus.bin.update_phone --lang \u003C语言名称> --input \u003C您自定义的文件>\n```\n\n更新完成后，再次运行 `list_phone` 命令，您会看到模型现在使用的是您更新后的音素清单：\n```bash\npython -m allosaurus.bin.list_phone --lang \u003C语言名称>\n```\n\n现在，如果您再次进行推理，结果也会反映出您更新后的音素清单。\n\n即使在更新之后，您也可以轻松切换回原始音素清单。在这种情况下，您自定义的文件会被删除：\n```bash\npython -m allosaurus.bin.restore_phone --lang \u003C语言名称>\n```\n\n## 先验自定义\n你还可以通过调整每个音素的先验概率来改变结果。  \n这可以帮助你减少不想要的音素，或者增加想要的音素。\n\n例如，在示例文件中，我们得到如下输出：  \n```bash\næ l u s ɔ ɹ s\n```\n假设你觉得第一个音素不对，并希望降低该音素的概率，你可以创建一个新的文件 `prior.txt`，内容如下：  \n```text\næ -10.0\n```\n\n该文件可以包含多行，每行对应一个音素的信息。第一列是你要调整的目标音素，第二列是基于对数的概率分数。正分数表示提高该音素的预测概率，负分数则会抑制其预测概率。在这种情况下，我们可以得到新的结果：\n\n```bash\npython -m allosaurus.run -i=sample.wav --lang=eng --prior=prior.txt \nɛ l u s ɔ ɹ s\n```\n\n可以看到，`æ` 被抑制了，另一个元音 `ɛ` 取代了它。\n\n先验的另一个用途是改变总输出音素的数量。你可能希望输出更多或更少的音素。这时，你可以调整与静音音素对应的 `\u003Cblk>` 的分数。  \n正的 `\u003Cblk>` 分数会增加静音部分，从而减少输出音素的数量；相反，负的 `\u003Cblk>` 分数会增加输出音素的数量。下面的例子说明了这一点：  \n```text\n\n# \u003Cblk> 1.0\npython -m allosaurus.run -i=sample.wav --lang=eng --prior=prior.txt \næ l u ɔ ɹ s\n\n# \u003Cblk> -1.0\n$ python -m allosaurus.run -i=sample.wav --lang=eng --prior=prior.txt \næ l u s f ɔ ɹ s\n```\n\n第一个例子减少了一个音素，第二个例子则增加了一个音素。\n\n## 微调\n我们注意到，预训练模型对于某些语言可能不够准确，因此我们提供了一个微调工具，允许用户根据自己的数据进一步改进模型。目前，该功能仅支持单语言的微调。\n\n### 准备工作\n要对你的数据进行微调，你需要准备音频文件及其转录文本。首先，创建一个数据目录（名称可任意），在该目录内再创建 `train` 和 `validate` 两个子目录。  \n显然，`train` 目录将存放训练集，而 `validate` 目录则用于验证集。\n\n每个目录应包含以下两个文件：  \n* `wave`：这个文件将每个话语与其对应的音频文件关联起来。  \n* `text`：这个文件将每个话语与其音素序列关联起来。\n\n#### wave\n`wave` 是一个文本文件，用于将每个话语映射到对应的 WAV 文件。每行的格式如下：  \n```txt\nutt_id \u002Fpath\u002Fto\u002Fyour\u002Faudio.wav\n```\n\n其中，`utt_id` 表示话语 ID，可以是任意字符串，只要在你的数据集中保持唯一即可。  \n`audio.wav` 是前面提到的音频文件，应为单声道 WAV 格式，采样率可以任意（如果需要，工具会自动重采样）。  \n此处使用的分隔符是空格。\n\n为了获得最佳的微调效果，每个音频文件不宜过长。我们建议每个话语的时长不超过 10 秒。\n\n#### text\n`text` 是另一个文本文件，用于将每个话语映射到其转录文本。每行的格式如下：  \n```txt\nutt_id phone1 phone2 ...\n```\n\n其中，`utt_id` 再次表示话语 ID，必须与对应的 WAV 文件匹配。  \n话语 ID 后面的音素序列是你对 WAV 文件的音标转录。  \n这些音素应限制在目标语言的音素库范围内。请确保所有音素都已经通过 `list_phone` 命令注册到你的目标语言中。\n\n### 特征提取\n接下来，我们将从 `wave` 和 `text` 文件中提取特征。我们假设你已经在 `train` 和 `validate` 目录中分别准备好了 `wave` 和 `text` 文件。\n\n#### 音频特征\n要准备音频特征，请在 `train` 和 `validate` 目录中分别运行以下命令：  \n\n```bash\n# 准备音频特征的命令\npython -m allosaurus.bin.prep_feat --model=some_pretrained_model --path=\u002Fpath\u002Fto\u002Fyour\u002Fdirectory (train or validate)\n```\n\n其中，`path` 应指向训练或验证目录，`model` 应指向你所使用的预训练模型。若未指定，则会使用最新版本的模型。  \n该命令会生成三个文件：`feat.scp`、`feat.ark` 和 `shape`。\n\n* 第一个文件是一个索引文件，将每个话语映射到第二个文件中的偏移量。\n\n* 第二个文件是一个二进制文件，包含了所有的音频特征。\n\n* 第三个文件包含了特征的维度信息。\n\n如果你感兴趣，`scp` 和 `ark` 格式是 Kaldi 中常用的文件格式。\n\n### 文本特征\n要准备文本特征，请再次在 `train` 和 `validate` 目录中分别运行以下命令：  \n\n```bash\n# 准备标记的命令\npython -m allosaurus.bin.prep_token --model=\u003Csome_pretrained_model> --lang=\u003Cyour_target_language_id> --path=\u002Fpath\u002Fto\u002Fyour\u002Fdirectory (train or validate)\n```\n\n这里的 `path` 和 `model` 与之前的命令相同。`lang` 是该数据集的 3 字符 ISO 语言代码。  \n请注意，你应该事先确认该语言代码的音素库包含你所有的音素转录。否则，特征提取可能会失败。\n\n执行完该命令后，会生成一个名为 `token` 的文件，将每个话语映射到音素 ID 序列。\n\n### 训练\n接下来，我们可以开始用刚刚准备好的数据对模型进行微调。微调命令非常简单：\n\n```bash\n# 微调数据的命令\npython -m allosaurus.bin.adapt_model --pretrained_model=\u003Cpretrained_model> --new_model=\u003Cyour_new_model> --path=\u002Fpath\u002Fto\u002Fyour\u002Fdata\u002Fdirectory --lang=\u003Cyour_target_language_id> --device_id=\u003Cdevice_id> --epoch=\u003Cepoch>\n```\n\n这里还有一些可选参数，但我们只介绍必需的参数。  \n\n* `pretrained_model` 应与之前在 `prep_token` 和 `prep_feat` 中指定的模型一致。\n\n* `new_model` 可以是任意模型名称（实际上，如果给每个模型都采用与预训练模型相同的命名格式，比如 YYMMDD，会更容易管理）。\n\n* `path` 应指向 `train` 和 `validate` 目录的父目录。\n\n* `lang` 是你在 `prep_token` 中指定的语言代码。\n\n* `device_id` 是用于微调的 GPU ID，如果没有 GPU，则将 `device_id` 设置为 -1。目前不支持多 GPU。\n\n* `epoch` 是训练的轮数。\n\n在训练过程中，系统会显示训练集和验证集的损失以及音素错误率等信息。每完成一个 epoch，模型都会在验证集上进行评估，如果验证集上的音素错误率比之前更好，则会保存该检查点。  \n当指定的 epoch 数完成后，微调过程即告结束，新的模型也将可用。\n\n### 测试\n训练完成后，新模型应会出现在您的模型列表中。使用 `list_model` 命令检查新模型是否已可用。\n\n```bash\n# 查看所有模型的命令\npython -m allosaurus.bin.list_model\n```\n\n如果模型已可用，则可以像使用其他预训练模型一样使用它。只需运行推理即可使用您的新模型。\n\n```bash\npython -m allosaurus.run --lang \u003C语言代码> --model \u003C您的新模型> --device_id \u003CGPU编号> -i \u003C音频>\n```\n\n\n\n## 致谢\n本工作使用了以下部分代码和资源。特别是，我们大量使用了 AlloVera 和 Phoible 来构建该模型的音素库。\n\n* [AlloVera](https:\u002F\u002Fgithub.com\u002Fdmort27\u002Fallovera)：用于基于正确的同位异音映射对模型进行预训练\n* [Phoible](https:\u002F\u002Fgithub.com\u002Fphoible\u002Fdev)：用于特定语言的音素库\n* [python_speech_features](https:\u002F\u002Fgithub.com\u002Fjameslyons\u002Fpython_speech_features)：用于提取 MFCC 和滤波器组特征\n* [fairseq](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Ffairseq)：提供了一些实用工具\n* [kaldi_io](https:\u002F\u002Fgithub.com\u002Fvesis84\u002Fkaldi-io-for-python)：用于读写 Kaldi 的 SCP 和 ARK 文件\n\n## 参考文献\n如果您在工作中使用了本项目的代码，请引用以下论文。\n\n如果您有任何建议或意见，欢迎随时通过电子邮件（xinjianl [at] cs.cmu.edu）与我联系，或在此仓库中提交问题。谢谢！\n\n```BibTex\n@inproceedings{li2020universal,\n  title={通用音素识别与多语言同位异音系统},\n  author={Li, Xinjian and Dalmia, Siddharth and Li, Juncheng and Lee, Matthew and Littell, Patrick and Yao, Jiali and Anastasopoulos, Antonios and Mortensen, David R and Neubig, Graham and Black, Alan W and Florian, Metze},\n  booktitle={ICASSP 2020-2020 IEEE 国际声学、语音与信号处理会议（ICASSP）},\n  pages={8249--8253},\n  year={2020},\n  organization={IEEE}\n}\n```","# Allosaurus 快速上手指南\n\nAllosaurus 是一个预训练的通用音素识别器，支持识别 2000 多种语言中的音素。它基于多语言异音系统（Multilingual Allophone System），能够将音频文件转换为音素序列。\n\n## 环境准备\n\n*   **操作系统**：Linux, macOS, Windows\n*   **Python 版本**：建议 Python 3.6 及以上\n*   **依赖项**：\n    *   `torch` (PyTorch)\n    *   `numpy`\n    *   `scipy`\n    *   `soundfile`\n    *   其他依赖将在安装时自动解决。\n*   **音频格式要求**：\n    *   必须为 `.wav` 格式（如非 wav 格式，请预先使用 `ffmpeg` 或 `sox` 转换）。\n    *   采样率任意（工具会自动重采样）。\n    *   假设为单声道音频。\n\n## 安装步骤\n\n### 方法一：通过 pip 安装（推荐）\n\n```bash\npip install allosaurus\n```\n\n> **提示**：国内用户若下载缓慢，可使用清华源加速：\n> ```bash\n> pip install allosaurus -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n### 方法二：源码安装\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus.git\ncd allosaurus\npython setup.py install\n```\n\n## 基本使用\n\n### 1. 命令行快速开始\n\n最简单的用法是输入一个 wav 音频文件，输出对应的音素序列。首次运行时会自动下载最新的通用模型。\n\n```bash\npython -m allosaurus.run -i \u003Caudio_file>\n```\n\n**示例**（使用仓库自带的样本文件）：\n\n```bash\npython -m allosaurus.run -i sample.wav\n```\n\n**输出示例**：\n```text\næ l u s ɔ ɹ s\n```\n\n### 2. Python 代码调用\n\n你也可以直接在 Python 脚本中调用 Allosaurus：\n\n```python\nfrom allosaurus.app import read_recognizer\n\n# 加载模型（默认加载最新模型，首次运行会自动下载）\nmodel = read_recognizer()\n\n# 执行推理\n# 返回结果示例：['æ', 'l', 'u', 's', 'ɔ', 'ɹ', 's']\nphones = model.recognize('sample.wav')\n\nprint(phones)\n```\n\n### 进阶选项简述\n\n*   **指定语言音素集**：通过 `--lang` 参数指定特定语言的音素库存（默认为 `ipa`，包含约 230 个通用音素），可提高特定语言的识别准确率。\n    ```bash\n    python -m allosaurus.run --lang eng -i audio.wav\n    ```\n*   **获取时间戳**：添加 `--timestamp=True` 可输出每个音素的起始时间和持续时间。\n    ```bash\n    python -m allosaurus.run --timestamp=True -i audio.wav\n    ```\n*   **指定 GPU**：默认使用 CPU (`device_id=-1`)，若有 GPU 可指定 ID。\n    ```bash\n    python -m allosaurus.run --device_id 0 -i audio.wav\n    ```\n\n更多详细功能（如自定义音素表、Top-K 输出等）请参考完整文档。","一家跨国语言研究机构正在构建涵盖 2000 多种小语种的语音分析管道，急需从海量未标注的田野调查录音中提取基础发音单元。\n\n### 没有 allosaurus 时\n- **模型训练成本极高**：面对稀缺的小语种数据，团队必须为每种语言单独收集标注数据并训练专用识别器，耗时数月且难以覆盖长尾语言。\n- **音素标准不统一**：不同语言团队使用各自的音素集合，导致跨语言对比分析时数据格式混乱，无法进行统一的类型学研究。\n- **冷启动困难**：对于完全未知的方言或濒危语言，由于缺乏先验知识，传统工具无法直接进行有效的语音特征提取。\n\n### 使用 allosaurus 后\n- **零样本即时识别**：利用 allosaurus 预训练的通用音素识别能力，研究人员无需任何额外训练，直接输入 WAV 文件即可获取 2000 多种语言的音素序列。\n- **标准化输出流**：通过指定 `lang` 参数（如 `eng` 或 `ipa`），allosaurus 能将所有语言映射到统一的国际音标（IPA）体系，天然消除了数据对齐障碍。\n- **灵活适配场景**：无论是单文件快速测试还是批量处理整个录音目录，allosaurus 都能自动重采样并输出结构化结果，大幅缩短了从原始录音到语言学分析的周期。\n\nallosaurus 通过“一次预训练，通用全语言”的能力，将多语言语音分析的门槛从“数月建模”降低到了“秒级推理”。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxinjli_allosaurus_4eea557e.png","xinjli","Xinjian Li","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fxinjli_1a06cdb4.jpg","Google | CMU LTI PhD","Google",null,"www.xinjianl.com","https:\u002F\u002Fgithub.com\u002Fxinjli",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,725,"2026-04-07T07:38:23","GPL-3.0",1,"未说明 (基于 Python pip 安装，通常支持 Linux, macOS, Windows)","非必需。默认使用 CPU (device_id=-1)。支持单张 NVIDIA GPU 加速，需指定 device_id。未提及具体型号、显存大小或 CUDA 版本要求。","未说明",{"notes":93,"python":94,"dependencies":95},"1. 输入音频必须为 WAV 格式（若非 WAV 需预先使用 sox 或 ffmpeg 转换），假设为单声道，采样率可任意（会自动重采样）。2. 首次运行时若本地无模型，会自动下载最新通用模型（uni2005）。3. 支持约 2000 种语言的音素识别，也可下载特定语言模型（如英语 eng2102）以获得更高精度。4. 时间戳功能基于 CTC 模型，仅为近似值。5. 所有模型存储在安装目录下的 pretrained 文件夹中。","未说明 (需支持 pip 安装及 setup.py)",[96],"未明确列出 (通过 pip install allosaurus 自动处理)",[98,14],"音频",[100,101,102,103],"speech","speech-recognition","pytorch","phonetics","2026-03-27T02:49:30.150509","2026-04-11T00:49:33.837815",[107,112,117,122,127,132],{"id":108,"question_zh":109,"answer_zh":110,"source_url":111},28557,"为什么无法转录简单的英语单词或音频文件没有输出？","这通常是因为音频文件的采样率不符合要求。Allosaurus 需要音频至少下采样到 16000 Hz (16kHz) 且为单声道。您可以使用 ffmpeg 进行转换，命令如下：\nffmpeg -i input.wav -acodec pcm_s16le -ac 1 -ar 16000 output_16bit.wav\n转换后再次运行转录即可。","https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Fissues\u002F60",{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},28558,"微调模型时遇到维度不匹配（shapes alignment）的错误怎么办？","这个问题通常是由于依赖库 panphon 升级导致的，其特征维度从 22 变为了 24。请尝试更新相关依赖版本。\n此外，检查您的音素清单（phone inventory），其中不应包含 \u003Cblk> 标记。请从自定义清单中移除 \u003Cblk> 或重新生成清单以排除该标记。","https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Fissues\u002F37",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},28559,"如何获取每个单词的音素边界（Phoneme Boundaries）？","Allosaurus 目前主要输出音素序列，不直接提供基于单词的边界对齐。如果您有训练数据集，建议的使用方法是：先使用该工具转录所有音频，然后训练另一个 seq2seq 模型，将识别出的音素序列映射到您的文本转录结果，从而间接获得对齐信息。","https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Fissues\u002F9",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},28560,"如何让 Allosaurus 支持从 BytesIO 对象读取音频数据？","默认代码会断言文件名必须以 \".wav\" 结尾，导致无法直接处理内存中的 BytesIO 对象。解决方案是修改代码逻辑：当输入是 BytesIO 实例时，跳过文件扩展名的检查。维护者已接受此建议并合并了相关的 Pull Request，建议更新至最新版本或参考 PR 修改本地代码。","https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Fissues\u002F39",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},28561,"运行 prep_feat 时出现 \"assert wave_path.exists()\" 错误如何解决？","该错误表示程序找不到指定的 wav 文件。请仔细检查您的列表文件（wave txt file），确保其中列出的文件路径是绝对路径且文件真实存在。如果在 Windows 上运行，请注意路径分隔符（建议使用双反斜杠 \\\\ 或正斜杠 \u002F）以及路径中是否包含多余的空格或引号。","https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Fissues\u002F27",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},28562,"如何提高发音评估结果的稳定性和一致性？","如果结果波动较大，建议检查输入音频的处理方式。虽然具体的训练数据预处理细节（如压缩器、降噪等）可能未完全公开，但用户可以尝试对输入数据进行类似的标准化处理（如统一的音量归一化、背景噪声去除），并确保录音环境与训练数据尽可能接近。此外，关注项目发布的新模型版本，新版本通常会带来性能提升。","https:\u002F\u002Fgithub.com\u002Fxinjli\u002Fallosaurus\u002Fissues\u002F19",[138],{"id":139,"version":140,"summary_zh":77,"released_at":141},193176,"v1.0","2021-05-27T21:30:22"]