开发语言 后端 【candle】(3):安装rust环境,使用GPU进行加速,成功运行qwen的0.5b,4b,7b模型,搭建rust环境,配置candle,使用hf-mirror下载模型 - com/huggingface/candle

📅 2026-11-30 👤 拼多多助力营销技巧 📂 拼多多助力网站 👁️ 101 次阅读

1,视频地址

https://www.bilibili.com/video/BV1AF4m1E73d/

【candle】(3):安装rust环境,使用GPU进行加速,成功运行qwen的0.5b,4b,7b模型,搭建rust环境,配置candle,下使用hf-mir

https://gitee.com/fly-llm/candle-run-llm 拼多多帮助力入口

3,关于candle项目

https://github.com/huggingface/candle

Hugging Face 使用rust开发的高性能推理框架。 语法简单, 风格与 PyTorch 相似。 CPU 和 Cuda Backend:m1、f16、bf16。 支持 Serverless(CPU)、小型和快速部署 支持 WASM,可在浏览器中运行模型。

3,rust环境搭建

安装软件文档: https://www.rust-lang.org/tools/install

设置目录:

export RUSTUP_HOME=/root/autodl-tmp/cargo

export CARGO_HOME=/root/autodl-tmp/cargo

# 安装rust 软件

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

安装成功:

info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

stable-x86_64-unknown-linux-gnu installed - rustc 1.76.0 (07dca489a 2024-02-04)

Rust is installed now. Great!

To get started you may need to restart your current shell.

This would reload your PATH environment variable to include

Cargo's bin directory (/root/autodl-tmp/cargo/bin).

To configure your current shell, run:

source "/root/autodl-tmp/cargo/env"

执行命令: source “/root/autodl-tmp/cargo/env”

# rustc -V

rustc 1.76.0 (07dca489a 2024-02-04)

4,下载 candle 项目

设置学术加速

cd /root/autodl-tmp/

# 设置hf 路径:

export HF_HOME=/root/autodl-tmp/hf_cache

# 下载项目

git clone https://github.com/huggingface/candle.git

cd /root/autodl-tmp/candle

5,运行qwen-4b大模型

python3 download.py Qwen/Qwen1.5-4B

export HF_HOME=/root/autodl-tmp/hf_cache

cargo run --example qwen --features cuda -- --model 4b --prompt 北京景点推荐

6,运行qwen-0.5b的聊天模型

python3 download.py Qwen/Qwen1.5-0.5B-Chat

export HF_HOME=/root/autodl-tmp/hf_cache

cargo run --example qwen --features cuda -- --model-id Qwen/Qwen1.5-0.5B-Chat --prompt 北京景点推荐

7,运行效果

8,总结下

使用 candle还是非常方便的,使用另外一种方案运行大模型。 可以对模型进行加速。

精彩内容,开发语言

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