两周前,我们推出了 Phonon,这是一款运行在您本地设备上的小型文本转语音模型。它无需服务器,也无需网络连接,您输入的文字完全保留在您的设备上。
到目前为止,我们对该产品的反响感到非常满意。以下是此次发布的来龙去脉:我们为何构建 Phonon、它能做什么、随附的演示以及它在 Hugging Face 开放 TTS 排行榜上的表现。
为什么语音应驻留在您的设备上
大多数语音 AI 都运行在云端:每个句子都要往返于服务器。而 Phonon 则直接在您自己的设备上运行。您的文字留在那里,语音功能无需网络即可工作。我们还开源了模型权重。Phonon 31m 采用 Apache 2.0 许可证,因此您可以免费使用它,甚至用于商业产品。其他模型采用 CC BY-NC 许可证,适用于非商业项目。如果您使用这些模型构建商业产品,定价将基于您的用户数量,而非生成的语音量。
让高质量的语音在小型设备上运行一直颇具挑战。您可以使模型变小,但音质不佳;或者让音质出色,但模型体积过大无法适配。我们同时解决了这两个问题。
我们在四月宣布了 Phonon,并在接下来的六个月里与合作伙伴及早期用户一起对其进行完善。他们的反馈帮助我们塑造了此次发布的内容。模型变得更小,我们增加了更多语言支持,并通过语音克隆和语音设计功能支持自定义声音。
Phonon 基于 Pocket TTS 技术谱系,因此使用流匹配(flow matching)来生成音频,这与其他 TTS 系统使用的建模技术截然不同。正是这一点使我们能够将如此高的质量带入如此小的模型中,但也给模型训练带来了新的挑战。训练过程最初在数值上不稳定,需要多种技巧才能在所有五种语言中产生高质量的结果。
我们发布了什么
Phonon 提供两种尺寸,分别约为 65 MB 和 75 MB。它们共同支持英语、法语、德语、西班牙语和葡萄牙语。内置语音超过 100 种,您还可以在 Gradium Studio 中创建自己的声音。Phonon 还能处理大多数其他 TTS 系统常出问题的关键问题,如电话号码、日期和代码。
它可在手机、笔记本电脑、单板计算机以及浏览器标签页中运行,因此您可以立即听到它的效果。Phonon 31m 支持英语,采用 Apache 2.0 许可证,因此您可以自由地基于它进行构建,包括用于商业产品。Phonon 40m 涵盖所有五种语言,采用非商业许可证。
演示与早期项目
此次发布附带了来自朋友和我们团队自己的演示。在关闭 Wi-Fi 的 Apple Watch 上,Phonon 一步步指导您冲泡咖啡。在无信号的 iPhone 上,它为您计数重复次数并激励您继续。来自 Autonomous 的机器人 Lamp 戴着分类帽,以角色身份说话。在浏览器中,离线的恐龙跑酷游戏变成了由 Rex 主持的广播节目。还有一款科幻游戏,其语音直接在玩家自己的机器上生成,以及逐页朗读的普鲁斯特作品。
Hugging Face 团队构建了 Transformers 集成,使开发者从第一天起就能在 Transformers 中使用 Phonon。
开发者们也开始基于它进行构建。ExecuTorch 转换版本可在浏览器中利用访问者的 GPU 运行 Phonon,Micdrop 将其引入 Node.js 应用,而 smallest-s2s 等 Spaces 也在此基础上进行了开发。
在前两周内,Phonon 的下载量超过 20 万次,并且在 Hugging Face 上仍然处于热门趋势中。
Phonon 在 Hugging Face 开放 TTS 排行榜上的表现
Open TTS 排行榜是 Hugging Face 的一个非常新的项目,我们非常喜欢它。Hugging Face Hub 上拥有超过 9,000 个 TTS 模型,该排行榜为开发者提供了一个集中比较开源模型并并列聆听它们的地方。在 23 种语言中,模型的可懂度(输出的词错误率)、速度(逆实时因子和首音时间)以及自然度(英语使用 UTMOS,韩语使用 KOMOS)均得到评估。固定音色和语音克隆均被评估,后者还增加了说话人相似度指标。排行榜还设有“聆听”标签页,您可以方便地自行比较 TTS 输出结果,并为最喜爱的模型投票。
在可懂度方面,Phonon 在德语和西班牙语中排名第一,并在我们评估的所有语言中位列前三,其规模比某些大出 100 倍的模型还要小。
速度是 Phonon 真正大放异彩的地方,因为该模型在 CPU 流式基准测试的首音时间上位居榜首。
推理
我们为 Phonon 构建了新的推理框架 ptts。ptts 的目标是在各种设备上获得最佳性能,因此支持超过 10 个后端:CPU(Intel、Arm、WebAssembly)、GPU(CUDA、Vulkan、Metal、WebGPU)以及 NPU(Apple Core ML、Snapdragon®)。
从 v5.21 版本开始,Phonon 也作为其参考 PyTorch 实现出现在 🤗 Transformers 中。ptts 在设备上运行单一流,而 Transformers 则针对 GPU 吞吐量:批量生成、完整的图 torch.compile,例如用于大规模合成语音数据集。由于是原生 PyTorch,它是一个构建基础,无论您是想将 Phonon 集成到自己的技术栈中,还是研究模型本身。
它属于 Pocket TTS 谱系,因此我们首先将 Pocket TTS 添加到了 Transformers 中。Phonon 作为一个模块化模型位于其上层:仅用约 200 行代码描述差异部分。
Phonon 自回归地生成音频潜变量:每一步输出一个潜变量,并将其反馈作为下一步的输入,训练损失即基于这些潜变量计算。潜变量是模型的输入、输出和目标,正如文本标记对于语言模型的作用一样,因此将音频映射到潜变量的编解码器扮演着分词器的角色。Transformers 将其作为音频分词器提供:由处理器持有,与文本分词器并列:
from transformers import AutoProcessor, GradiumPhononTTSForConditionalGeneration
model_id = "gradium/phonon-31m-en"
processor = AutoProcessor.from_pretrained(model_id, device_map= "auto" )
model = GradiumPhononTTSForConditionalGeneration.from_pretrained(model_id, device_map= "auto" )
print ( f" {model.num_parameters():,} " )
print ( f" {processor.audio_tokenizer.num_parameters():,} " )
声音不是录音,而是说话人潜变量的张量。Phonon 从不直接使用其音频分词器编码音频,该分词器仅包含解码器,且声音是预计算的:gradium/phonon-voices 。
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
path = hf_hub_download( "gradium/phonon-voices" , "voices/LMDIYE0Oa377Qh6Z.safetensors" )
voice = load_file(path)[ "speaker_wavs" ][ 0 ].T
提示布局(声音位置、文本,然后是开启音频的标记)作为聊天模板随检查点一起提供,就像 Transformers 中的其他多模态模型一样。您编写标准对话,在声音所在的位置留出一个空的音频项,您的代码在不同检查点之间保持不变。处理器随后将声音占位符扩展为每帧一个位置,对文本进行归一化和分词,并对输入进行批处理:
conversation = [
{ "role" : "user" , "content" : [{ "type" : "audio" }, { "type" : "text" , "text" : "Hello from Phonon." }]}
]
inputs = processor.apply_chat_template(
conversation,
tokenize= True ,
return_dict= True ,
add_generation_prompt= True ,
processor_kwargs={ "audio_prompt_latents" : [voice]},
).to(model.device)
generate 返回潜变量,处理器将其解码为音频:
outputs = model.generate(**inputs)
audio = processor.decode(outputs.audio_latents, outputs.audio_latents_mask)
processor.save_audio(audio, "phonon.wav" )
查看 🤗 文档以获取更多信息!
下一步
Phonon 可以使用任何声音进行语音合成。在获得说话者同意的前提下,通过简短录音克隆一个声音,或者在 Gradium Studio 中用纯文本描述一个新的声音。然后下载该声音文件,将其加载到 Phonon 中,它将在设备上完全本地运行。
我们还与设计合作伙伴共同训练定制的 Phonon 模型。如果您的内存预算有限,我们可以缩小模型规模。如果您需要韩语、阿拉伯语或日语支持,我们也可以为此进行训练。如果您的产品拥有专属词汇表,我们可以在其基础上进行微调。请与我们联系,告诉我们您的需求。
感谢 Hugging Face 团队,以及在前两周内尝试过 Phonon 的每一个人。
Phonon 是我们的首次开源发布。欢迎试用并告诉我们您用它构建了什么。
Two weeks ago, we opened up Phonon, our small text-to-speech model that runs on your own device. It needs no server and no network, and what you type stays with you.
We've been very happy with the reception so far. So here's the story of the launch: why we built Phonon, what it can do, the demos that came with it, and how it did on Hugging Face's Open TTS Leaderboard.
Why a voice should live on your device
Most voice AI lives in the cloud: every sentence makes a round trip to a server. Phonon runs on your own device instead. Your text stays there and the voice works without a network. We’ve also opened the weights. Phonon 31m is Apache 2.0, so you can use it for free, even in a commercial product. The other models are CC BY-NC, so they’re free for non-commercial projects. If you’re building something commercial with those, pricing is based on your number of users, not how much speech you generate.
Getting a good voice to run on a small device has always been hard. You could make the model small, but then it didn’t sound great. Or you could make it sound great, but then it wouldn’t fit. We addressed both.
We announced Phonon in April and spent the next six months building on it with partners and early users. Their feedback helped us to shape this release. The models got smaller, and we added more languages and support for custom voices through voice cloning and voice design.
Phonon is based on the Pocket TTS lineage and as such uses flow matching to generate the audio which is very different from the modeling techniques used in other TTS systems. This is what allowed us to bring this level of quality to such a small model but it created new challenges while training the models. The training was initially numerically unstable and required several tricks to produce quality results on all five languages.
What we released
Phonon comes in two sizes, at about 65 MB and 75 MB. Together they speak English, French, German, Spanish and Portuguese. There are more than 100 built-in voices, and you can create your own in Gradium Studio . Phonon also handles the important things that most other TTS systems often stumble on, like phone numbers, dates and codes.
It runs on phones, laptops, single-board computers and in a browser tab, so you can hear it right now . Phonon 31m speaks English and is Apache 2.0, so you can build on it freely, including for commercial products. Phonon 40m covers all five languages under a non-commercial license.
Demos and first projects
The launch came with demos from friends and from our own team. On an Apple Watch with Wi-Fi off, Phonon talks you through a coffee brew step by step. On an iPhone with no signal, it counts your reps and keeps you going. A robot called Lamp, from Autonomous, wears a sorting hat and talks in character. In a browser, an offline dino runner becomes a radio show hosted by Rex. There's also a sci-fi game voiced on the player's own machine, and Proust read aloud page by page.
The Hugging Face team built the Transformers integration, so developers could use Phonon in Transformers from day one.
Developers have started building on it too. An ExecuTorch conversion runs Phonon on a visitor's GPU in the browser, Micdrop brings it to Node.js apps, and Spaces like smallest-s2s build on it.
Phonon was downloaded more than 200,000 times in its first two weeks, and it’s still trending on Hugging Face.
How Phonon did on the Hugging Face Open TTS Leaderboard
The Open TTS Leaderboard is a very new project from Hugging Face, and we love it. With more than 9,000 TTS models on the Hugging Face Hub , the leaderboard gives developers one place to compare open models and hear them side by side. Across 23 languages, models are evaluated on intelligibility ( word error rate of the outputs ), speed ( inverse real-time factor and time-to-first audio ), and naturalness ( UTMOS for English and KOMOS for Korean ). Fixed-voice and voice cloning are evaluated, with an additional speaker similarity metric for the latter. The leaderboard also has a Listen tab, where you can conveniently compare TTS outputs yourself and vote for the ones you like the most.
On intelligibility, Phonon ranks first in German and Spanish , and in the top three in every language we evaluated, next to models up to 100 times its size.
Speed is where we see Phonon truly shine, as the models top the CPU streaming benchmark on time-to-first audio.
Inference
We built a new inference framework, ptts , specifically for Phonon. The goal of ptts is to get the best performance on a wide variety of devices and as such supports more than 10 backends: CPU (Intel, Arm, WebAssembly), GPU (CUDA, Vulkan, Metal, WebGPU), and NPU (Apple Core ML, Snapdragon®).
Phonon is also available in 🤗 Transformers, from v5.21, as its reference PyTorch implementation. Where ptts runs a single stream on device, Transformers targets GPU throughput: batched generation, full-graph torch.compile , e.g., for synthesizing speech datasets at scale. Being native PyTorch, it is a base to build upon, whether to integrate Phonon into your own stack or to study the model itself.
It belongs to the Pocket TTS lineage, so we first added Pocket TTS to Transformers. Phonon sits on top as a modular model: about 200 lines describing only what differs.
Phonon generates audio latents autoregressively: each step outputs a latent that is fed back as the next input, and the training loss is computed on them. Latents are the model's inputs, outputs and targets, as text tokens are for a language model, so the codec mapping audio to latents plays the role of a tokenizer. Transformers ships it as such: an audio tokenizer , held by the processor next to the text tokenizer:
from transformers import AutoProcessor, GradiumPhononTTSForConditionalGeneration
model_id = "gradium/phonon-31m-en"
processor = AutoProcessor.from_pretrained(model_id, device_map= "auto" )
model = GradiumPhononTTSForConditionalGeneration.from_pretrained(model_id, device_map= "auto" )
print ( f" {model.num_parameters():,} " )
print ( f" {processor.audio_tokenizer.num_parameters():,} " )
A voice is not a recording but a tensor of speaker latents. Phonon never encodes audio directly with its audio tokenizer, which ships decoder-only, and voices come precomputed: gradium/phonon-voices .
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
path = hf_hub_download( "gradium/phonon-voices" , "voices/LMDIYE0Oa377Qh6Z.safetensors" )
voice = load_file(path)[ "speaker_wavs" ][ 0 ].T
The prompt layout (voice positions, text, then a token opening the audio) ships with the checkpoint as a chat template, as for other multimodal models in Transformers. You write a standard conversation, with an empty audio item where the voice goes, and your code stays the same across checkpoints. The processor then expands the voice placeholder to one position per frame, normalizes and tokenizes the text, and batches the inputs:
conversation = [
{ "role" : "user" , "content" : [{ "type" : "audio" }, { "type" : "text" , "text" : "Hello from Phonon." }]}
]
inputs = processor.apply_chat_template(
conversation,
tokenize= True ,
return_dict= True ,
add_generation_prompt= True ,
processor_kwargs={ "audio_prompt_latents" : [voice]},
).to(model.device)
generate returns latents, which the processor decodes to audio:
outputs = model.generate(**inputs)
audio = processor.decode(outputs.audio_latents, outputs.audio_latents_mask)
processor.save_audio(audio, "phonon.wav" )
See the docs 🤗 for more!
What's next
Phonon can speak with any voice. Clone one from a short recording with the speaker’s consent, or describe a new one in plain text in Gradium Studio . Then download the voice file, load it in Phonon, and it runs fully on the device.
We also train custom Phonon models with design partners. If your memory budget is tight, we can make the model smaller. If you need Korean, Arabic or Japanese, we can train for that too. And if your product has its own vocabulary, we can fine-tune on it. Get in touch and tell us what you need.
Thank you to the Hugging Face team, and to everyone who tried Phonon in its first two weeks.
Phonon is our first open release. Try it out and tell us what you build.
首次收录 · 2026-11-06 · 9.95 分