pub trait Configwhere
for<'de> Self: Deserialize<'de>,{
// Provided method
fn from_file<P: AsRef<Path>>(path: P) -> Self { ... }
}
Expand description
§Utility to deserialize JSON config files
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);
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.