pub fn new<'p, P>(
        p: P,
        config: &BartConfig,
        generation_mode: bool,
    ) -> MarianForConditionalGeneration
    where
        P: Borrow<nn::Path<'p>>,
    {
        let p = p.borrow();
        let base_model = BartModel::new(p / "model", config, generation_mode);
        let final_logits_bias = p.var(
            "final_logits_bias",
            &[1, config.vocab_size],
            Init::Const(0.),
        );
        MarianForConditionalGeneration {
            base_model,
            final_logits_bias,
        }
    }
/// Build a new `MarianForConditionalGeneration`
///
/// # Arguments
///
/// * `p` - Variable store path for the root of the BART model
/// * `config` - `BartConfig` object defining the model architecture
/// * `generation_mode` - flag indicating if the model should run in generation mode (a decoder start token must then be provided)
///
/// # Example
///
/// ```no_run
/// use rust_bert::bart::{BartConfig, BartForConditionalGeneration};
/// use rust_bert::Config;
/// use std::path::Path;
/// use tch::{nn, Device};
///
/// let config_path = Path::new("path/to/config.json");
/// let device = Device::Cpu;
/// let p = nn::VarStore::new(device);
/// let config = BartConfig::from_file(config_path);
/// let generation_mode = true;
/// let bart: BartForConditionalGeneration =
///     BartForConditionalGeneration::new(&p.root() / "bart", &config, generation_mode);
/// ```
Build a new `MarianForConditionalGeneration`
Build a new ` MarianForConditionalGeneration `
pub fn new<'p, P>(
        p: P,
        config: &BartConfig,
        generation_mode: bool,
    ) -> MarianForConditionalGeneration
    where
        P: Borrow<nn::Path<'p>>,
    {
        let p = p.borrow();
        let base_model = BartModel::new(p / "model", config, generation_mode);
        let final_logits_bias = p.var(
            "final_logits_bias",
            &[1, config.vocab_size],
            Init::Const(0.),
        );
        MarianForConditionalGeneration {
            base_model,
            final_logits_bias,
        }
    }
pub fn new < ' p , P > ( p : P , config : & BartConfig , generation_mode : bool , ) -> MarianForConditionalGeneration where P : Borrow < nn :: Path < ' p > > , { let p = p . borrow ( ) ; let base_model = BartModel :: new ( p / " " , config , generation_mode ) ; let final_logits_bias = p . var ( " " , & [ 1 , config . vocab_size ] , Init :: Const ( 0. ) , ) ; MarianForConditionalGeneration { base_model , final_logits_bias , } }
Build a new `MarianForConditionalGeneration`
Build a new ` MarianForConditionalGeneration `
p
P
config
&BartConfig
generation_mode
bool
p
P
config
&BartConfig
generation_mode
bool
example
```no_run
use rust_bert::bart::{BartConfig, BartForConditionalGeneration};
use rust_bert::Config;
use std::path::Path;
use tch::{nn, Device}.

let config_path = Path::new("path/to/config.json");
let device = Device::Cpu;
let p = nn::VarStore::new(device);
let config = BartConfig::from_file(config_path);
let generation_mode = true;
let bart: BartForConditionalGeneration
BartForConditionalGeneration::new(&p.root() / "bart", &config, generation_mode);
```
` ` ` no_run use rust_bert :: bart :: { BartConfig BartForConditionalGeneration } ; use rust_bert :: Config ; use std :: path :: Path ; use tch :: { nn Device } . let config_path = Path :: new ( " path / to / config . json " ) ; let device = Device :: Cpu ; let p = nn :: VarStore :: new ( device ) ; let config = BartConfig :: from_file ( config_path ) ; let generation_mode = true ; let bart : BartForConditionalGeneration BartForConditionalGeneration :: new ( &p . root () / " bart " &config generation_mode ) ; ` ` `