[][src]Struct rust_bert::pipelines::generation::MarianGenerator

pub struct MarianGenerator { /* fields omitted */ }

Implementations

impl MarianGenerator[src]

pub fn new(generate_config: GenerateConfig) -> Fallible<MarianGenerator>[src]

Build a new marianGenerator

Arguments

  • vocab_path - Path to the model vocabulary, expected to have a structure following the Transformers library convention
  • sentencepiece_model_path - Path to the sentencepiece model (native protobuf expected)
  • config_path - Path to the model configuration, expected to have a structure following the Transformers library convention
  • weights_path - Path to the model weight files. These need to be converted form the .bin to .ot format using the utility script provided.
  • device - Device to run the model on, e.g. Device::Cpu or Device::Cuda(0)

Example

use rust_bert::pipelines::generation::{GenerateConfig, MarianGenerator};
let device = Device::cuda_if_available();
let generate_config = GenerateConfig {
    max_length: 512,
    do_sample: true,
    num_beams: 6,
    temperature: 1.0,
    num_return_sequences: 1,
    ..Default::default()
};
let marian_generator = MarianGenerator::new(generate_config)?;

Trait Implementations

impl LanguageGenerator<MarianForConditionalGeneration, MarianVocab, MarianTokenizer> for MarianGenerator[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,