pub fn new<'p, P>(p: P, config: &BertConfig) -> RobertaForMaskedLM
    where
        P: Borrow<nn::Path<'p>>,
    {
        let p = p.borrow();

        let roberta = BertModel::<RobertaEmbeddings>::new(p / "roberta", config);
        let lm_head = RobertaLMHead::new(p / "lm_head", config);

        RobertaForMaskedLM { roberta, lm_head }
    }
/// Build a new `RobertaForMaskedLM`
///
/// # Arguments
///
/// * `p` - Variable store path for the root of the RobertaForMaskedLM model
/// * `config` - `BertConfig` object defining the model architecture and vocab size
///
/// # Example
///
/// ```no_run
/// use rust_bert::bert::BertConfig;
/// use rust_bert::roberta::RobertaForMaskedLM;
/// 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 = BertConfig::from_file(config_path);
/// let roberta = RobertaForMaskedLM::new(&p.root() / "roberta", &config);
/// ```
Build a new `RobertaForMaskedLM`
Build a new ` RobertaForMaskedLM `
pub fn new<'p, P>(p: P, config: &BertConfig) -> RobertaForMaskedLM
    where
        P: Borrow<nn::Path<'p>>,
    {
        let p = p.borrow();
        let roberta = BertModel::<RobertaEmbeddings>::new(p / "roberta", config);
        let lm_head = RobertaLMHead::new(p / "lm_head", config);
        RobertaForMaskedLM { roberta, lm_head }
    }
pub fn new < ' p , P > ( p : P , config : & BertConfig ) -> RobertaForMaskedLM where P : Borrow < nn :: Path < ' p > > , { let p = p . borrow ( ) ; let roberta = BertModel :: < RobertaEmbeddings > :: new ( p / " " , config ) ; let lm_head = RobertaLMHead :: new ( p / " " , config ) ; RobertaForMaskedLM { roberta , lm_head } }
Build a new `RobertaForMaskedLM`
Build a new ` RobertaForMaskedLM `
p
P
config
&BertConfig
p
P
config
&BertConfig
example


let config_path = Path::new("path/to/config.json");
let device = Device::Cpu;
let p = nn::VarStore::new(device);
let config = BertConfig::from_file(config_path);
let roberta = RobertaForMaskedLM::new(&p.root() / "roberta", &config);
```
let config_path = Path :: new ( " path / to / config . json " ) ; let device = Device :: Cpu ; let p = nn :: VarStore :: new ( device ) ; let config = BertConfig :: from_file ( config_path ) ; let roberta = RobertaForMaskedLM :: new ( &p . root () / " roberta " &config ) ; ` ` `