Skip to content

Latest commit

 

History

History
83 lines (60 loc) · 2 KB

File metadata and controls

83 lines (60 loc) · 2 KB

安装与本地运行

启动本地服务

cd local-service
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m app.main

服务默认监听:

http://127.0.0.1:8765

确认许可证

curl -s -X POST http://127.0.0.1:8765/api/license/accept \
  -H 'Content-Type: application/json' \
  -d '{"model":"HY-MT1.5-1.8B","license":"Tencent HY Community License Agreement","accepted":true}'

真实运行时目录

源码开发阶段建议使用项目内 .local-data 目录:

/Users/issac/Documents/local-translator/.local-data/
  models/Hy-MT1.5-1.8B-1.25bit.gguf
  runtime/darwin-arm64/llama-server

当前 STQ 分支实测可加载的模型文件是:

/Users/issac/Documents/local-translator/.local-data/models/Hy-MT1.5-1.8B-STQ1_0.gguf

llama-server 必须是支持 STQ kernel 的预编译版本。放好后需要确保可执行:

chmod +x /Users/issac/Documents/local-translator/.local-data/runtime/darwin-arm64/llama-server

启动服务:

cd /Users/issac/Documents/local-translator/local-service
HYMT_HOME=/Users/issac/Documents/local-translator/.local-data python -m app.main

验证翻译

curl -s -X POST http://127.0.0.1:8765/api/translate \
  -H 'Content-Type: application/json' \
  -d '{"source_lang":"auto","target_lang":"zh","texts":["Hello world"],"mode":"plain"}'

加载 Chrome 扩展

  1. 打开 Chrome 扩展管理页。
  2. 开启开发者模式。
  3. 选择“加载已解压的扩展程序”。
  4. 选择仓库中的 chrome-extension 目录。

真实 GGUF 接入说明

真实模型需要准备经过验证的预编译 llama-server

runtime/
  darwin-arm64/llama-server
  darwin-x64/llama-server
  windows-x64/llama-server.exe
  linux-x64/llama-server

Hy-MT1.5-1.8B-STQ1_0.gguf 依赖 STQ kernel。正式启用前必须记录每个平台的运行时版本、构建 commit、构建参数、运行时 SHA256、模型文件大小和模型 SHA256。