Ferrotensor
ContentsInstallation

Installation

Ferrotensor 0.7.3 is published to crates.io and PyPI.

Rust libraryLink to this section

You need Rust 1.88 or newer (rustup is enough). On macOS no other setup is needed; on Windows and Linux a Vulkan or DX12 driver gives you the GPU.

cargo add ferrotensor

Then, in your code:

use ferrotensor::prelude::*;

let device = Device::best(); // the GPU when there is one, else the CPU
let x = Tensor::from_data(&[1., 2., 3., 4.], &[2, 2], &device);

No GPU? Device::cpu() runs the same code.

Command-line toolLink to this section

The ferrotensor command fine-tunes small Llama-style models with LoRA and runs train, eval and generate:

cargo install ferrotensor-cli

Prebuilt binaries are attached to each GitHub release. The LoRA walkthrough goes through a full run.

On LinuxLink to this section

A fresh Ubuntu needs these packages before cargo install and before the first run:

sudo apt-get install -y build-essential pkg-config libvulkan1 mesa-vulkan-drivers

build-essential gives cargo a C linker; without it cargo install stops with error: linker `cc` not found. libvulkan1 is the Vulkan loader and mesa-vulkan-drivers holds Mesa's Vulkan drivers, including lavapipe, the software one for a machine with no GPU. NVIDIA cards use NVIDIA's own driver. Take Rust 1.88+ from rustup: the rustc in Ubuntu's apt is older. To see which Vulkan devices exist, install vulkan-tools and run vulkaninfo --summary; ferrotensor info --check then runs the kernel check.

Checked on a fresh Ubuntu 24.04 machine (AWS c7i.xlarge, software Vulkan) on 30 November 2026 with release 0.7.3: these packages and a rustup toolchain were enough for cargo install ferrotensor-cli --locked, info --check, finetune, eval, chat, merge and export-gguf, and Ollama 0.40.17 ran the exported file. Other GPUs on Linux were not part of that check.

PythonLink to this section

pip install ferrotensor

Wheels are built for macOS arm64 and Linux x86_64 as abi3 wheels for CPython 3.10 and newer. On other platforms pip builds from the source distribution, which needs a Rust toolchain. Continue with the Python quickstart.

From a checkoutLink to this section

git clone https://github.com/puranikyashaswin/ferrotensor.git
cd ferrotensor
cargo run --release -p ferrotensor --example quickstart

Output on an Apple M2 (the device line changes with your hardware):

device: Apple M2 (Metal)
x @ w = [7.5, 2.0, 18.0, 2.0] (shape [2, 2])
dL/dw = [5.0, 5.0, 7.0, 7.0, 9.0, 9.0]