Skip to content

Commit

Permalink
Merge branch 'add-display' of github.com:huggingface/tokenizers into …
Browse files Browse the repository at this point in the history
…add-display

fix git suggestion

nit

__repr__ should use Debug?

small updates

Simple lazygit test
  • Loading branch information
ArthurZucker committed Jun 7, 2024
2 parents 27576e5 + e48cd3a commit 35373de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion bindings/python/src/pre_tokenizers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,15 @@ impl Serialize for PyPreTokenizerWrapper {
#[serde(untagged)]
// #[display(fmt = "")]
pub(crate) enum PyPreTokenizerTypeWrapper {
#[display(fmt = "[{}]", "_0.iter().map(|d| d.as_ref().read().unwrap().to_string()).collect::<Vec<_>>().join(\", \")")]
#[display(fmt = "[{}]", "_0_0.iter()
.map(|d| d.as_ref().read().unwrap().to_string())
.fold(String::new(), |mut acc, s| {
if !acc.is_empty() {
acc.push_str(", ");
}
acc.push_str(&s);
acc
})")]
Sequence(Vec<Arc<RwLock<PyPreTokenizerWrapper>>>),
#[display(fmt ="{}", "_0.as_ref().read().unwrap()")]
Single(Arc<RwLock<PyPreTokenizerWrapper>>),
Expand Down
4 changes: 2 additions & 2 deletions tokenizers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! 4. The `PostProcessor`: in charge of post-processing the `Encoding` to add anything relevant
//! that, for example, a language model would need, such as special tokens.
//!
//! ## Loading a pretrained tokenizer from the Hub
//! ## Loading a pretrained tokenizer from the Hub.
//! ```
//! use tokenizers::tokenizer::{Result, Tokenizer};
//!
Expand All @@ -39,7 +39,7 @@
//! }
//! ```
//!
//! ## Deserialization and tokenization example
//! ## Deserialization and tokenization example.
//!
//! ```no_run
//! use tokenizers::tokenizer::{Result, Tokenizer, EncodeInput};
Expand Down

0 comments on commit 35373de

Please sign in to comment.