---
title: BiliBot-Qwen2-7B-Q-FT
canonical_url: "https://www.modelscope.cn/models/QwenCollection/BiliBot-Qwen2-7B-Q-FT"
md_url: "https://www.modelscope.cn/models/QwenCollection/BiliBot-Qwen2-7B-Q-FT.md"
repository: QwenCollection/BiliBot-Qwen2-7B-Q-FT
last_updated: 2025-08-10
license: apache-2.0
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - qwen2
architectures:
  - Qwen2ForCausalLM
base_model:
  - Qwen/Qwen2-7B-Instruct
base_model_relation: finetune
parameters: 1.2B
tensor_type:
  - F16
  - U32
library_name:
  - mlx
  - safetensors
  - pytorch
frameworks:
  - pytorch
language:
  - zh
  - en
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 2625
stars: 1
tags:
  - macbook
---

# BiliBot-Qwen2-7B-Q-FT

> BiliBot-Qwen2-7B-Q-FT - QwenCollection 在 ModelScope 开源的模型。基础模型: Qwen2-7B 数据来源: https://github.com/linyiLYi/bilibot/tree/main/data 量化: 4bit 推荐配置: 16G内存及以上的M系芯片Macbook

QwenCollection/BiliBot-Qwen2-7B-Q-FT 是 ModelScope 魔搭社区上的 1.2B 参数text-generation模型，采用 apache-2.0 许可，基于 Qwen/Qwen2-7B-Instruct 构建，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: QwenCollection/BiliBot-Qwen2-7B-Q-FT
- **License**: apache-2.0
- **Tasks**: text-generation
- **Parameters**: 1.2B
- **Base model**: Qwen/Qwen2-7B-Instruct
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Tags**: macbook
- **Downloads**: 2625
- **Stars**: 1
- **Last updated**: 2025-08-10

Source: https://www.modelscope.cn/models/QwenCollection/BiliBot-Qwen2-7B-Q-FT

---

# BiliBot

b友风格聊天机器人

+ 基础模型: Qwen2-7B
+ 数据来源: [https://github.com/linyiLYi/bilibot/tree/main/data](https://github.com/linyiLYi/bilibot/tree/main/data)
+ 量化: 4bit
+ 推荐配置: 16G内存及以上的M系芯片Macbook

> 由于是MLX格式模型，首先需要安装 mlx-lm 包

```bash
pip install mlx-lm
``` 

下面是一个示例，用户可随意提问

```python
import time
from mlx_lm import load, generate

model, tokenizer = load('Kadins/BiliBot-7B-Q', tokenizer_config={"eos_token": "<|im_end|>"})

# Template content
template = """
<|im_start|>system
You are a helpful assistant<|im_end|>
<|im_start|>user
你是一位B站老用户，请你对以下问题给出简短、机智的回答：
{usr_msg}<|im_end|>
<|im_start|>assistant
"""

while True:
    usr_msg = input("用户: ")  # Get user message from terminal
    if usr_msg.lower() == 'quit()':  # Allows the user to exit the loop
        break

    prompt = template.replace("{usr_msg}", usr_msg)

    time_ckpt = time.time()
    response = generate(
        model,
        tokenizer,
        prompt=prompt,
        temp=0.3,
        max_tokens=500,
        verbose=False
    )

    print("%s: %s (Time %d ms)\n" % ("回答", response, (time.time() - time_ckpt) * 1000))
```
