12 unstable releases (3 breaking)

0.4.1 Feb 28, 2024
0.3.3 Jan 31, 2024
0.3.2 Dec 20, 2023
0.3.1 Nov 12, 2023

#7 in Machine learning

Download history 3880/week @ 2024-01-06 3177/week @ 2024-01-13 3462/week @ 2024-01-20 3910/week @ 2024-01-27 2931/week @ 2024-02-03 3001/week @ 2024-02-10 3521/week @ 2024-02-17 3714/week @ 2024-02-24 3313/week @ 2024-03-02 3650/week @ 2024-03-09 3602/week @ 2024-03-16 8026/week @ 2024-03-23 6870/week @ 2024-03-30 4528/week @ 2024-04-06 6247/week @ 2024-04-13 4673/week @ 2024-04-20

23,100 downloads per month
Used in 62 crates (47 directly)

MIT/Apache

1MB
25K SLoC

Contains (Zip file, 2KB) tests/fortran_tensor_3d.pth, (Zip file, 2KB) tests/test.pt, (Zip file, 2KB) tests/test_with_key.pt

candle

Minimalist ML framework for Rust


lib.rs:

ML framework for Rust

use candle_core::{Tensor, DType, Device};

let a = Tensor::arange(0f32, 6f32, &Device::Cpu)?.reshape((2, 3))?;
let b = Tensor::arange(0f32, 12f32, &Device::Cpu)?.reshape((3, 4))?;

let c = a.matmul(&b)?;

Features

  • Simple syntax (looks and like PyTorch)
  • CPU and Cuda backends (and M1 support)
  • Enable serverless (CPU) small and fast deployments
  • Model training
  • Distributed computing (NCCL).
  • Models out of the box (Llama, Whisper, Falcon, ...)

FAQ

  • Why Candle?

Candle stems from the need to reduce binary size in order to enable serverless possible by making the whole engine smaller than PyTorch very large library volume

And simply removing Python from production workloads. Python can really add overhead in more complex workflows and the GIL is a notorious source of headaches.

Rust is cool, and a lot of the HF ecosystem already has Rust crates safetensors and tokenizers

Dependencies

~6.5–10MB
~175K SLoC