1:确认 Vulkan 驱动正常

首先确保显卡驱动和 Vulkan 运行时正常,这是硬件加速的基础。

# 安装 Vulkan 工具和 AMD 驱动(如未安装)
sudo apt update && sudo apt install -y libvulkan1 mesa-vulkan-drivers vulkan-tools

# 查看 Vulkan 设备摘要
vulkaninfo --summary

解释

  • mesa-vulkan-drivers:AMD 开源 RADV 驱动的 Vulkan 实现

  • vulkan-tools:包含 vulkaninfo 诊断工具

  • 正常输出应包含 AMD Radeon RX 590 GME (RADV POLARIS10) 设备,代表显卡已被 Vulkan 正确识别

注:输出中的 No DRI3 support 警告不影响计算加速,仅影响图形显示;llama.cpp 用的是计算功能,可忽略。

步骤 2:下载新版 llama.cpp 预编译包(带 Vulkan)

选择 b10068 版本,该版本完整支持 Qwen3 架构,且预编译了 Vulkan 后端,省去本地编译的麻烦。

# 进入工作目录
mkdir -p ~/my-llm && cd ~/my-llm

# 下载预编译包(带断点续传,网络差会自动重试)
wget -c shturl.cc/kGRLChmJcvWRyiqVHz60r1lmOvnt4HUAVsnXUmHaDmIDHkgfaxNS6p5TU0VW1Kt7Mr0LdWnLhOJc0AmzPPWuDCMVAUJ8101BFDJUgxue4v4rSa6Ka

解释

  • -c:启用断点续传,下载中断后重新执行命令会自动接着下,不用从头开始

  • 选择 Ubuntu Vulkan 专属预编译包,比通用包对 AMD 显卡适配更好

  • 若该加速链接失效,可更换其他代理源

步骤 3:解压与权限配置

# 解压压缩包
tar -xzf llama-b10068-bin-ubuntu-vulkan-x64.tar.gz

# 给主程序添加可执行权限
chmod +x ~/my-llm/llama-b10068/llama-cli

解释

  • 解压后二进制文件在 llama-b10068 目录下

  • 默认下载的文件可能没有执行权限,chmod +x 添加后才能运行

步骤 4:验证版本

~/my-llm/llama-b10068/llama-cli --version

预期输出

version: 10068 (571d0d540)
built with GNU 11.4.0 for Linux x86_64

版本号 ≥ 10068,确认支持 Qwen3 模型架构。


四、模型下载(ModelScope 国内镜像)

使用阿里 ModelScope 国内镜像下载模型,避免 HuggingFace 网络问题。

步骤 1:安装 Python venv 支持

sudo apt update && sudo apt install -y python3-pip python3.12-venv

解释

  • python3-pip:pip 基础包

  • python3.12-venv:虚拟环境模块,Ubuntu 24.04 默认不带

步骤 2:创建并激活虚拟环境

# 在工作目录创建虚拟环境
python3 -m venv ~/my-llm/venv

# 激活虚拟环境
source ~/my-llm/venv/bin/activate

解释

  • 激活成功后终端提示符前会出现 (venv) 标记

  • 此时 pip 操作只会影响虚拟环境内的 Python,不会破坏系统依赖

  • 每次新开终端使用 modelscope 都需要先执行激活命令

步骤 3:安装 ModelScope 工具

pip install modelscope -i https://pypi.tuna.tsinghua.edu.cn/simple

解释

  • 使用清华 PyPI 镜像源,下载速度远快于官方源

  • 仅在虚拟环境内安装,系统无残留

步骤 4:下载模型

modelscope download --model unsloth/Qwen3.5-9B-GGUF --file Qwen3.5-9B-Q4_K_M.gguf --local-dir ~/my-llm/models

modelscope

魔搭社区的命令行工具,相当于"应用商店的下载器"

download

告诉它"我要下载"

--model unsloth/Qwen3.5-9B-GGUF

下载哪个仓库的模型——unsloth 这个人打包的千问 3.5 九B版

