Skip to content

Commit

Permalink
Update docs (#2553)
Browse files Browse the repository at this point in the history
* add module docs for candle-core

* doc each of the candle-nn modules and add the links to the doc page
  • Loading branch information
zachcp authored Nov 11, 2024
1 parent e2b6b36 commit 3769206
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 0 deletions.
14 changes: 14 additions & 0 deletions candle-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
//! Python can really add overhead in more complex workflows and the [GIL](https://www.backblaze.com/blog/the-python-gil-past-present-and-future/) is a notorious source of headaches.
//!
//! Rust is cool, and a lot of the HF ecosystem already has Rust crates [safetensors](https://github.com/huggingface/safetensors) and [tokenizers](https://github.com/huggingface/tokenizers)
//!
//! ## Other Crates
//!
//! Candle consists of a number of crates. This crate holds core the common data structures but you may wish
//! to look at the docs for the other crates which can be found here:
//!
//! - [candle-core](https://docs.rs/candle-core/). Core Datastructures and DataTypes.
//! - [candle-nn](https://docs.rs/candle-nn/). Building blocks for Neural Nets.
//! - [candle-datasets](https://docs.rs/candle-datasets/). Rust access to commonly used Datasets like MNIST.
//! - [candle-examples](https://docs.rs/candle-examples/). Examples of Candle in Use.
//! - [candle-onnx](https://docs.rs/candle-onnx/). Loading and using ONNX models.
//! - [candle-pyo3](https://docs.rs/candle-pyo3/). Access to Candle from Python.
//! - [candle-transformers](https://docs.rs/candle-transformers/). Candle implemntation of many published transformer models.
//!
#[cfg(feature = "accelerate")]
mod accelerate;
Expand Down
2 changes: 2 additions & 0 deletions candle-nn/src/activation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Activation Functions
//!
use candle::{Result, Tensor};
use serde::Deserialize;

Expand Down
2 changes: 2 additions & 0 deletions candle-nn/src/kv_cache.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Cache Implementations
//!
use candle::{Device, Result, Tensor};

#[derive(Debug, Clone)]
Expand Down
17 changes: 17 additions & 0 deletions candle-nn/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//! candle-nn
//!
//! ## Other Crates
//!
//! Candle consists of a number of crates. This crate holds structs and functions
//! that allow you to build and train neural nets. You may wish
//! to look at the docs for the other crates which can be found here:
//!
//! - [candle-core](https://docs.rs/candle-core/). Core Datastructures and DataTypes.
//! - [candle-nn](https://docs.rs/candle-nn/). Building blocks for Neural Nets.
//! - [candle-datasets](https://docs.rs/candle-datasets/). Rust access to commonly used Datasets like MNIST.
//! - [candle-examples](https://docs.rs/candle-examples/). Examples of Candle in Use.
//! - [candle-onnx](https://docs.rs/candle-onnx/). Loading and using ONNX models.
//! - [candle-pyo3](https://docs.rs/candle-pyo3/). Access to Candle from Python.
//! - [candle-transformers](https://docs.rs/candle-transformers/). Candle implemntation of many published transformer models.
//!
pub mod activation;
pub mod batch_norm;
pub mod conv;
Expand Down
2 changes: 2 additions & 0 deletions candle-nn/src/loss.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Loss Calculations
//!
use candle::{Result, Tensor};

/// The negative log likelihood loss.
Expand Down
3 changes: 3 additions & 0 deletions candle-nn/src/ops.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! Tensor ops.
//!
use candle::{CpuStorage, DType, Layout, Module, Result, Shape, Tensor, D};
use rayon::prelude::*;

Expand Down
2 changes: 2 additions & 0 deletions candle-nn/src/rotary_emb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Rotary Embeddings
//!
use candle::{CpuStorage, Layout, Result, Shape, Tensor, D};
use rayon::prelude::*;

Expand Down
2 changes: 2 additions & 0 deletions candle-nn/src/sequential.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Sequential Layer
//!
//! A sequential layer used to chain multiple layers and closures.
use candle::{Module, Result, Tensor};

Expand Down
2 changes: 2 additions & 0 deletions candle-nn/src/var_builder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! A `VarBuilder` for variable retrieval from models
//!
//! A `VarBuilder` is used to retrieve variables used by a model. These variables can either come
//! from a pre-trained checkpoint, e.g. using `VarBuilder::from_mmaped_safetensors`, or initialized
//! for training, e.g. using `VarBuilder::from_varmap`.
Expand Down
2 changes: 2 additions & 0 deletions candle-nn/src/var_map.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! A `VarMap` is a store that holds named variables.
//!
use candle::{DType, Device, Result, Shape, Tensor, Var};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
Expand Down

0 comments on commit 3769206

Please sign in to comment.