跳到正文

higurashi-ai

Haru

Haru: a low-latency, multilingual, full-duplex spoken dialogue model

README 已保存到本站,可直接阅读

Documentation snapshot

README 快照

这篇是英文原文

下面正文是项目自己的英文 README。想读全文就用浏览器自带的整页翻译: Chrome / Edge 点地址栏右侧的翻译图标,或用右键菜单里的「翻译成中文」; 手机浏览器一般在菜单里。

本页保存的是公开项目资料快照,阅读过程不需要连接 GitHub。

Haru

Model · Technical blog · Technical blog (Japanese)

Haru is a low-latency and multilingual full-duplex spoken dialogue model: it listens and speaks at the same time, the way people do on a phone call. This repository contains the inference code for Haru-4B, a pretrained base model, with three implementations and a web demo.

  • Native full-duplex at 7.5 Hz. Every 133 ms the model takes one frame of the user’s audio and produces one frame of its own audio and text. User audio, model audio and model text are summed into a single position of the language model, so listening and speaking never wait for each other.
  • Continuous audio, one sampling step. Audio is a 64-dimensional latent per frame. A small MLP head with MeanFlow sampling produces it in one step from the language model’s hidden state; there is no separate audio transformer and there are no discrete audio tokens.
  • Character and voice control. A text card sets the character, a short reference clip sets the voice.
  • Multilingual. English, Spanish, Portuguese, German, French, Chinese, Japanese, Russian and Korean.

How it works

  • The text stream carries the model’s words in chunks. Frames without text hold a padding token, and an end-of-padding token on the frame before the model starts to speak.
  • The audio codec is the causal VibeVoice acoustic tokenizer: 24 kHz audio to and from one latent per 3200 samples.
  • The prompt is the character card as a system turn, followed by the voice reference as audio on the model’s stream.

Repository

DirectoryWhat it is
haru/PyTorch implementation, web demo server, offline inference
haru_mlx/MLX implementation for Apple silicon, with a native macOS app
haru_vllm/Plugin that serves Haru with vLLM-Omni
client/Web client of the demo (React); a built copy ships inside haru

All three read the same checkpoint, higurashi-ai/Haru-4B.

Quick start

With an NVIDIA GPU (about 12 GB of memory):

pip install -e ./haru
python -m haru.server --hf-repo higurashi-ai/Haru-4B

Open , pick a character, give the model a voice, and talk. A browser only gives a page microphone access on localhost or over HTTPS.

For low latency, we recommend wired headphones and a wired microphone. Bluetooth devices add 100 ms or more.

To let someone else try it, add --share (pip install -e "./haru[share]"): the server prints a public HTTPS link that tunnels to it. Anyone with the link can use the demo, and the traffic passes through Gradio’s share servers.

Bring your own voice. Haru ships without voice clips. In the demo, upload or record a clip of the voice the model should speak with: one speaker, 3 seconds to 3 minutes, clean speech. In Python, pass it as reference. Only use voices you have the right to use.

To give the demo a default voice, save a clip as haru/haru/assets/voices/.flac (en.flac, ja.flac, …) and restart the server: the demo then offers it as the default voice of that language. Without the file, the demo does not show the option.

On a Mac with Apple silicon, build the native app (see haru_mlx/swift):

cd haru_mlx
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
cd swift && ./build_app.sh        # then open build/Haru.app

Python

from haru import DuplexSession, HaruModel
from haru.audio import load_audio, prepare_reference

model = HaruModel.from_pretrained("higurashi-ai/Haru-4B")
voice = prepare_reference(load_audio("voice.wav"))
session = DuplexSession(model, system_prompt=card, reference=voice)

frame = session.start()                  # the model's first 133 ms: frame.audio, frame.text
while not frame.done:
    frame = session.step(user_audio)     # 3200 samples at 24 kHz in, 3200 out

The model is one frame ahead of the user: start() returns frame 0, and each step() with user frame k returns model frame k + 1.

The system prompt

Haru reads its character from a card with a fixed layout. Build one with render_card:

from haru.prompt import card_templates, render_card

card = render_card(
    {
        "persona": "Haru is a 29-year-old nurse in Denver. She is warm, chatty and laughs easily.",
        "name": "Haru",
        "gender": "female",
        "other_name": "Sam",
        "relationship": "Old friends from high school.",
        "situation": "A phone call to catch up after a long time.",
    },
    card_templates()["templates"]["en"],
)

Offline

haru-inference user.wav reply.wav --reference voice.wav --system-prompt "$(cat card.txt)" --stereo

Serving with vLLM-Omni

For many concurrent conversations and the lowest latency on a GPU server, see haru_vllm/. The web demo can use it as its engine:

python -m haru.server --backend vllm --vllm-url http://localhost:8000

Custom kernels

The hot paths of a frame have hand-written kernels, alongside plain implementations that give the same results:

WhereKernelWhat it speeds up
haru (NVIDIA GPUs)Triton kernels replayed from CUDA graphs (haru/haru/codec_triton)The audio codec: about 0.7 ms instead of 6 ms to encode or decode a frame. Opt-in with DuplexConfig(codec_backend="triton") or --codec-backend triton
haru_vllmThe same Triton codec, used automaticallyAudio encode and decode inside the engine step
haru_mlx (Apple silicon)Metal kernels (gated_delta.py, vibevoice_codec.py)The Gated DeltaNet recurrence of the language model and the depthwise convolutions of the codec

Limitations

Haru-4B is a pretrained base model, released for research. It holds a natural conversation, but it is not a reliable source of facts and does not follow instructions the way an assistant does. It can imitate the voice of a reference clip; only use voices you have the right to use.

License

The code and the Haru-4B weights are released under the Apache License 2.0. See THIRD_PARTY_NOTICES.md for the third-party work they include.

Acknowledgments

Haru builds on the work of many open-source projects. We are grateful to their authors and communities.

  • Qwen — the Qwen3.5 language model that Haru-4B starts from.
  • VibeVoice — the causal acoustic tokenizer Haru uses as its audio codec, and the idea of next-latent generation at 7.5 Hz.
  • Moshi — the pioneering full-duplex speech model. Our web client is derived from the Moshi web client.
  • Improved MeanFlow — the one-step generative modeling framework behind the audio head.
  • vLLM and vLLM-Omni — the serving engine and its full-duplex realtime framework, which haru_vllm plugs into.
  • MLX, mlx-lm and mlx-audio — the array framework and the model code haru_mlx builds on.

Official distribution

获取与安装

暂未发现可确认的官方软件包地址

当前 README 快照没有出现 npm、PyPI、Crates.io、pub.dev 等官方包页链接。本站不会根据仓库名称猜测下载地址。

本站不托管项目文件;需要安装时,请以项目维护者发布的官方文档为准。

使用前核验

本站保存公开资料用于阅读,不代表安全审计或功能背书。安装前请核对许可证、依赖来源和发布签名,不要直接运行来源不明的二进制文件或高权限脚本。