Struct rust_bert::prophetnet::ProphetNetConditionalGenerator [−][src]
pub struct ProphetNetConditionalGenerator { /* fields omitted */ }
Expand description
Implementations
impl ProphetNetConditionalGenerator
[src]
impl ProphetNetConditionalGenerator
[src]pub fn new(
generate_config: GenerateConfig
) -> Result<ProphetNetConditionalGenerator, RustBertError>
[src]
pub fn new(
generate_config: GenerateConfig
) -> Result<ProphetNetConditionalGenerator, RustBertError>
[src]Build a new ProphetNetConditionalGenerator
Arguments
vocab_path
- Path to the model vocabulary, expected to have a structure following the Transformers library conventionmerges_path
- Path to the bpe merges, expected to have a structure following the Transformers library conventionconfig_path
- Path to the model configuration, expected to have a structure following the Transformers library conventionweights_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
orDevice::Cuda(0)
Example
use rust_bert::pipelines::generation_utils::GenerateConfig; use rust_bert::prophetnet::ProphetNetConditionalGenerator; 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 prophetnet_generator = ProphetNetConditionalGenerator::new(generate_config)?;
Trait Implementations
impl LanguageGenerator<ProphetNetForConditionalGeneration, ProphetNetVocab, ProphetNetTokenizer> for ProphetNetConditionalGenerator
[src]
impl LanguageGenerator<ProphetNetForConditionalGeneration, ProphetNetVocab, ProphetNetTokenizer> for ProphetNetConditionalGenerator
[src]fn generate<'a, S>(
&self,
prompt_texts: Option<S>,
attention_mask: Option<Tensor>,
min_length: impl Into<Option<i64>>,
max_length: impl Into<Option<i64>>,
decoder_start_token_id: impl Into<Option<i64>>
) -> Vec<String> where
S: AsRef<[&'a str]>,
[src]
fn generate<'a, S>(
&self,
prompt_texts: Option<S>,
attention_mask: Option<Tensor>,
min_length: impl Into<Option<i64>>,
max_length: impl Into<Option<i64>>,
decoder_start_token_id: impl Into<Option<i64>>
) -> Vec<String> where
S: AsRef<[&'a str]>,
[src]Generate text based on a vector of promp texts. Read more
fn generate_indices<'a, S>(
&self,
prompt_texts: Option<S>,
attention_mask: Option<Tensor>,
min_length: impl Into<Option<i64>>,
max_length: impl Into<Option<i64>>,
decoder_start_token_id: impl Into<Option<i64>>
) -> Vec<Vec<i64>> where
S: AsRef<[&'a str]>,
[src]
fn generate_indices<'a, S>(
&self,
prompt_texts: Option<S>,
attention_mask: Option<Tensor>,
min_length: impl Into<Option<i64>>,
max_length: impl Into<Option<i64>>,
decoder_start_token_id: impl Into<Option<i64>>
) -> Vec<Vec<i64>> where
S: AsRef<[&'a str]>,
[src]Generate token indices without decoding (useful for token-level operations before returning final text or as validation step during training). Read more
fn generate_from_ids_and_past(
&self,
input_ids: Tensor,
attention_mask: Option<Tensor>,
min_length: impl Into<Option<i64>>,
max_length: impl Into<Option<i64>>,
decoder_start_token_id: impl Into<Option<i64>>
) -> Vec<Vec<i64>>
[src]
&self,
input_ids: Tensor,
attention_mask: Option<Tensor>,
min_length: impl Into<Option<i64>>,
max_length: impl Into<Option<i64>>,
decoder_start_token_id: impl Into<Option<i64>>
) -> Vec<Vec<i64>>
Auto Trait Implementations
impl RefUnwindSafe for ProphetNetConditionalGenerator
impl Send for ProphetNetConditionalGenerator
impl !Sync for ProphetNetConditionalGenerator
impl Unpin for ProphetNetConditionalGenerator
impl UnwindSafe for ProphetNetConditionalGenerator
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,