Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.43 KB

File metadata and controls

41 lines (31 loc) · 1.43 KB

Sheaf-logo

Sheaf is a functional language for machine learning. Inspired by Clojure, it compiles to StableHLO and runs on GPU via IREE.

Sheaf ships as a single native binary with zero runtime dependencies, for Linux (x86_64, aarch64) and macOS.

Quick start

See the Quick Start guide for installation and first steps.

Goals

  • Clojure paradigm: homoiconicity, immutability, minimalist syntax
  • Native hardware performance: compiles to StableHLO, executes via IREE on CUDA, Metal GPU and CPU
  • JIT compilation: pure functions are automatically compiled and dispatched to the best available device
  • Reverse-mode autodiff: automatic differentiation on the expression graph, before compilation

Sample code

(defn transformer-block [x layer-p config]
  (as-> x h
    (-> h
        (layer-norm (get layer-p :ln1) 2)
        (multi-head-attention layer-p config)
        (first)
        (+ h))
    (-> h
        (layer-norm (get layer-p :ln2) 2)
        (mlp (get layer-p :mlp))
        (+ h)))) ;; residual

Links