Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyo3 smd v0.21 #1574

Merged
merged 1 commit into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ ndarray = "0.15"
onig = { version = "6.4", default-features = false }
itertools = "0.12"
derive_more = "0.99.17"
pyo3 = { version = "0.22", features = ["multiple-pymethods"] }
pyo3_special_method_derive = "0.4"
pyo3 = { version = "0.21", features = ["multiple-pymethods"] }
pyo3_special_method_derive_0_21 = "0.4"

[dependencies.tokenizers]
path = "../../tokenizers"

[dev-dependencies]
tempfile = "3.10"
pyo3 = { version = "0.22", features = ["auto-initialize"] }
pyo3 = { version = "0.21", features = ["auto-initialize"] }

[features]
defaut = ["pyo3/extension-module"]
18 changes: 16 additions & 2 deletions bindings/python/src/decoders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ use std::sync::{Arc, RwLock};

use crate::pre_tokenizers::from_string;
use crate::utils::PyPattern;
use pyo3_special_method_derive::AutoDisplay;
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use pyo3_special_method_derive_0_21::AutoDisplay;
use pyo3_special_method_derive_0_21::PyDebug;
use pyo3_special_method_derive_0_21::PyDisplay;
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use tk::decoders::bpe::BPEDecoder;
Expand Down Expand Up @@ -487,11 +489,23 @@ impl PySequenceDecoder {
}
}

#[derive(Clone, AutoDisplay)]
#[derive(Clone)]
pub(crate) struct CustomDecoder {
pub inner: PyObject,
}

impl PyDisplay for CustomDecoder {
fn fmt_display(&self) -> String {
"CustomDecoder()".to_string()
}
}

impl PyDebug for CustomDecoder {
fn fmt_debug(&self) -> String {
"CustomDecoder()".to_string()
}
}

impl CustomDecoder {
pub(crate) fn new(inner: PyObject) -> Self {
CustomDecoder { inner }
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::sync::{Arc, RwLock};
use super::error::{deprecation_warning, ToPyResult};
use crate::token::PyToken;
use crate::trainers::PyTrainer;
use pyo3_special_method_derive::AutoDisplay;
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
use tk::models::bpe::{BpeBuilder, Merges, Vocab, BPE};
use tk::models::unigram::Unigram;
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/normalizers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use std::sync::{Arc, RwLock};

use crate::error::ToPyResult;
use crate::utils::{PyNormalizedString, PyNormalizedStringRefMut, PyPattern};
use pyo3_special_method_derive::AutoDisplay;
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::ser::SerializeStruct;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use tk::normalizers::{
Expand Down
10 changes: 1 addition & 9 deletions bindings/python/src/pre_tokenizers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use tokenizers as tk;

use super::error::ToPyResult;
use super::utils::*;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::{AutoDisplay, Dict, Dir, Repr, Str};
/// Base class for all pre-tokenizers
///
/// This class is not supposed to be instantiated directly. Instead, any implementation of a
Expand Down Expand Up @@ -181,14 +181,6 @@ impl PyPreTokenizer {
.map(|(s, o, _)| (s.to_owned(), o))
.collect())
}

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

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

macro_rules! getter {
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/processors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::sync::Arc;

use crate::encoding::PyEncoding;
use crate::error::ToPyResult;
use pyo3_special_method_derive::AutoDisplay;
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
use tk::processors::bert::BertProcessing;
use tk::processors::byte_level::ByteLevel;
Expand Down
10 changes: 1 addition & 9 deletions bindings/python/src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ use super::pre_tokenizers::PyPreTokenizer;
use super::trainers::PyTrainer;
use crate::processors::PyPostProcessor;
use crate::utils::{MaybeSizedIterator, PyBufferedIterator};
use pyo3_special_method_derive::AutoDisplay;
use numpy::{npyffi, PyArray1};
use pyo3::class::basic::CompareOp;
use pyo3::exceptions;
use pyo3::intern;
use pyo3::prelude::*;
use pyo3::types::*;
use pyo3_special_method_derive_0_21::AutoDisplay;
use std::collections::BTreeMap;
use tk::models::bpe::BPE;
use tk::tokenizer::{
Expand Down Expand Up @@ -1409,14 +1409,6 @@ impl PyTokenizer {
fn set_decoder(&mut self, decoder: PyRef<PyDecoder>) {
self.tokenizer.with_decoder(decoder.clone());
}

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

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

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fancy-regex = { version = "0.13", optional = true}
getrandom = { version = "0.2.10" }
esaxx-rs = { version = "0.1.10", default-features = false, features=[]}
monostate = "0.1.12"
pyo3_special_method_derive = "0.4"
pyo3_special_method_derive_0_21 = "0.4"

[features]
default = ["progressbar", "onig", "esaxx_fast"]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/bpe.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::tokenizer::{Decoder, Result};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Clone, Debug, Serialize, AutoDisplay)]
/// Allows decoding Original BPE by joining all the tokens and then replacing
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/byte_fallback.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{Decoder, Result};
use monostate::MustBe;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Clone, Debug, Serialize, Default, AutoDisplay)]
/// ByteFallback is a simple trick which converts tokens looking like `<0x61>`
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/ctc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::decoders::wordpiece;
use crate::tokenizer::{Decoder, Result};
use itertools::Itertools;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, AutoDisplay)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/fuse.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{Decoder, Result};
use monostate::MustBe;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize, Default, AutoDisplay)]
/// Fuse simply fuses all tokens into one big string.
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
use crate::pre_tokenizers::byte_level::ByteLevel;
use crate::pre_tokenizers::metaspace::Metaspace;
use crate::{Decoder, Result};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, Debug, AutoDisplay)]

