From db1ed8ccbce3b48d3d1d0c149d98f9b4a80317ba Mon Sep 17 00:00:00 2001 From: Yousef Abu Shanab <93343012+youzarsiph@users.noreply.github.com> Date: Sun, 18 Aug 2024 13:57:06 +0300 Subject: [PATCH] Fix formatting error in `src/pipelines/masked_language.rs` (#456) * Fix formatting error in src/piplines/masked_language.rs * Update Zero-shot classification docs to fix formatting errors --------- Co-authored-by: guillaume-be --- src/lib.rs | 18 +++++++++--------- src/pipelines/masked_language.rs | 14 +++++++------- src/pipelines/mod.rs | 18 +++++++++--------- src/pipelines/zero_shot_classification.rs | 18 +++++++++--------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3363374e..20164892 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,15 +360,15 @@ //! # use rust_bert::pipelines::zero_shot_classification::ZeroShotClassificationModel; //! # fn main() -> anyhow::Result<()> { //! let sequence_classification_model = ZeroShotClassificationModel::new(Default::default())?; -//! let input_sentence = "Who are you voting for in 2020?"; -//! let input_sequence_2 = "The prime minister has announced a stimulus package which was widely criticized by the opposition."; -//! let candidate_labels = &["politics", "public health", "economics", "sports"]; -//! let output = sequence_classification_model.predict_multilabel( -//! &[input_sentence, input_sequence_2], -//! candidate_labels, -//! None, -//! 128, -//! ); +//! let input_sentence = "Who are you voting for in 2020?"; +//! let input_sequence_2 = "The prime minister has announced a stimulus package which was widely criticized by the opposition."; +//! let candidate_labels = &["politics", "public health", "economics", "sports"]; +//! let output = sequence_classification_model.predict_multilabel( +//! &[input_sentence, input_sequence_2], +//! candidate_labels, +//! None, +//! 128, +//! ); //! # Ok(()) //! # } //! ``` diff --git a/src/pipelines/masked_language.rs b/src/pipelines/masked_language.rs index 2a3c4319..f83699c7 100644 --- a/src/pipelines/masked_language.rs +++ b/src/pipelines/masked_language.rs @@ -15,15 +15,15 @@ //! a masked word can be specified in the `MaskedLanguageConfig` (`mask_token`). and allows //! multiple masked tokens per input sequence. //! -//! ```no_run -//!use rust_bert::bert::{BertConfigResources, BertModelResources, BertVocabResources}; -//!use rust_bert::pipelines::common::ModelType; -//!use rust_bert::pipelines::masked_language::{MaskedLanguageConfig, MaskedLanguageModel}; -//!use rust_bert::resources::RemoteResource; -//! fn main() -> anyhow::Result<()> { +//! ```no_run +//! use rust_bert::bert::{BertConfigResources, BertModelResources, BertVocabResources}; +//! use rust_bert::pipelines::common::ModelType; +//! use rust_bert::pipelines::masked_language::{MaskedLanguageConfig, MaskedLanguageModel}; +//! use rust_bert::resources::RemoteResource; //! +//! fn main() -> anyhow::Result<()> { //! use rust_bert::pipelines::common::ModelResource; -//! let config = MaskedLanguageConfig::new( +//! let config = MaskedLanguageConfig::new( //! ModelType::Bert, //! ModelResource::Torch(Box::new(RemoteResource::from_pretrained(BertModelResources::BERT))), //! RemoteResource::from_pretrained(BertConfigResources::BERT), diff --git a/src/pipelines/mod.rs b/src/pipelines/mod.rs index e886d69d..8bda080d 100644 --- a/src/pipelines/mod.rs +++ b/src/pipelines/mod.rs @@ -205,15 +205,15 @@ //! # use rust_bert::pipelines::zero_shot_classification::ZeroShotClassificationModel; //! # fn main() -> anyhow::Result<()> { //! let sequence_classification_model = ZeroShotClassificationModel::new(Default::default())?; -//! let input_sentence = "Who are you voting for in 2020?"; -//! let input_sequence_2 = "The prime minister has announced a stimulus package which was widely criticized by the opposition."; -//! let candidate_labels = &["politics", "public health", "economics", "sports"]; -//! let output = sequence_classification_model.predict_multilabel( -//! &[input_sentence, input_sequence_2], -//! candidate_labels, -//! None, -//! 128, -//! ); +//! let input_sentence = "Who are you voting for in 2020?"; +//! let input_sequence_2 = "The prime minister has announced a stimulus package which was widely criticized by the opposition."; +//! let candidate_labels = &["politics", "public health", "economics", "sports"]; +//! let output = sequence_classification_model.predict_multilabel( +//! &[input_sentence, input_sequence_2], +//! candidate_labels, +//! None, +//! 128, +//! ); //! # Ok(()) //! # } //! ``` diff --git a/src/pipelines/zero_shot_classification.rs b/src/pipelines/zero_shot_classification.rs index 642bc35f..8cdb16bc 100644 --- a/src/pipelines/zero_shot_classification.rs +++ b/src/pipelines/zero_shot_classification.rs @@ -25,15 +25,15 @@ //! # use rust_bert::pipelines::zero_shot_classification::ZeroShotClassificationModel; //! # fn main() -> anyhow::Result<()> { //! let sequence_classification_model = ZeroShotClassificationModel::new(Default::default())?; -//! let input_sentence = "Who are you voting for in 2020?"; -//! let input_sequence_2 = "The prime minister has announced a stimulus package which was widely criticized by the opposition."; -//! let candidate_labels = &["politics", "public health", "economics", "sports"]; -//! let output = sequence_classification_model.predict_multilabel( -//! &[input_sentence, input_sequence_2], -//! candidate_labels, -//! None, -//! 128, -//! ); +//! let input_sentence = "Who are you voting for in 2020?"; +//! let input_sequence_2 = "The prime minister has announced a stimulus package which was widely criticized by the opposition."; +//! let candidate_labels = &["politics", "public health", "economics", "sports"]; +//! let output = sequence_classification_model.predict_multilabel( +//! &[input_sentence, input_sequence_2], +//! candidate_labels, +//! None, +//! 128, +//! ); //! # Ok(()) //! # } //! ```