pub trait Configwhere
for<'de> Self: Deserialize<'de>,{
fn from_file<P: AsRef<Path>>(path: P) -> Self { ... }
}
Expand description
Provided Methods§
sourcefn from_file<P: AsRef<Path>>(path: P) -> Self
fn from_file<P: AsRef<Path>>(path: P) -> Self
Loads a Config
object from a JSON file. The format is expected to be aligned with the Transformers library configuration files for each model.
The parsing will fail if non-optional keys expected by the model are missing.
Arguments
path
-Path
to the configuration JSON file.
Example
use rust_bert::gpt2::Gpt2Config;
use rust_bert::Config;
use std::path::Path;
let config_path = Path::new("path/to/config.json");
let config = Gpt2Config::from_file(config_path);