package kaun

  1. Overview
  2. Docs
Neural networks for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

raven-1.0.0.alpha3.tbz
sha256=96d35ce03dfbebd2313657273e24c2e2d20f9e6c7825b8518b69bd1d6ed5870f
sha512=90c5053731d4108f37c19430e45456063e872b04b8a1bbad064c356e1b18e69222de8bfcf4ec14757e71f18164ec6e4630ba770dbcb1291665de5418827d1465

Description

Composable layers, parameter trees, optimizers, training loops, data pipelines, and HuggingFace Hub integration. Built on Rune.

README

raven

modern scientific computing for OCaml

docs · install · issues


Raven is an ecosystem of OCaml libraries for numerical computing, machine learning, and data science. Everything you know from Python — NumPy, JAX, PyTorch, Matplotlib, Jupyter — rebuilt with type safety.

(* nx — n-dimensional arrays *)
let x = Nx.linspace float32 0. 10. 100
let y = Nx.sin x

(* rune — automatic differentiation *)
let grad_f = Rune.grad (fun x -> Rune.sum (Rune.mul x x)) x

(* brot — tokenization *)
let tokenizer = Brot.from_file "tokenizer.json" |> Result.get_ok
let ids = Brot.encode_ids tokenizer "The meaning of life is"

(* kaun — neural networks *)
let model = Kaun.Layer.sequential [
  Kaun.Layer.linear ~in_features:768 ~out_features:128 ();
  Kaun.Layer.relu ();
  Kaun.Layer.linear ~in_features:128 ~out_features:10 ();
]

(* talon — dataframes *)
let df = Talon.create [
  "name", Talon.Col.string_list [ "Alice"; "Bob"; "Charlie" ];
  "score", Talon.Col.float64_list [ 85.5; 92.0; 78.5 ];
]

(* hugin — plotting *)
let () = Hugin.(figure () |> subplot |> Plotting.plot ~x ~y |> ignore; show ())

Packages

Package

Like

What it does

nx

NumPy

N-dimensional arrays with linear algebra operations

rune

JAX

Automatic differentiation and functional transformations

kaun

Flax

Neural networks and training

brot

HF Tokenizers

Fast, HuggingFace-compatible tokenization

talon

Polars

Fast and elegant dataframes with type-safe operations

hugin

Matplotlib

Publication-quality plotting

quill

Jupyter + IPython

Interactive REPL and markdown notebooks

fehu

Gymnasium

Reinforcement learning environments

sowilo

OpenCV

Differentiable computer vision

Getting started

opam install raven

This installs the full ecosystem. You can also install only what you need — e.g. opam install kaun for neural networks, or opam install nx for just arrays.

Add to your dune file:

(executable
 (name main)
 (libraries raven))

See the installation guide for system dependencies and editor setup.

Support

Building a scientific computing ecosystem takes sustained effort. Sponsorships help us ship JIT compilation, distributed training, better developer tooling, and production deployment through MirageOS.

Support Raven →

Thanks to our sponsors Ahrefs and Tarides.

License

ISC

Dependencies (6)

  1. bytesrw
  2. jsont
  3. nx = version
  4. rune = version
  5. dune >= "3.21"
  6. ocaml >= "5.2.0"

Dev Dependencies (3)

  1. odoc with-doc
  2. mdx with-test
  3. windtrap with-test

Used by (1)

  1. raven >= "1.0.0~alpha3"

Conflicts

None