From 4f15052c04e77351653e2e7337c3a7c451d42f65 Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Mon, 10 Jun 2024 11:25:16 +0200 Subject: [PATCH] proper padding derive --- tokenizers/src/utils/padding.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tokenizers/src/utils/padding.rs b/tokenizers/src/utils/padding.rs index d10ea7969..03faf2943 100644 --- a/tokenizers/src/utils/padding.rs +++ b/tokenizers/src/utils/padding.rs @@ -4,7 +4,7 @@ use derive_more::Display; use serde::{Deserialize, Serialize}; /// The various possible padding directions. -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, Display)] pub enum PaddingDirection { Left, Right, @@ -20,8 +20,7 @@ impl std::convert::AsRef for PaddingDirection { } #[derive(Debug, Clone, Serialize, Deserialize, Display)] -// #[display(fmt="Strategy: {:?}, Direction: {:?}, Pad to multiple of: {:?}, Pad ID: {}, Pad Type ID: {}, Pad Token: {}", strategy, direction, pad_to_multiple_of, pad_id, pad_type_id, pad_token)] -#[display(fmt = "Strategy:")] +#[display(fmt="strategy={}, direction={}, pad_to_multiple_of={}, pad_id={}, pad_type_id={}, pad_token={}", strategy, direction, "pad_to_multiple_of.unwrap()", pad_id, pad_type_id, pad_token)] pub struct PaddingParams { pub strategy: PaddingStrategy, pub direction: PaddingDirection, @@ -45,7 +44,6 @@ impl Default for PaddingParams { } #[derive(Debug, Clone, Serialize, Deserialize, Display)] -#[display(fmt={})] pub enum PaddingStrategy { BatchLongest, Fixed(usize),