Skip to main content

Module sys

Module sys 

Source
Expand description

This module provides raw bindings for CTranslate2.

This module provides Rust bindings for ctranslate2::Translator, ctranslate2::Generator, and ctranslate2::Whisper along with related structures.

§Translator

The main structure is the Translator, which serves as the interface to the translation functionalities of the ctranslate2 library.

In addition to the Translator, this module also offers various supportive structures such as TranslationOptions and TranslationResult.

§Generator

The Generator structure is the primary interface, offering the capability to generate text based on a trained model. It is designed for tasks such as text generation, autocompletion, and other similar language generation tasks.

Alongside the Generator, this module also includes structures that are critical for controlling and understanding the generation process:

  • GenerationOptions: A structure containing configuration options for the generation process,

  • GenerationResult: A structure that holds the results of the generation process.

§Whisper

The main structure is the Whisper.

In addition to the Whisper, this module also offers various supportive structures such as WhisperOptions, DetectionResult, and WhisperGenerationResult.

For more detailed information on each structure and its usage, please refer to their respective documentation within this module.

Structs§

BatchType
Specifies how the max_batch_size should be calculated.
ComputeType
Model computation type.
Config
The Config structure holds the configuration settings for CTranslator2.
DetectionResult
Pair of the detected language and its probability.
Device
Represents the computing device to be used.
GenerationOptions
The set of generation options.
GenerationResult
A generation result.
GenerationStepResult
The result for a single generation step.
Generator
A text generator.
LogLevel
Logging level.
ModelMemoryReader
An allocated buffer with shape information.
ScoringOptions
ScoringOptions specifies configuration options for the scoring process.
ScoringResult
ScoringResult represents the result of a scoring process, containing tokens and their respective scores.
StorageView
An allocated buffer with shape information.
TranslationOptions
Options for translation.
TranslationResult
A translation result.
Translator
A text translator.
Whisper
Implements the Whisper speech recognition model published by OpenAI.
WhisperAlignmentResult
WhisperAlignmentResult is the alignment generated by Whisper::align(), which generates a token-level alignment of a generate()’d output.
WhisperGenerationResult
A generation result from the Whisper model.
WhisperOptions
Options for whisper generation.
WhisperTokenAlignment
WhisperTokenAlignment is one step in the DTW alignment within WhisperAlignmentResult.

Functions§

get_device_count
Returns the number of devices.
get_log_level
Returns the current logging level.
get_random_seed
Returns the current seed of random generators.
set_log_level
Sets the CTranslate2 logging level.
set_random_seed
Sets the seed of random generators.