pub enum MaskedLanguageOption {
Bert(BertForMaskedLM),
Deberta(DebertaForMaskedLM),
DebertaV2(DebertaV2ForMaskedLM),
Roberta(RobertaForMaskedLM),
XLMRoberta(RobertaForMaskedLM),
FNet(FNetForMaskedLM),
}
Expand description
§Abstraction that holds one particular masked language model, for any of the supported models
Variants§
Bert(BertForMaskedLM)
Bert for Masked Language
Deberta(DebertaForMaskedLM)
DeBERTa for Masked Language
DebertaV2(DebertaV2ForMaskedLM)
DeBERTa V2 for Masked Language
Roberta(RobertaForMaskedLM)
Roberta for Masked Language
XLMRoberta(RobertaForMaskedLM)
XLMRoberta for Masked Language
FNet(FNetForMaskedLM)
FNet for Masked Language
Implementations§
Source§impl MaskedLanguageOption
impl MaskedLanguageOption
Sourcepub fn new(config: &MaskedLanguageConfig) -> Result<Self, RustBertError>
pub fn new(config: &MaskedLanguageConfig) -> Result<Self, RustBertError>
Instantiate a new masked language model of the supplied type.
§Arguments
MaskedLanguageConfig
- Masked language model pipeline configuration. The type of model created will be inferred from theModelResources
(Torch or ONNX) andModelType
(Architecture for Torch models) variants provided and
Sourcepub fn model_type(&self) -> ModelType
pub fn model_type(&self) -> ModelType
Returns the ModelType
for this MaskedLanguageOption
Sourcepub fn forward_t(
&self,
input_ids: Option<&Tensor>,
mask: Option<&Tensor>,
token_type_ids: Option<&Tensor>,
position_ids: Option<&Tensor>,
input_embeds: Option<&Tensor>,
encoder_hidden_states: Option<&Tensor>,
encoder_mask: Option<&Tensor>,
train: bool,
) -> Tensor
pub fn forward_t( &self, input_ids: Option<&Tensor>, mask: Option<&Tensor>, token_type_ids: Option<&Tensor>, position_ids: Option<&Tensor>, input_embeds: Option<&Tensor>, encoder_hidden_states: Option<&Tensor>, encoder_mask: Option<&Tensor>, train: bool, ) -> Tensor
Interface method to forward_t() of the particular models.
Auto Trait Implementations§
impl Freeze for MaskedLanguageOption
impl RefUnwindSafe for MaskedLanguageOption
impl Send for MaskedLanguageOption
impl !Sync for MaskedLanguageOption
impl Unpin for MaskedLanguageOption
impl UnwindSafe for MaskedLanguageOption
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