Struct rust_bert::bart::BartGenerator[][src]

pub struct BartGenerator { /* fields omitted */ }

Implementations

impl BartGenerator[src]

pub fn new(
    generate_config: GenerateConfig
) -> Result<BartGenerator, RustBertError>
[src]

Build a new BartGenerator

Arguments

  • vocab_path - Path to the model vocabulary, expected to have a structure following the Transformers library convention
  • merges_path - Path to the bpe merges, expected to have a structure following the Transformers library convention
  • 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::bart::BartGenerator;
use rust_bert::pipelines::generation_utils::GenerateConfig;
let device = Device::cuda_if_available();
let generate_config = GenerateConfig {
    max_length: 30,
    do_sample: true,
    num_beams: 5,
    temperature: 1.1,
    num_return_sequences: 3,
    ..Default::default()
};
let bart_generator = BartGenerator::new(generate_config)?;

Trait Implementations

impl LanguageGenerator<BartForConditionalGeneration, RobertaVocab, RobertaTokenizer> for BartGenerator[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> Instrument for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

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>,