diff --git a/candle-transformers/src/models/bert.rs b/candle-transformers/src/models/bert.rs index a7283ea52e..da8734160a 100644 --- a/candle-transformers/src/models/bert.rs +++ b/candle-transformers/src/models/bert.rs @@ -7,56 +7,6 @@ //! - Upstream [Github repo](https://github.com/google-research/bert). //! - See bert in [candle-examples](https://github.com/huggingface/candle/tree/main/candle-examples/) for runnable code //! -//! ```rust,text -//! // Different models can be loaded using the model ID -//! # use candle_core::Tensor; -//! # use candle_nn::{VarBuilder, Module}; -//! # fn main() -> candle_core::Result<()> { -//! # let vb = todo!(); -//! # let config = todo!(); -//! let model = BertModel::load(vb, &config )?; -//! # Ok(()) -//! # } -//! -//! // for sentence embeddings -//! # use candle_core::Tensor; -//! # use candle_nn::{VarBuilder, Module}; -//! # fn main() -> candle_core::Result<()> { -//! # let model = todo!(); -//! let prompt = "Here is a test sentence"; -//! let embeddings = model.forward(prompt)?; -//! // Returns tensor of shape [1, 7, 384] -//! println!("{embeddings}"); -//! # Ok(()) -//! # } -//! -//! // Gelu approximation -//! // You can get a speedup by configuring the model -//! // to use an approximation of the gelu activation: -//! # use candle_core::Tensor; -//! # use candle_nn::{VarBuilder, Module}; -//! # fn main() -> candle_core::Result<()> { -//! # let mut config = todo!(); -//! config.hidden_act = HiddenAct::GeluApproximate; -//! # Ok(()) -//! # } -//! -//! // Similarities -//! // Bert can compute sentence embeddings which can then be used to calculate -//! // semantic similarities between sentences through cosine similarity scoring. -//! // The sentence embeddings are computed using average pooling across all tokens. -//! # use candle_core::Tensor; -//! # use candle_nn::{VarBuilder, Module}; -//! # fn main() -> candle_core::Result<()> { -//! # let model = todo!(); -//! let sentence1 = "The new movie is awesome"; -//! let sentence2 = "The new movie is so great"; -//! let emb1 = model.forward(sentence1)?; -//! let emb2 = model.forward(sentence2)?; -//! # Ok(()) -//! # } -//! ``` -//! use super::with_tracing::{layer_norm, linear, LayerNorm, Linear}; use candle::{DType, Device, Result, Tensor}; use candle_nn::{embedding, Embedding, Module, VarBuilder}; diff --git a/candle-transformers/src/models/dinov2.rs b/candle-transformers/src/models/dinov2.rs index d960adb51b..4d46941f8b 100644 --- a/candle-transformers/src/models/dinov2.rs +++ b/candle-transformers/src/models/dinov2.rs @@ -4,17 +4,6 @@ //! DINOv2 is a self-supervised learning model that can learn visual features //! without using any labeled data. See: ["DINOv2: Learning Robust Visual Features without Supervision"](https://github.com/facebookresearch/dinov2) //! -//! # Example usage -//! -//! ```rust,text -//! # use candle::Result; -//! # fn main() -> Result<()> { -//! use candle_transformers::dinov2::vit_small; -//! let model = vit_small(vb)?; -//! # Ok(()) -//! # } -//! ``` -//! //! ## Running an example with color map and CUDA //! //! ```bash