Struct rust_bert::gpt2::GPT2Generator[][src]

pub struct GPT2Generator { /* fields omitted */ }
Expand description

Implementations

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::gpt2::GPT2Generator;
use rust_bert::pipelines::generation_utils::GenerateConfig;

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

Generate text based on a vector of promp texts. Read more

Generate token indices without decoding (useful for token-level operations before returning final text or as validation step during training). Read more

Generate token indices given a list of indices (useful when the input has been pre-tokenized). Returns a list of output tokens that need to be decoded using a tokenizer. Read more

Returns a reference to the text generator’s tokenizer Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.