pub enum TextGenerationOption {
GPT2(GPT2Generator),
GPT(OpenAIGenerator),
GPTNeo(GptNeoGenerator),
GPTJ(GptJGenerator),
XLNet(XLNetGenerator),
Reformer(ReformerGenerator),
T5(T5Generator),
}Expand description
§Abstraction that holds one particular text generation model, for any of the supported models
Variants§
GPT2(GPT2Generator)
Text Generator based on GPT2 model
GPT(OpenAIGenerator)
Text Generator based on GPT model
GPTNeo(GptNeoGenerator)
Text Generator based on GPT-Neo model
GPTJ(GptJGenerator)
Text Generator based on GPT-J model
XLNet(XLNetGenerator)
Text Generator based on XLNet model
Reformer(ReformerGenerator)
Text Generator based on Reformer model
T5(T5Generator)
Text Generator based on T5 model
Implementations§
Source§impl TextGenerationOption
impl TextGenerationOption
pub fn new(config: TextGenerationConfig) -> Result<Self, RustBertError>
pub fn new_with_tokenizer( config: TextGenerationConfig, tokenizer: TokenizerOption, ) -> Result<Self, RustBertError>
Sourcepub fn model_type(&self) -> ModelType
pub fn model_type(&self) -> ModelType
Returns the ModelType for this TextGenerationOption
Sourcepub fn get_tokenizer(&self) -> &TokenizerOption
pub fn get_tokenizer(&self) -> &TokenizerOption
Interface method to access tokenizer
Sourcepub fn get_tokenizer_mut(&mut self) -> &mut TokenizerOption
pub fn get_tokenizer_mut(&mut self) -> &mut TokenizerOption
Interface method to access tokenizer
Sourcepub fn generate_indices<S>(
&self,
prompt_texts: Option<&[S]>,
min_length: Option<i64>,
max_length: Option<i64>,
) -> Result<Vec<Vec<i64>>, RustBertError>
pub fn generate_indices<S>( &self, prompt_texts: Option<&[S]>, min_length: Option<i64>, max_length: Option<i64>, ) -> Result<Vec<Vec<i64>>, RustBertError>
Interface method to generate() of the particular models.
pub fn half(&mut self) -> Result<(), RustBertError>
pub fn float(&mut self) -> Result<(), RustBertError>
pub fn set_device(&mut self, device: Device) -> Result<(), RustBertError>
Auto Trait Implementations§
impl !Freeze for TextGenerationOption
impl !RefUnwindSafe for TextGenerationOption
impl Send for TextGenerationOption
impl !Sync for TextGenerationOption
impl Unpin for TextGenerationOption
impl !UnwindSafe for TextGenerationOption
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more