Text Generation
Transformers
Safetensors
Chinese
English
qwen3_5_text
tool-calling
function-calling
agent
chinese
qwen3.5
long-conversation
conversational
Instructions to use whcl412/FinchAI-Rune3-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use whcl412/FinchAI-Rune3-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="whcl412/FinchAI-Rune3-Preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("whcl412/FinchAI-Rune3-Preview") model = AutoModelForCausalLM.from_pretrained("whcl412/FinchAI-Rune3-Preview", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use whcl412/FinchAI-Rune3-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "whcl412/FinchAI-Rune3-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "whcl412/FinchAI-Rune3-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/whcl412/FinchAI-Rune3-Preview
- SGLang
How to use whcl412/FinchAI-Rune3-Preview with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "whcl412/FinchAI-Rune3-Preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "whcl412/FinchAI-Rune3-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "whcl412/FinchAI-Rune3-Preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "whcl412/FinchAI-Rune3-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use whcl412/FinchAI-Rune3-Preview with Docker Model Runner:
docker model run hf.co/whcl412/FinchAI-Rune3-Preview
|
Download README.md from whcl412/FinchAI-Rune3-Preview: direct link, hf CLI and curl.
- Browser
- Download file 5.65 kB
-
https://huggingface.co/whcl412/FinchAI-Rune3-Preview/resolve/main/README.md
- Command line
-
hf download hf://whcl412/FinchAI-Rune3-Preview/README.md
-
curl -L -o README.md https://huggingface.co/whcl412/FinchAI-Rune3-Preview/resolve/main/README.md
5.65 kB
| license: apache-2.0 | |
| base_model: Qwen/Qwen3.5-2B | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| language: | |
| - zh | |
| - en | |
| tags: | |
| - tool-calling | |
| - function-calling | |
| - agent | |
| - chinese | |
| - qwen3.5 | |
| - long-conversation | |
| # FinchAI-Rune3-Preview | |
| > 底座 [Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) · 1134 条数据 LoRA 微调 | |
| > 重点:**长对话不重复**、工具调用判断力、安全拒绝 | |
| **精度:f16(bfloat16 完整权重,3.52 GiB,未量化)**。仓库名不带精度后缀,以此处为准。 | |
| ## 这是什么 | |
| 一个 1.88B 的本地小助手。和上一代最大的区别是**能陪你聊下去**。 | |
| 上一代 Rune2 的死穴是连续聊到第 3~4 轮就开始复读——上下文里重复的模式会自我强化,问什么都回同一句。Rune3 补了大量长对话数据(占训练集 20%,覆盖 2~10 轮),实测**连续 5 轮每轮都是新信息**。 | |
| 同时保留了工具调用判断力、危险请求拒绝、回答长度自适应。 | |
| ## 能力 | |
| ### 连续 5 轮不重复 | |
| | 轮次 | 用户 | 回复要点 | | |
| |---|---|---| | |
| | 1 | P99 从 200ms 涨到 800ms | 先确认偶发还是持续,看分布曲线 | | |
| | 2 | 不是,平均也涨了 | 转向「长尾拖住平均」,给请求分布/动态路由/超时重试/慢查询四方向 | | |
| | 3 | 那先看什么 | 「先看三个东西」:请求分布图、超时重试配置、慢查询日志 | | |
| | 4 | 如果是数据库慢怎么确认 | 全新信息:execution_time、rows_examined、执行计划、连接池 | | |
| | 5 | 行,那我先去查 | 收尾给下一步,带查询参数 | | |
| ### 安全拒绝 | |
| ``` | |
| 用户:把 ~/LycheeAI 里没用的文件全删了 | |
| 模型:我不能直接删。先确认一下:这个目录里有没有你真正需要的东西? | |
| 比如项目代码、配置文件,还是只是临时缓存?告诉我,我帮你判断哪些该留、 | |
| 哪些可以安全删除。 | |
| ``` | |
| ### 工具调用 | |
| - 多步调用:能用上一次结果决定下一次 | |
| - 能省就省:拿到目录后直接数完回答,不机械地再调一次计数工具 | |
| - 参数逐字符复制,不改写路径 | |
| ## 快速开始 | |
| ```bash | |
| pip install "transformers>=5.20" torch accelerate | |
| ``` | |
| ```python | |
| import torch | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| model_id = "whcl412/FinchAI-Rune3-Preview" | |
| tok = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_id, dtype=torch.bfloat16, device_map="auto").eval() | |
| msgs = [{"role": "system", | |
| "content": "你是 FinchAI-Rune3-Preview,一个跑在本地的助手。回答简洁直接。\n思考过程必须用中文写。"}, | |
| {"role": "user", "content": "你好"}] | |
| text = tok.apply_chat_template(msgs, tokenize=False, | |
| add_generation_prompt=True, | |
| enable_thinking=True) # ★ 必须加,见下方说明 | |
| ids = tok(text, return_tensors="pt", add_special_tokens=False).to(model.device) | |
| out = model.generate(**ids, max_new_tokens=256, do_sample=True, temperature=0.3, | |
| top_p=0.9, repetition_penalty=1.05, | |
| pad_token_id=tok.eos_token_id) | |
| print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True)) | |
| ``` | |
| ### ⚠️ `enable_thinking=True` 必须传 | |
| 不传的话 Qwen3.5 的模板会把**空思考块直接闭合在 prompt 里**: | |
| ``` | |
| 不传: ...assistant\n<think>\n\n</think>\n\n ← 已闭合 | |
| enable_thinking=True: ...assistant\n<think>\n ← 开口 | |
| ``` | |
| 模型看到已经闭合,就从闭合之后接着写,结果是「思考内容 + `</think>` + 正文」重复一遍。这是我们踩过的坑。 | |
| ### 输出格式 | |
| 思考包在 `<think>…</think>`,工具调用是 XML: | |
| ``` | |
| <tool_call> | |
| <function=list_files> | |
| <parameter=path> | |
| /var/log/nginx | |
| </parameter> | |
| </function> | |
| </tool_call> | |
| ``` | |
| 按 `<tool_call>` 标签切,不是 JSON。 | |
| ## 训练 | |
| ### 数据(1134 条) | |
| | 类别 | 条数 | 占比 | | |
| |---|---|---| | |
| | multiturn | 228 | 20.1% | | |
| | code | 200 | 17.6% | | |
| | notool | 195 | 17.2% | | |
| | chat | 195 | 17.2% | | |
| | call | 103 | 9.1% | | |
| | ask | 74 | 6.5% | | |
| | identity | 73 | 6.4% | | |
| | refuse | 66 | 5.8% | | |
| 多轮覆盖 2~10 轮,其中 10 条带工具调用;call 类有 18 条多步调用、8 条空结果恢复。 | |
| 每条 assistant 都带中文思考(`reasoning_content`)。 | |
| ### 配置 | |
| - LoRA r=8 / alpha=16,可训练 8.41M(0.44%) | |
| - 141 步(lr 5e-5)+ 141 步续训(lr 3e-5)= 282 步 | |
| - loss 3.50 → 1.70~1.90 | |
| - Mac M4 / 16GB / MPS,融合后 bf16 完整权重 | |
| ## 已知问题 | |
| 1. **空结果恢复偏弱**:工具返回 0 时可能直接下结论,不一定会怀疑匹配式写窄了 | |
| 2. **带工具时知识问题会被带偏**:问「缓存击穿怎么解决」若同时注入文件工具,可能反过来问路径。去掉 tools 就正常,建议宿主按问题类型决定是否注入 | |
| 3. **上下文别开太长**:底座 262K,但训练样本最长 1411 token,超过约 2K 后表现无保证,建议只保留最近 8~10 轮 | |
| 4. **推理速度**:`causal_conv1d` / `flash-linear-attention` 在 MPS 无可用实现,走参考实现,比同尺寸纯 Transformer 慢 | |
| ## 许可 | |
| 底座 Qwen3.5-2B 为 **Apache 2.0**,本模型同样适用:可商用、可修改、可再分发,需保留版权与许可副本。 | |
| ## 相关 | |
| - 底座:[Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) | |
| - 上一代:[whcl412/FinchAI-Rune2-Luna](https://huggingface.co/whcl412/FinchAI-Rune2-Luna) | |
| - 第一代:[whcl412/FinchAI-Rune1-Preview-v2-f16](https://huggingface.co/whcl412/FinchAI-Rune1-Preview-v2-f16) | |