--file Qwen3.5-9B-Q4_K_M.gguf

只要仓库里的这一个文件

--local-dir ~/my-llm/models

存到你家目录下的 my-llm/models 文件夹

这条命令没成功,就是之前说的 --file 这个参数在你这个新版本里被废弃了,会报"无法识别的参数"。

bash

编辑

modelscope download --model unsloth/Qwen3.5-9B-GGUF --include 'Qwen3.5-9B-Q4_K_M.gguf' --local-dir ~/my-llm/models

跟上面几乎一样,就改了一个词:--file 换成了 --include。新版用 --include 来筛选"只下载仓库里哪个文件"。这条跑成功了,所以你 ls 的时候看到了那个 5.3G 的文件。

RX 580 8GB 显存,这几个最值得下:

表格

模型

谁家的

擅长什么

Q4 体积

你的卡能跑吗

DeepSeek-R1-Distill-Qwen-7B

深度求索

数学、逻辑推理,MATH-500 准确率 92.8%,会"深度思考"

约 4.4GB

✅ 很轻松

小米 MiMo-7B

小米

数学推理黑马,7B 小身材干翻过 32B 的模型

约 4GB+

✅ 很轻松

GLM-Z1-9B-0414

智谱 AI

数学+代码专项优化,金融、教育题库场景强

约 5.5GB

✅ 刚好

Qwen3-8B

阿里

中文理解强,支持思考/非思考双模式

约 5.2GB

✅ 刚好

Llama 3.1 8B

Meta

英文生态最强,但中文偏弱

约 4.7GB

✅ 能跑

一个避坑提醒:MiniMax 的 M2.5 虽然标着"10B 激活参数",但它是 MoE 架构,总参数 230B,量化后远超你显存,直接跳过。小米那个 309B 总参数的 MiMo-V2-Flash 同理,别碰 。

~/my-llm/models,不用换引擎:

bash

编辑

# DeepSeek R1 蒸馏 7B
modelscope download --model unsloth/DeepSeek-R1-Distill-Qwen-7B-GGUF DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf --local-dir ~/my-llm/models

# 智谱 GLM-Z1-9B(推理版)
modelscope download --model lmstudio-community/GLM-Z1-9B-0414-GGUF GLM-Z1-9B-0414-Q4_K_M.gguf --local-dir ~/my-llm/modelshi

# 创建模型存放目录
mkdir -p ~/my-llm/models

参数说明

  • --model:ModelScope 上的模型仓库名

  • --file:具体要下载的模型文件名

  • --local-dir:模型保存到本地的路径


 pip install huggingface_hub
Collecting huggingface_hub
  Downloading huggingface_hub-1.31.0-py3-none-any.whl.metadata (16 kB)
Collecting click<9.0.0,>=8.4.2 (from huggingface_hub)
  Downloading click-8.5.0-py3-none-any.whl.metadata (2.6 kB)
Requirement already satisfied: filelock>=3.10.0 in ./venv/lib/python3.12/site-packages (from huggingface_hub) (3.32.7)
Collecting fsspec>=2023.5.0 (from huggingface_hub)
  Downloading fsspec-2026.7.0-py3-none-any.whl.metadata (10 kB)
Collecting hf-xet<2.0.0,>=1.5.2 (from huggingface_hub)
  Downloading hf_xet-1.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (4.9 kB)
Collecting httpx<1,>=0.23.0 (from huggingface_hub)
  Downloading httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)
Requirement already satisfied: packaging>=20.9 in ./venv/lib/python3.12/site-packages (from huggingface_hub) (26.3)
Collecting pyyaml>=5.1 (from huggingface_hub)
  Downloading pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (2.4 kB)
Requirement already satisfied: tqdm>=4.42.1 in ./venv/lib/python3.12/site-packages (from huggingface_hub) (4.70.1)
Collecting typing-extensions>=4.1.0 (from huggingface_hub)
  Downloading typing_extensions-4.16.0-py3-none-any.whl.metadata (3.3 kB)
