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§
- Batch
Type - Specifies how the
max_batch_sizeshould be calculated. - Compute
Type - Model computation type.
- Config
- The
Configstructure holds the configuration settings for CTranslator2. - Detection
Result - Pair of the detected language and its probability.
- Device
- Represents the computing device to be used.
- Generation
Options - The set of generation options.
- Generation
Result - A generation result.
- Generation
Step Result - The result for a single generation step.
- Generator
- A text generator.
- LogLevel
- Logging level.
- Model
Memory Reader - An allocated buffer with shape information.
- Scoring
Options ScoringOptionsspecifies configuration options for the scoring process.- Scoring
Result ScoringResultrepresents the result of a scoring process, containing tokens and their respective scores.- Storage
View - An allocated buffer with shape information.
- Translation
Options - Options for translation.
- Translation
Result - A translation result.
- Translator
- A text translator.
- Whisper
- Implements the Whisper speech recognition model published by OpenAI.
- Whisper
Alignment Result WhisperAlignmentResultis the alignment generated by Whisper::align(), which generates a token-level alignment of a generate()’d output.- Whisper
Generation Result - A generation result from the Whisper model.
- Whisper
Options - Options for whisper generation.
- Whisper
Token Alignment WhisperTokenAlignmentis one step in the DTW alignment withinWhisperAlignmentResult.
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.