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

        let embeddings = AlbertEmbeddings::new(p / "embeddings", config);
        let encoder = AlbertTransformer::new(p / "encoder", config);
        let pooler = nn::linear(
            p / "pooler",
            config.hidden_size,
            config.hidden_size,
            Default::default(),
        );
        let pooler_activation = Box::new(_tanh);

        AlbertModel {
            embeddings,
            encoder,
            pooler,
            pooler_activation,
        }
    }
/// Build a new `AlbertModel`
///
/// # Arguments
///
/// * `p` - Variable store path for the root of the ALBERT model
/// * `config` - `AlbertConfig` object defining the model architecture and decoder status
///
/// # Example
///
/// ```no_run
/// use rust_bert::albert::{AlbertConfig, AlbertModel};
/// 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 = AlbertConfig::from_file(config_path);
/// let albert: AlbertModel = AlbertModel::new(&p.root() / "albert", &config);
/// ```
Build a new `AlbertModel`
Build a new ` AlbertModel `
pub fn new<'p, P>(p: P, config: &AlbertConfig) -> AlbertModel
    where
        P: Borrow<nn::Path<'p>>,
    {
        let p = p.borrow();
        let embeddings = AlbertEmbeddings::new(p / "embeddings", config);
        let encoder = AlbertTransformer::new(p / "encoder", config);
        let pooler = nn::linear(
            p / "pooler",
            config.hidden_size,
            config.hidden_size,
            Default::default(),
        );
        let pooler_activation = Box::new(_tanh);
        AlbertModel {
            embeddings,
            encoder,
            pooler,
            pooler_activation,
        }
    }
pub fn new < ' p , P > ( p : P , config : & AlbertConfig ) -> AlbertModel where P : Borrow < nn :: Path < ' p > > , { let p = p . borrow ( ) ; let embeddings = AlbertEmbeddings :: new ( p / " " , config ) ; let encoder = AlbertTransformer :: new ( p / " " , config ) ; let pooler = nn :: linear ( p / " " , config . hidden_size , config . hidden_size , Default :: default ( ) , ) ; let pooler_activation = Box :: new ( _tanh ) ; AlbertModel { embeddings , encoder , pooler , pooler_activation , } }
Build a new `AlbertModel`
Build a new ` AlbertModel `
p
P
config
&AlbertConfig
p
P
config
&AlbertConfig
example
```no_run
use rust_bert::albert::{AlbertConfig, AlbertModel};
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 = AlbertConfig::from_file(config_path);
let albert: AlbertModel = AlbertModel::new(&p.root() / "albert", &config);
```
` ` ` no_run use rust_bert :: albert :: { AlbertConfig AlbertModel } ; 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 = AlbertConfig :: from_file ( config_path ) ; let albert : AlbertModel = AlbertModel :: new ( &p . root () / " albert " &config ) ; ` ` `