Skip to content

Commit

Permalink
update sequences and basic enums to show xxxx.Sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Jun 10, 2024
1 parent 15f877e commit 9c45e8f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bindings/python/src/processors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ impl PyPostProcessor {
fn __str__(&self) -> PyResult<String> {
Ok(format!("{}", &self))
}

fn __repr__(&self) -> PyResult<String>{
Ok(format!("{}", &self))
}
}

/// This post-processor takes care of adding the special tokens needed by
Expand Down
1 change: 1 addition & 0 deletions tokenizers/src/decoders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use derive_more::Display;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, Debug, Display)]
#[display(fmt="decoders.{})]
#[serde(untagged)]
pub enum DecoderWrapper {
BPE(BPEDecoder),
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
#[macro_rules_attribute(impl_serde_type!)]
#[derive(Clone, Debug, Display)]
#[display(
fmt = "decoders.Sequence([{}])",
fmt = "Sequence([{}])",
"decoders.iter().map(|d| d.to_string()).fold( String::new(), |mut acc, s|{
if !acc.is_empty(){
acc.push_str(\", \");
Expand Down
1 change: 1 addition & 0 deletions tokenizers/src/pre_tokenizers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::{PreTokenizedString, PreTokenizer};
use derive_more::Display;

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Display)]
#[display(fmt="pre_tokenizers.{}")]
#[serde(untagged)]
pub enum PreTokenizerWrapper {
BertPreTokenizer(BertPreTokenizer),
Expand Down

0 comments on commit 9c45e8f

Please sign in to comment.