Check warning on line 27 in tokenizers/src/decoders/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds & tests (ubuntu-latest)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/decoders/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.8)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/decoders/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.10)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/decoders/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds

unused borrow that must be used

Check warning on line 27 in tokenizers/src/decoders/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.9)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/decoders/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.7)

unused borrow that must be used
#[auto_display(fmt="decoders.{}")]
#[serde(untagged)]
pub enum DecoderWrapper {
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/sequence.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::decoders::DecoderWrapper;
use crate::tokenizer::{Decoder, Result};
use crate::utils::macro_rules_attribute;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

#[macro_rules_attribute(impl_serde_type!)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/strip.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{Decoder, Result};

use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Clone, Debug, Serialize, Default, AutoDisplay)]
/// Strip is a simple trick which converts tokens looking like `<0x61>`
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/decoders/wordpiece.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{Decoder, Result};

use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Clone, Debug, Serialize, AutoDisplay)]
/// The WordPiece decoder takes care of decoding a list of wordpiece tokens
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use std::collections::HashMap;
use std::path::{Path, PathBuf};

use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize, Serializer};

use crate::models::bpe::{BpeTrainer, BPE};
Expand Down Expand Up @@ -58,7 +58,7 @@
}
}

#[derive(Deserialize, Serialize, Debug, PartialEq, Clone, AutoDisplay)]

Check warning on line 61 in tokenizers/src/models/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds & tests (ubuntu-latest)

unused borrow that must be used

Check warning on line 61 in tokenizers/src/models/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.8)

unused borrow that must be used

Check warning on line 61 in tokenizers/src/models/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.10)

unused borrow that must be used

Check warning on line 61 in tokenizers/src/models/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds

unused borrow that must be used

Check warning on line 61 in tokenizers/src/models/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.9)

unused borrow that must be used

Check warning on line 61 in tokenizers/src/models/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.7)

unused borrow that must be used
#[serde(untagged)]
pub enum ModelWrapper {
BPE(BPE),
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/unigram/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::{
use crate::tokenizer::{Model, Result, Token};
use crate::utils::cache::Cache;

use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use std::collections::HashMap;
use std::convert::TryInto;
use std::fs::read_to_string;
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/wordlevel/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::OrderedVocabIter;
use crate::tokenizer::{Model, Result, Token};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde_json::Value;
use std::collections::HashMap;
use std::fs::File;
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/wordpiece/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::models::bpe::BPE;
use crate::tokenizer::{Model, Result, Token};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use std::{
borrow::Cow,
collections::HashMap,
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/bert.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{NormalizedString, Normalizer, Result};

use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
use unicode_categories::UnicodeCategories;
/// Checks whether a character is whitespace
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
use serde::{Deserialize, Serialize};

use crate::{NormalizedString, Normalizer};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;

/// Wrapper for known Normalizers.
#[derive(Clone, Debug, Deserialize, Serialize, AutoDisplay)]

Check warning on line 23 in tokenizers/src/normalizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds & tests (ubuntu-latest)

unused borrow that must be used

Check warning on line 23 in tokenizers/src/normalizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.8)

unused borrow that must be used

Check warning on line 23 in tokenizers/src/normalizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.10)

unused borrow that must be used

Check warning on line 23 in tokenizers/src/normalizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds

unused borrow that must be used

Check warning on line 23 in tokenizers/src/normalizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.9)

