style: apply rustfmt across all crates and demos
Consistent formatting pass: line wrapping, import sorting, trailing whitespace removal, let-chain indentation, merged derive attributes, and unsafe block reformatting. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
@@ -6,8 +6,7 @@ use rtx_tensor::Tensor;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Position encoding type for GPT
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||
pub enum PositionEncodingType {
|
||||
/// Sinusoidal position encoding
|
||||
Sinusoidal,
|
||||
@@ -18,10 +17,8 @@ pub enum PositionEncodingType {
|
||||
Rotary,
|
||||
}
|
||||
|
||||
|
||||
/// Sampling strategy for text generation
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||
pub enum SamplingStrategy {
|
||||
/// Greedy decoding - always pick highest probability token
|
||||
#[default]
|
||||
@@ -38,7 +35,6 @@ pub enum SamplingStrategy {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
/// Configuration for text generation
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GenerationConfig {
|
||||
@@ -102,7 +98,7 @@ pub struct TextGenerator {
|
||||
|
||||
impl TextGenerator {
|
||||
/// Create a new text generator
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn new(
|
||||
vocab_to_id: HashMap<String, usize>,
|
||||
special_tokens: HashMap<String, usize>,
|
||||
|
||||
Reference in New Issue
Block a user