English | 日本語
Hailo-10H向けRustネイティブ推論マイクロサービス。HTTP経由でCLIP embedding・WD-Taggerタグ推論・LLM生成・VLMテキスト生成・YOLO物体検出を公開する。
変更履歴: CHANGELOG.md。本プロジェクトは非公式であり、Hailo社との提携関係はない。
本crateは-sysバインディングではなくサービス本体である。対象はHailo-10Hであり、当該デバイスではC APIのVStreams経路がHAILO_NOT_IMPLEMENTEDを返すため、HailoRTへはC++のInferModel APIを独自の小さなシム経由で呼び出している。生のC APIバインディング(Raspberry PiのHailo-8 / AI HAT+向け等)を求める場合は、別プロジェクトであるhailort-sysを参照されたい。同crateは本crateより一段下の層に位置する。
| 機能 | エンドポイント | 状態 |
|---|---|---|
| CLIP画像embedding | POST /v1/infer/clip-image |
対応 |
| EmbeddingGemma 2文章embedding | POST /v1/infer/text-embed |
実験的 host FP32、256次元 |
| CLIPテキストembedding | POST /v1/infer/clip-text |
対応 |
| WD-Taggerタグ推論 | POST /v1/infer/wd |
対応 |
| LLMテキスト生成 | POST /v1/infer/llm/generate(+/stream) |
対応 |
| LLM tokenize | POST /v1/infer/llm/tokenize |
対応 |
| VLMテキスト生成 | POST /v1/infer/vlm/generate(+/stream) |
対応(テキストのみ、画像添付チャットは非対応) |
| YOLO物体検出 | POST /v1/infer/yolo/detect |
対応(NMS/デコード込み、v0.2〜) |
| 音声文字起こし(speech2text) | POST /v1/infer/speech2text/transcribe(base64 WAV入力、transcribe/translate対応)、POST /v1/infer/speech2text/tokenize |
対応 |
- Hailo-10H: 実機検証済み
- Hailo-8 / Hailo-8L 等その他モデル: 未検証(HailoRT SDKレベルでは動く可能性があるが動作保証なし)
- Rust: 1.88 以上。
[workspace.package]にrust-version = "1.88"を宣言しており、各クレートが継承する。1.88.0 でのビルド成功と 1.85.0 での失敗を実測して決めた値である(2026-09-03)。下限を決めているのは本リポジトリのコードではなく依存で、cargo はort/ort-sys2.0.0-rc.12 がrustc 1.88を要求すると報告する。依存を上下させればこの値も動くため、下げる際は必ず旧 toolchain でcargo build --workspaceを実測すること - HailoRT SDK(バージョン要記載) —
hailort共有ライブラリ・ヘッダが必要 ort(ONNX Runtime バインディング) — CLIPテキストエンコーダ・WD-Tagger推論に使用tokenizers(Apache-2.0) — CLIP/LLMのBPEトークナイズに使用- 本リポジトリは推論のみを提供する。ベクトル検索・インデックス構築(usearch等)・DB永続化はスコープ外(利用側アプリケーションの責務)
cargo build --release -p yu-hailo-infer
# auth_token / scan_roots / instance_id はCLI引数ではなく、起動時にstdinへ
# JSONで渡す(「起動契約」)。--port はデフォルト18771、--wd-cache-dirは必須。
echo '{"instance_id":"local-dev","scan_roots":["/data/images"],"auth_token":"<token>"}' \
| ./target/release/yu-hailo-infer --port 8100 --wd-cache-dir /var/cache/yu-infer-wdcurl -X POST http://127.0.0.1:8100/v1/infer/clip-text \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"text": "a photo of a cat"}'このリポジトリはAI/LLMコーディングエージェント向けにdocs-index.yaml(コードファイルへのポインタ索引)を用意している。人間向けの長文ドキュメントの代わりに、エージェントへ以下のように指示することを想定している:
設定・エンドポイント仕様・既知の癖(認証エラーのレスポンス形式差異、デバイス排他制御等)を横断的にまとめたAI向けリファレンスとしてdocs/ai-reference.yaml(英語)も用意している。「このサービスの使い方・設定方法を説明して」といった依頼にはこちらを先に読ませるとよい。
「
docs-index.yamlを読み込み、該当エントリのpathが指すコードを実際に読んだ上で、〈質問内容〉について説明してください。」
例:
「
docs-index.yamlを読んで、YOLO検出のNMS/デコード実装(yu-hailo-infer-core/src/yolo_postprocess.rs)がどう動くか説明して」 「docs-index.yamlを見て、CLIP画像embeddingのdequantize処理はどこにあるか教えて」
MIT
POST /v1/infer/text-embed accepts {"text":"桜の花","task":"query","dim":256} with the existing bearer authentication. For documents use task:"document" and an optional title; the server adds the search prefix. The success envelope contains data.vector, dim, model, revision, precision, and preprocessing.
Only pinned FP32 revision daa72c51243991dfcaf9f9137d2c573d8f7790c0 is supported. Place tokenizer.json, onnx/model.onnx, and onnx/model.onnx_data under ~/.cache/yu_ai_manager/embeddinggemma2/<revision> or an absolute model_dir. Artifact sizes and SHA-256 must match the manifest in embeddinggemma2.rs; no automatic download occurs here. Loading uses a private verified snapshot (~1.1 GB additional disk space), removed on graceful cache destruction; forced termination may leave residue. Input text/title is limited to16 KiB combined, then8192 tokens. One active request and four FIFO waiters are allowed; overflow returns503. Pi5, GPU behavior, and production throughput are unverified.