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

pub struct GPT2Generator { /* fields omitted */ }

Implementations

impl GPT2Generator[src]

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

Build a new GPT2Generator

Arguments

  • generate_config - GenerateConfig object containing the resource references (model, vocabulary, configuration), generation options and device placement (CPU/GPU)

Example

use rust_bert::pipelines::generation::{GenerateConfig, GPT2Generator};

let generate_config = GenerateConfig {
   max_length: 30,
   do_sample: true,
   num_beams: 5,
   temperature: 1.1,
   num_return_sequences: 3,
   ..Default::default()
};
let gpt2_generator = GPT2Generator::new(generate_config)?;

Trait Implementations

impl LanguageGenerator<GPT2LMHeadModel, Gpt2Vocab, Gpt2Tokenizer> for GPT2Generator[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.