[−][src]Struct rust_bert::pipelines::generation::MarianGenerator
Implementations
impl MarianGenerator
[src]
pub fn new(generate_config: GenerateConfig) -> Fallible<MarianGenerator>
[src]
Build a new marianGenerator
Arguments
vocab_path
- Path to the model vocabulary, expected to have a structure following the Transformers library conventionsentencepiece_model_path
- Path to the sentencepiece model (native protobuf expected)config_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::{GenerateConfig, MarianGenerator}; let device = Device::cuda_if_available(); let generate_config = GenerateConfig { max_length: 512, do_sample: true, num_beams: 6, temperature: 1.0, num_return_sequences: 1, ..Default::default() }; let marian_generator = MarianGenerator::new(generate_config)?;
Trait Implementations
impl LanguageGenerator<MarianForConditionalGeneration, MarianVocab, MarianTokenizer> for MarianGenerator
[src]
Auto Trait Implementations
impl !RefUnwindSafe for MarianGenerator
impl !Send for MarianGenerator
impl !Sync for MarianGenerator
impl Unpin for MarianGenerator
impl !UnwindSafe for MarianGenerator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,