赞
踩
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
https://github.com/huggingface/candle
Hugging Face 使用rust开发的高性能推理框架。
语法简单, 风格与 PyTorch 相似。
CPU 和 Cuda Backend:m1、f16、bf16。
支持 Serverless(CPU)、小型和快速部署
支持 WASM,可在浏览器中运行模型。
安装软件文档:
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)
设置学术加速
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
python3 download.py Qwen/Qwen1.5-4B
export HF_HOME=/root/autodl-tmp/hf_cache
cargo run --example qwen --features cuda -- --model 4b --prompt 北京景点推荐
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 北京景点推荐
使用 candle还是非常方便的,使用另外一种方案运行大模型。
可以对模型进行加速。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。