pub fn new(translation_config: TranslationConfig) -> Result<TranslationModel, RustBertError> {
        let prefix = translation_config.prefix.clone();
        let model = TranslationOption::new(translation_config);

        Ok(TranslationModel { model, prefix })
    }
/// Build a new `TranslationModel`
///
/// # Arguments
///
/// * `translation_config` - `TranslationConfig` object containing the resource references (model, vocabulary, configuration), translation options and device placement (CPU/GPU)
///
/// # Example
///
/// ```no_run
/// # fn main() -> anyhow::Result<()> {
/// use rust_bert::pipelines::translation::{Language, TranslationConfig, TranslationModel};
/// use tch::Device;
///
/// let translation_config =
///     TranslationConfig::new(Language::FrenchToEnglish, Device::cuda_if_available());
/// let mut summarization_model = TranslationModel::new(translation_config)?;
/// # Ok(())
/// # }
/// ```
Build a new `TranslationModel`
Build a new ` TranslationModel `
pub fn new(translation_config: TranslationConfig) -> Result<TranslationModel, RustBertError> {
        let prefix = translation_config.prefix.clone();
        let model = TranslationOption::new(translation_config);
        Ok(TranslationModel { model, prefix })
    }
pub fn new ( translation_config : TranslationConfig ) -> Result < TranslationModel , RustBertError > { let prefix = translation_config . prefix . clone ( ) ; let model = TranslationOption :: new ( translation_config ) ; Ok ( TranslationModel { model , prefix } ) }
Build a new `TranslationModel`
Build a new ` TranslationModel `
translation_config
TranslationConfig
translation_config
TranslationConfig
example
None
fn main() -> anyhow::result<()> {
use rust_bert::pipelines::translation::{Language, TranslationConfig, TranslationModel};
use tch::Device.

let translation_config
TranslationConfig::new(Language::FrenchToEnglish, Device::cuda_if_available());
let mut summarization_model = TranslationModel::new(translation_config)?.
use rust_bert :: pipelines :: translation :: { Language TranslationConfig TranslationModel } ; use tch :: Device . let translation_config TranslationConfig :: new ( Language :: FrenchToEnglish Device :: cuda_if_available () ) ; let mut summarization_model = TranslationModel :: new ( translation_config ) ? .
ok(())
None
}
None