Windows 11环境轻松安装Rust编译工具及llama-hud,一步到位教程大公开!

AI 文章摘要

本文介绍了在Windows环境下使用llama-cpp和Rust语言安装和配置llama-server及llama-hud的详细步骤。首先,通过Rust官方网站下载并安装Rust编译工具,并使用国内加速镜像提高下载速度。接着,配置cargo的crates.io源以加速包的安装。然后,使用cargo命令安装llama-hud。最后,通过修改llama-server的启动命令来开启metrics接口,并使用llama-hud连接到该接口进行实时监控。...

最终预览图

本教程以llama-cpp、Windows11为例

安装 Rust 编译工具(引用自Rust 环境搭建 | 菜鸟教程):

Rust 编译工具可以去官方网站下载: https://www.rust-lang.org/zh-CN/tools/install

macOS、Linux 或其它类 Unix 系统要下载 Rustup 并安装 Rust,请在终端中运行以下命令:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Windows 要下载 rustup-init.exe 可执行文件。

下载好的 Rustup 在 Windows 上是一个可执行程序 rustup-init.exe。

由于国内网络下载Rust很慢,在PowerShell中输入以下用于使用加速镜像:

$env:RUSTUP_DIST_SERVER="https://rsproxy.cn"
$env:RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"

备选镜像:

  • 清华:$env:RUSTUP_DIST_SERVER="https://mirrors.tuna.tsinghua.edu.cn/rustup"$env:RUSTUP_UPDATE_ROOT="https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup"
  • 中科大:$env:RUSTUP_DIST_SERVER="https://mirrors.ustc.edu.cn/rust-static"$env:RUSTUP_UPDATE_ROOT="https://mirrors.ustc.edu.cn/rust-static/rustup"

然后在这个已经设置好环境变量的 PowerShell 窗口,执行 rustup-init 文件:

."rustup-init.exe文件地址"

上图显示的是一个命令行安装向导。

如果你已经安装 MSVC (推荐),那么安装过程会非常的简单,输入 1 并回车,直接进入第二步

如果你安装的是 MinGW,那么你需要输入 2 (自定义安装),然后系统会询问你 Default host triple? ,请将上图中 default host triple 的 “msvc” 改为 “gnu” 再输入安装程序:

其它属性都默认。

设置完所有选项,会回到安装向导界面(第一张图),这是我们输入 1 并回车即可。

进行到这一步就完成了 Rust 的安装,可以通过以下命令测试:

rustc -V        # 注意的大写的 V

如果以上两个命令能够输出你安装的版本号,就是安装成功了。

安装llama-hud:

cargo 拉包加速:

安装完 rust 之后,还要配置 cargo 的 crates.io 源,新建 %USERPROFILE%\.cargo\config.toml 文件:

[source.crates-io]
replace-with = "rsproxy-sparse"

[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"

[net]
git-fetch-with-cli = true

关闭当前终端,重新开一个 PowerShell(刷新 cargo 配置)

也可以使用临时环境变量:

$env:CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
$env:CARGO_HOME="$env:USERPROFILE\.cargo"
[Environment]::SetEnvironmentVariable("CARGO_REGISTRY_DEFAULT", "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index", "User")

执行安装:

cargo install llama-hud

启动llama-hud:

启动llama-server的命令行中增加一行(作用是开启 /metrics Prometheus 指标接口):

--metrics

例如(仅参考):

.\llama-server.exe -m D:\models\qwen2.5-7b-instruct-q5_k_m.gguf --port 8080 -ngl 99 --metrics

验证 metrics 接口:浏览器访问 http://127.0.0.1:8080/metrics,能看到一大段 prometheus 格式文本,代表接口正常。

启动llama-server后,再启动llama-hud:

最简单启动命令(默认连接本地 127.0.0.1:8080):

llama-hud --url http://127.0.0.1:8080

如果你的 llama-server 绑定其他 IP / 端口,修改 url 参数即可。

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Source: https://github.com/MengXi2021/Argon-Emoji-DailyNotes
Source: https://github.com/Ghost-chu/argon-huhu-emotions
https://github.com/qs5667/argon_bilibili_emoji
https://github.com/qs5667/argon_bilibili_emoji
https://github.com/qs5667/argon_bilibili_emoji
https://github.com/qs5667/argon_bilibili_emoji
Source: github.com/zhheo/Sticker-Heo
颜文字
Emoji
小恐龙
花!
每日手帐
呼呼
B站基础表情
B站节日表情
B站游戏表情
B站活动表情
Heo
上一篇