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

Candle ์ด๋ž€? 

Candle์€ ์„ฑ๋Šฅ(GPU ์ง€์›)๊ณผ ์‚ฌ์šฉ ํŽธ์˜์„ฑ์— ์ค‘์ ์„ ๋‘” rust ์šฉ Minimalist ML ํ”„๋ ˆ์ž„์›Œํฌ์ž…๋‹ˆ๋‹ค. whisper, LLaMA2, T5, yolo, Segment Anything์„ ํ•œ๋ฒˆ์— ๋ถˆ๋Ÿฌ์™€ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ณ  huggingface์˜ ๋‹ค์–‘ํ•œ ๋ชจ๋ธ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. 

 

Kakaobot์— ์‚ฌ์šฉํ•  Stable Diffusion ์‚ฌ์šฉ ์˜ˆ์‹œ

์„ค์น˜ ๋ฐฉ๋ฒ• 

1) Candle์€ Rust๋ฅผ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ rust package ๊ด€๋ฆฌ์ž์ธ Cargo๋ฅผ ์„ค์น˜ํ•ด์ค€๋‹ค.

curl https://sh.rustup.rs -sSf | sh

# env enroll
source "$HOME/.cargo/env"

rustc --version # rustc 1.75.0 (82e1608df 2023-12-21)

# make๋„ ์‚ฌ์šฉ
make --version
# GNU Make 4.2.1
# Built for x86_64-pc-linux-gnu

https://doc.rust-lang.org/cargo/getting-started/installation.html 

 

Installation - The Cargo Book

The easiest way to get Cargo is to install the current stable release of Rust by using rustup. Installing Rust using rustup will also install cargo. On Linux and macOS systems, this is done as follows: curl https://sh.rustup.rs -sSf | sh It will download a

doc.rust-lang.org

2-1) git clone 

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

cd candle

 

2-2) candle  install 

# cargo env set 
cargo new myapp
cd myapp

# cuda version candle-core ์„ค์น˜ [CUDA ๋ฒ„์ „]
cargo add --git https://github.com/huggingface/candle.git candle-core --features "cuda"

 

error: unrecognized feature for crate candle-core: cuda ์—๋Ÿฌ์‹œ 

cargo add --features candle-core/cuda --git https://github.com/huggingface/candle.git candle-core

# https://github.com/huggingface/candle/issues/1497

 

makefile ๋ณต์‚ฌ

 

https://huggingface.github.io/candle/guide/installation.html

 

Installation - Candle Documentation

With Cuda support: First, make sure that Cuda is correctly installed. nvcc --version should print information about your Cuda compiler driver. nvidia-smi --query-gpu=compute_cap --format=csv should print your GPUs compute capability, e.g. something like: c

huggingface.github.io

 

2-3) Package install

cargo run --example whisper --release

 

 

 

https://github.com/huggingface/candle/tree/main/candle-examples/examples/whisper

 

Whisper, vit, t5 ๋“ฑ ๋“ฑ ์œ ๋ช…ํ•œ model์€ candleํ•˜๋‚˜๋กœ ๋‹ค ์†์‰ฝ๊ฒŒ ์„ค์น˜๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค. ๋˜ํ•œ quantized ๋ชจ๋ธ๋„ ์ง€์›

๋ฐ˜์‘ํ˜•
๋‹คํ–ˆ๋‹ค