unused borrow that must be used

Check warning on line 23 in tokenizers/src/normalizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.7)

unused borrow that must be used
#[serde(untagged)]
#[auto_display(fmt = "normalizers.{}")]
pub enum NormalizerWrapper {
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/prepend.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, Serialize, AutoDisplay)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::tokenizer::pattern::Pattern;
use crate::tokenizer::Decoder;
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::SysRegex;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
/// Represents the different patterns that `Replace` can use
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/strip.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::macro_rules_attribute;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};
use unicode_normalization_alignments::char::is_combining_mark;
#[derive(Copy, Clone, Debug, Deserialize, Serialize, AutoDisplay)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/unicode.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::macro_rules_attribute;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;

#[derive(Default, Copy, Clone, Debug, AutoDisplay)]
#[macro_rules_attribute(impl_serde_type!)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::normalizers::NormalizerWrapper;
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::macro_rules_attribute;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
#[derive(Clone, Deserialize, Debug, Serialize, AutoDisplay)]
#[serde(tag = "type")]
/// Allows concatenating multiple other Normalizer as a Sequence.
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/bert.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
use crate::utils::macro_rules_attribute;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use unicode_categories::UnicodeCategories;

fn is_bert_punc(x: char) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/byte_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::tokenizer::{
};
use crate::utils::macro_rules_attribute;
use crate::utils::SysRegex;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

/// Converts bytes to unicode characters.
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/delimiter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/digits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/metaspace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::tokenizer::{Decoder, PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{de, Deserialize, Deserializer, Serialize};
/// Enum representing options for the metaspace prepending scheme.
#[derive(Debug, Clone, PartialEq, Serialize, Eq, Deserialize, Copy, AutoDisplay)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
use crate::pre_tokenizers::unicode_scripts::UnicodeScripts;
use crate::pre_tokenizers::whitespace::{Whitespace, WhitespaceSplit};
use crate::{PreTokenizedString, PreTokenizer};
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, AutoDisplay)]

Check warning on line 27 in tokenizers/src/pre_tokenizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds & tests (ubuntu-latest)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/pre_tokenizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.8)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/pre_tokenizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.10)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/pre_tokenizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check everything builds

unused borrow that must be used

Check warning on line 27 in tokenizers/src/pre_tokenizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.9)

unused borrow that must be used

Check warning on line 27 in tokenizers/src/pre_tokenizers/mod.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.7)

unused borrow that must be used
#[auto_display(fmt="pre_tokenizers.{}")]
#[serde(untagged)]
pub enum PreTokenizerWrapper {
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/punctuation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/sequence.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::pre_tokenizers::PreTokenizerWrapper;
use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result};
use crate::utils::macro_rules_attribute;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Serialize};

#[macro_rules_attribute(impl_serde_type!)]
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
pattern::Invert, PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior,
};
use crate::utils::SysRegex;
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use serde::{Deserialize, Deserializer, Serialize};

/// Represents the different patterns that `Split` can use
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq, AutoDisplay)]

Check warning on line 9 in tokenizers/src/pre_tokenizers/split.rs

View workflow job for this annotation

GitHub Actions / Check everything builds & tests (ubuntu-latest)

unused borrow that must be used

Check warning on line 9 in tokenizers/src/pre_tokenizers/split.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.8)

unused borrow that must be used

Check warning on line 9 in tokenizers/src/pre_tokenizers/split.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.10)

unused borrow that must be used

Check warning on line 9 in tokenizers/src/pre_tokenizers/split.rs

View workflow job for this annotation

GitHub Actions / Check everything builds

unused borrow that must be used

Check warning on line 9 in tokenizers/src/pre_tokenizers/split.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.9)

unused borrow that must be used

Check warning on line 9 in tokenizers/src/pre_tokenizers/split.rs

View workflow job for this annotation

GitHub Actions / Check it builds for Windows 32-bit (3.7)

unused borrow that must be used
pub enum SplitPattern {
String(String),
Regex(String),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;

use crate::pre_tokenizers::unicode_scripts::scripts::{get_script, Script};
use crate::tokenizer::{normalizer::Range, PreTokenizedString, PreTokenizer, Result};
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/pre_tokenizers/whitespace.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pyo3_special_method_derive::AutoDisplay;
use pyo3_special_method_derive_0_21::AutoDisplay;
use regex::Regex;

use crate::tokenizer::{
Expand Down
Loading
Loading