Collecting anyio (from httpx<1,>=0.23.0->huggingface_hub)
  Downloading anyio-4.15.1-py3-none-any.whl.metadata (4.7 kB)
Requirement already satisfied: certifi in ./venv/lib/python3.12/site-packages (from httpx<1,>=0.23.0->huggingface_hub) (2026.7.22)
Collecting httpcore==1.* (from httpx<1,>=0.23.0->huggingface_hub)
  Downloading httpcore-1.0.9-py3-none-any.whl.metadata (21 kB)
Requirement already satisfied: idna in ./venv/lib/python3.12/site-packages (from httpx<1,>=0.23.0->huggingface_hub) (3.19)
Collecting h11>=0.16 (from httpcore==1.*->httpx<1,>=0.23.0->huggingface_hub)
  Downloading h11-0.16.0-py3-none-any.whl.metadata (8.3 kB)
Downloading huggingface_hub-1.31.0-py3-none-any.whl (798 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 798.3/798.3 kB 507.8 kB/s eta 0:00:00
Downloading click-8.5.0-py3-none-any.whl (125 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.3/125.3 kB 177.1 kB/s eta 0:00:00
Downloading fsspec-2026.7.0-py3-none-any.whl (206 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 206.6/206.6 kB 377.4 kB/s eta 0:00:00
Downloading hf_xet-1.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 588.7 kB/s eta 0:00:00
Downloading httpx-0.28.1-py3-none-any.whl (73 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.5/73.5 kB 333.9 kB/s eta 0:00:00
Downloading httpcore-1.0.9-py3-none-any.whl (78 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.8/78.8 kB 649.9 kB/s eta 0:00:00
Downloading pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (807 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 807.9/807.9 kB 560.9 kB/s eta 0:00:00
Downloading typing_extensions-4.16.0-py3-none-any.whl (45 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.6/45.6 kB 528.4 kB/s eta 0:00:00
Downloading anyio-4.15.1-py3-none-any.whl (132 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 132.1/132.1 kB 482.5 kB/s eta 0:00:00
Downloading h11-0.16.0-py3-none-any.whl (37 kB)
Installing collected packages: typing-extensions, pyyaml, hf-xet, h11, fsspec, click, httpcore, anyio, httpx, huggingface_hub
Successfully installed anyio-4.15.1 click-8.5.0 fsspec-2026.7.0 h11-0.16.0 hf-xet-1.6.0 httpcore-1.0.9 httpx-0.28.1 huggingface_hub-1.31.0 pyyaml-6.0.3 typing-extensions-4.16.0

export HF_ENDPOINT=https://hf-mirror.com
(venv) shitou@shitou:~/my-llm$
hf download bartowski/Llama-3.3-8B-Instruct-GGUF --include '*Q4_K_M*' --local-dir ~/my-llm/models && hf download bartowski/Mistral-7B-Instruct-v0.3-GGUF --include '*Q4_K_M*' --local-dir ~/my-llm/models && hf download bartowski/gemma-3-12b-it-GGUF --include '*Q4_K_M*' --local-dir ~/my-llm/models
Returning existing local_dir `/home/shitou/my-llm/models` as remote repo cannot be accessed in `snapshot_download` (401 Client Error. (Request ID: Root=1-6aaa84fe-213d227312c7f5d016218e14;64be16f9-2892-40b5-8521-c80c6692402f)

Repository Not Found for url: https://hf-mirror.com/api/models/bartowski/Llama-3.3-8B-Instruct-GGUF/revision/main.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated and your token has the required permissions.
For more details, see https://huggingface.co/docs/huggingface_hub/authentication
Invalid username or password.).
✓ Downloaded
  path: /home/shitou/my-llm/models
Downloading bytes: █▉                                                                                               | 84.7MB, 13.6MB/s
Reconstructing (incomplete total...):   0%|                                                                |  0.00B / 4.37GB
Fetching 1 files:   0%|                                                                                           | 0/1 [00:00<?, ?it/s]

五、启动运行与加速验证

启动模型(全量显卡加速)

 echo 'export PATH="$HOME/my-llm/llama-b10068:$PATH"' >> ~/.bashrc
source ~/.bashrc

验证 Vulkan 加速生效

启动后查看终端日志,出现 ggml_vulkan 相关字样、且设备显示 AMD 显卡,代表加速成功。 也可以通过显存占用判断:

cat /sys/class/drm/card*/device/mem_info_vram_used

# 1. Mistral 7B(4.1G,最轻,先拿它测)

shitou@shitou:~/my-llm$ /home/shitou/my-llm/llama-b10068/llama-cli \
  -m ~/my-llm/models/Mistral-7B-Instruct-v0.3-Q4_K_M.gguf \
  -ngl 99 -c 2048 -cnv -p "你好"


Loading model...

▄▄ ▄▄
██ ██
██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
                                    ██    ██
                                    ▀▀    ▀▀

build      : b10068-571d0d540
model      : /home/shitou/my-llm/models/Mistral-7B-Instruct-v0.3-Q4_K_M.gguf
ftype      : Q4_K - Medium
modalities : text

available commands:
  /exit or Ctrl+C     stop or exit
  /regen              regenerate the last response
  /clear              clear the chat history
  /read <file>        add a text file
  /glob <pattern>     add text files using globbing pattern



> 你好
 你好! 我是一个AI助手,可以帮助你回答问题,解决问题,和生成文字。 有什么需要我帮忙的吗?

(如果你想要中文,我也可以!)

(如果你想要其他语言,我可能会有点困难,但我会尽力帮你!)

(如果你想要朋友,我可能不是最佳选择,但我会尽力回答你的问题并提供帮助!)

(如果你想要娱乐,我可以随机生成故事,玩游戏,或者开个笑话!)

(如果你想要学习,我可以帮你学习各种事物,从数学到编程,从科学到人类文化!)

(如果你想要更多信息,请告诉我!)

(如果你想要更多,请告诉我!)

(如果你想要更多,请告诉

[ Prompt: 47.8 t/s | Generation: 19.3 t/s ]





shitou@shitou:~/my-llm$ /home/shitou/my-llm/llama-b10068/llama-cli \
  -m ~/my-llm/models/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf \
  -ngl 99 -c 2048 -cnv -p "鸡兔同笼,共35头94足,各几只?"


Loading model...

▄▄ ▄▄
██ ██
██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
                                    ██    ██
                                    ▀▀    ▀▀

build      : b10068-571d0d540
model      : /home/shitou/my-llm/models/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf
ftype      : Q4_K - Medium
modalities : text

available commands:
  /exit or Ctrl+C     stop or exit
  /regen              regenerate the last response
  /clear              clear the chat history
  /read <file>        add a text file
  /glob <pattern>     add text files using globbing pattern



> 鸡兔同笼,共35头94足,各几只?

[Start thinking]


首先,设鸡的数量为x只,兔的数量为y只。

根据题意,鸡和兔的总头数是35,因此可以列出方程:
x + y = 35

鸡有2只脚,兔有4只脚,所以总脚数是94,可以列出方程:
2x + 4y = 94

接下来,解这个方程组。首先从第一个方程中解出x:
x = 35 - y

将这个表达式代入第二个方程:
2(35 - y) + 4y = 94

展开并简化方程:
70 - 2y + 4y = 94
70 + 2y = 94
2y = 24
y = 12

然后,将y的值代入x = 35 - y:
x = 35 - 12 = 23

因此,鸡有23只,兔有12只。
[End thinking]



要解决**鸡兔同笼**问题,我们可以通过设立方程组来求解。以下是详细的步骤:

1. **设定变量:**
   - 设鸡的数量为 \( x \) 只。
   - 设兔的数量为 \( y \) 只。

2. **根据题意列出方程:**
   - 根据总头数:
     \[
     x + y = 35
     \]
   - 根据总脚数:
     \[
     2x + 4y = 94
     \]

3. **解方程组:**
   - 从第一个方程解出 \( x \):
     \[
     x = 35 - y
     \]
   - 将 \( x = 35 - y \) 代入第二个方程:
     \[
     2(35 - y) + 4y = 94
     \]
     \[
     70 - 2y + 4y = 94
     \]
     \[
     70 + 2y = 94
     \]
     \[
     2y = 24
     \]
     \[
     y = 12
     \]
   - 将 \( y = 12 \) 代入 \( x = 35 - y \):
     \[
     x = 35 - 12 = 23
     \]

4. **结论:**
   - 鸡的数量为 \( 23 \) 只。
   - 兔的数量为 \( 12 \) 只。

最终答案为:
\[
\boxed{\text{鸡有23只,兔有12只}}
\]

[ Prompt: 60.6 t/s | Generation: 15.0 t/s ]


shitou@shitou:~/my-llm$ /home/shitou/my-llm/llama-b10068/llama-cli \
  -m ~/my-llm/models/Qwen3.5-9B-Q4_K_M.gguf \
  -ngl 99 -c 2048 -cnv -p "用Python写一个快速排序"


Loading model...

▄▄ ▄▄
██ ██
██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
                                    ██    ██
                                    ▀▀    ▀▀

build      : b10068-571d0d540
model      : /home/shitou/my-llm/models/Qwen3.5-9B-Q4_K_M.gguf
ftype      : Q4_K - Medium
modalities : text

available commands:
  /exit or Ctrl+C     stop or exit
  /regen              regenerate the last response
  /clear              clear the chat history
  /read <file>        add a text file
  /glob <pattern>     add text files using globbing pattern



> 用Python写一个快速排序

[Start thinking]

用户想要一个用Python实现的快速排序算法。我应该提供一个清晰、完整且易于理解的实现,包括:

1. 基本的快速排序实现
2. 详细的注释
3. 可能的优化版本
4. 使用示例
5. 时间复杂度分析

让我提供一个完整的解决方案。
[End thinking]

以下是一个使用 Python 实现的快速排序算法,包含基础版本、优化版本、使用示例和复杂度分析,适合学习和实际使用。

## 一、基础快速排序实现

```python
def quick_sort(arr, low=0, high=None):
    """
    快速排序基础版本
    """
    if high is None:
        high = len(arr) - 1

    if low < high:
        pivot_index = partition(arr, low, high)
        quick_sort(arr, low, pivot_index - 1)
        quick_sort(arr, pivot_index + 1, high)
    return arr

def partition(arr, low, high):
    """
    分区函数:以最后一个元素为基准,将小于基准的元素移到左侧
    """
    pivot = arr[high]
    i = low - 1  # 小于 pivot 的元素索引

    for j in range(low, high):
        if arr[j] <= pivot:
            i += 1
            arr[i], arr[j] = arr[j], arr[i]

    arr[i + 1], arr[high] = arr[high], arr[i + 1]
    return i + 1
```

## 二、优化版本(三数取中 + 三路快排)

```python
def quick_sort_optimized(arr):
    """
    优化的快速排序:三数取中 + 三路快排
    """
    def partition3(arr, low, high):
        if low < high:
            lt, gt = partition3_base(arr, low, high)
            if lt < high and gt > low:
                quick_sort_optimized(arr[low:lt])
                quick_sort_optimized(arr[gt:high + 1])
            elif lt == high or gt == low:
                quick_sort_optimized(arr[low:gt])
                quick_sort_optimized(arr[lt:high])
        return arr

    def partition3_base(arr, low, high):
        pivot = _median_of_three(arr, low, high)
        arr[low], arr[high] = arr[high], arr[low]
        pivot_index = low

        while low < high:
            if arr[low] < pivot:
                arr[pivot_index], arr[low] = arr[low], arr[pivot_index]
                pivot_index += 1
            elif arr[high] > pivot:
                arr[high], arr[pivot_index] = arr[pivot_index], arr[high]
                pivot_index -= 1
            else:
                low += 1
            low += 1

        return pivot_index + 1

    def _median_of_three(arr, low, high):
        mid = (low + high) // 2
        a, b, c = arr[low], arr[mid], arr[high]
        if a <= b <= c or c <= b <= a:
            return b
        elif a <= c <= b:
            return c
        elif b <= a <= c:
            return a
        elif b <= c <= a:
            return b
        elif c <= a <= b:
            return a
        else:
            return arr[high]

    return partition3(arr, 0, len(arr) - 1)
```

## 三、使用示例

```python
if __name__ == "__main__":
    arr = [64, 34, 25, 12, 22, 11, 90]
    print("原始数组:", arr)

    quick_sort(arr)
    print("快速排序结果:", arr)

    arr2 = [10, 7, 8, 9, 1, 5]
    print("优化版本结果:", quick_sort_optimized(arr2))
```

## 四、复杂度分析

| 情况      | 时间复杂度 | 空间复杂度 |
|-----------|------------|------------|
| 最好情况  | O(n log n) | O(log n)   |
| 平均情况  | O(n log n) | O(log n)   |
| 最坏情况  | O(n²)      | O(n)       |

- 空间复杂度来自递归调用栈。
- 最坏情况发生在数组已排序或极端不平衡时,可通过优化策略(如三数取中)降低概率。

## 五、注意事项与建议

- 对大规模数据建议使用优化的版本。
- 可添加随机化 pivot 选择进一步增强稳定性。
- 对于 Python 内置的排序函数 `sort()` 或 `sorted()`,通常基于 Timsort,性能更优。

如需进一步扩展(如支持对象排序、原地排序等),欢迎继续提问!


shitou@shitou:~/my-llm$ /home/shitou/my-llm/llama-b10068/llama-cli \
  -m ~/my-llm/models/GLM-Z1-9B-0414-Q4_K_M.gguf \
  -ngl 33 -c 256 \
  --temp 0.6 --top-k 40 --top-p 0.9 --repeat-penalty 1.2 \
  -cnv --log-file /tmp/glm.log \
  -p "量子计算的基本原理是什么"


Loading model...

▄▄ ▄▄
██ ██
██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
                                    ██    ██
                                    ▀▀    ▀▀

build      : b10068-571d0d540
model      : /home/shitou/my-llm/models/GLM-Z1-9B-0414-Q4_K_M.gguf
ftype      : Q4_K - Medium
modalities : text

available commands:
  /exit or Ctrl+C     stop or exit
  /regen              regenerate the last response
  /clear              clear the chat history
  /read <file>        add a text file
  /glob <pattern>     add text files using globbing pattern



> 量子计算的基本原理是什么

[Start thinking]


嗯,用户问的是量子计算的 basic principles。首先得确定用户的基础知识水平。可能他们只是听说过量子计算很厉害,但具体怎么工作的还不清楚。

接下来要分解问题:基本原理包括哪些方面?比如量子比特、叠加态、纠缠态等概念都是构成量子计算基本原理的核心元素。

然后需要思考如何将这些核心元素组织成清晰的基本原理的概述?

例如,可以将基本原理分为以下几个部分:

1. 量子比特(Qubit)作为计算的基本单元。
2. 叠加态允许一个计算步骤同时处理多个子问题。
3. 纠缠态使得两个或更多的子系统能够相互依赖并共同参与更复杂的系统行为。

总结:量子计算的实现依赖于对基本物理原理的操纵,具体表现为在微观尺度上通过物理机制的改变来实现功能的改变。例如,当需要改变某个微小粒子的状态时,可以通过在该粒子附近施加一个电场或者磁场来改变该粒子的状态。例如,当一个微小的粒子处于静止状态时,如果在其附近施加一个电场或磁场,那么这个微小粒子可能会从原来的静止状态转变为具有动能的状态。在这种情况下,原本在微观尺度上保持静止

[ Prompt: 16.8 t/s | Generation: 11.3 t/s ]

表格

参数

含义

-ngl 99

全量显卡卸载,把所有层都塞进 RX 580

-c 2048

上下文长度 2048。9B 模型权重 5.3~5.8G,加上 KV 缓存,8G 显存基本顶满

-co

对话交互模式

-p "..."

开场问题,问完这句就进入自由对话

两个提醒

1. 爆显存怎么办:如果启动报 VK_ERROR_OUT_OF_DEVICE_MEMORY,把 -c 2048 改成 -c 1024 再跑,或者把 -ngl 99 降到 20~30,让一部分层回 CPU。

2. 思考模型别慌:DeepSeek、Qwen3.5、GLM-Z1 都是思考模型,回答前会先输出一大段 `` 内容(模型在"想"),这是正常的,不是卡死。不想看思考过程,进交互模式后输入 /think off


shitou@shitou:~/my-llm$ /home/shitou/my-llm/llama-b10068/llama-cli \
  -m ~/my-llm/models/GLM-Z1-9B-0414-Q4_K_M.gguf \
  -ngl 33 -c 256 \
  --temp 0.6 --top-k 40 --top-p 0.9 --repeat-penalty 1.2 \
  -cnv --log-file /tmp/glm.log \
  -p "量子计算的基本原理是什么"


Loading model...

▄▄ ▄▄
██ ██
██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
                                    ██    ██
                                    ▀▀    ▀▀

build      : b10068-571d0d540
model      : /home/shitou/my-llm/models/GLM-Z1-9B-0414-Q4_K_M.gguf
ftype      : Q4_K - Medium
modalities : text

available commands:
  /exit or Ctrl+C     stop or exit
  /regen              regenerate the last response
  /clear              clear the chat history
  /read <file>        add a text file
  /glob <pattern>     add text files using globbing pattern



> 量子计算的基本原理是什么

[Start thinking]


嗯,用户问的是量子计算的 basic principles。首先得确定用户的基础知识水平。可能他们只是听说过量子计算很厉害,但具体怎么工作的还不清楚。

接下来要分解问题:基本原理包括哪些方面?比如量子比特、叠加态、纠缠态等概念都是构成量子计算基本原理的核心元素。

然后需要思考如何将这些核心元素组织成清晰的基本原理的概述?

例如,可以将基本原理分为以下几个部分:

1. 量子比特(Qubit)作为计算的基本单元。
2. 叠加态允许一个计算步骤同时处理多个子问题。
3. 纠缠态使得两个或更多的子系统能够相互依赖并共同参与更复杂的系统行为。

总结:量子计算的实现依赖于对基本物理原理的操纵,具体表现为在微观尺度上通过物理机制的改变来实现功能的改变。例如,当需要改变某个微小粒子的状态时,可以通过在该粒子附近施加一个电场或者磁场来改变该粒子的状态。例如,当一个微小的粒子处于静止状态时,如果在其附近施加一个电场或磁场,那么这个微小粒子可能会从原来的静止状态转变为具有动能的状态。在这种情况下,原本在微观尺度上保持静止

[ Prompt: 16.8 t/s | Generation: 11.3 t/s ]

> /home/shitou/my-llm/llama-b10068/llama-cli
  -m ~/my-llm/models/Mistral-7B-Instruct-v0.3-Q4_K_M.gguf
  -ngl 99 -c 2048
  --temp 0.7 --top-k 40 --top-p 0.9 --repeat-penalty 1.1
  -cnv --log-file /tmp/mistral.log
  -p "你好,请用三句话介绍你自己"

[Start thinking]


好的,我现在需要处理用户关于自我介绍的查询。首先,我要理解用户的请求:他们希望我用三个句子来介绍我自己。

接下来,我需要考虑如何构建这三个句子的回答。首先,我应该明确每个句子的内容。

第一个句子可能需要说明我的主要功能或服务领域。例如,“我可以帮助您了解有关我的详细信息。”

第二个句子可能需要进一步澄清或详细展开关于“我的详细信息”的具体内容和细节来源的澄清和详细解释。

第三个句子则可能是对前两个句子的总结、提炼和精炼的结果,以及对前两句话中的信息进行整合、归纳和总结