From 04905c5b2e6f2d72379d16f54f2091892e0843e0 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Mon, 11 Mar 2024 14:59:36 +0100 Subject: [PATCH] Revert ruff fix. --- .../python/py_src/tokenizers/models/__init__.py | 8 ++++++++ .../py_src/tokenizers/pre_tokenizers/__init__.py | 15 +++++++++++++++ .../py_src/tokenizers/processors/__init__.py | 9 +++++++++ .../python/py_src/tokenizers/tools/visualizer.py | 8 ++++---- .../python/py_src/tokenizers/trainers/__init__.py | 8 ++++++++ 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/bindings/python/py_src/tokenizers/models/__init__.py b/bindings/python/py_src/tokenizers/models/__init__.py index e69de29bb..68ac211aa 100644 --- a/bindings/python/py_src/tokenizers/models/__init__.py +++ b/bindings/python/py_src/tokenizers/models/__init__.py @@ -0,0 +1,8 @@ +# Generated content DO NOT EDIT +from .. import models + +Model = models.Model +BPE = models.BPE +Unigram = models.Unigram +WordLevel = models.WordLevel +WordPiece = models.WordPiece diff --git a/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py b/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py index e69de29bb..48277f0d2 100644 --- a/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py +++ b/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py @@ -0,0 +1,15 @@ +# Generated content DO NOT EDIT +from .. import pre_tokenizers + +PreTokenizer = pre_tokenizers.PreTokenizer +BertPreTokenizer = pre_tokenizers.BertPreTokenizer +ByteLevel = pre_tokenizers.ByteLevel +CharDelimiterSplit = pre_tokenizers.CharDelimiterSplit +Digits = pre_tokenizers.Digits +Metaspace = pre_tokenizers.Metaspace +Punctuation = pre_tokenizers.Punctuation +Sequence = pre_tokenizers.Sequence +Split = pre_tokenizers.Split +UnicodeScripts = pre_tokenizers.UnicodeScripts +Whitespace = pre_tokenizers.Whitespace +WhitespaceSplit = pre_tokenizers.WhitespaceSplit diff --git a/bindings/python/py_src/tokenizers/processors/__init__.py b/bindings/python/py_src/tokenizers/processors/__init__.py index e69de29bb..06d124037 100644 --- a/bindings/python/py_src/tokenizers/processors/__init__.py +++ b/bindings/python/py_src/tokenizers/processors/__init__.py @@ -0,0 +1,9 @@ +# Generated content DO NOT EDIT +from .. import processors + +PostProcessor = processors.PostProcessor +BertProcessing = processors.BertProcessing +ByteLevel = processors.ByteLevel +RobertaProcessing = processors.RobertaProcessing +Sequence = processors.Sequence +TemplateProcessing = processors.TemplateProcessing diff --git a/bindings/python/py_src/tokenizers/tools/visualizer.py b/bindings/python/py_src/tokenizers/tools/visualizer.py index df8b4b496..da368054c 100644 --- a/bindings/python/py_src/tokenizers/tools/visualizer.py +++ b/bindings/python/py_src/tokenizers/tools/visualizer.py @@ -92,7 +92,7 @@ def __init__( if default_to_notebook: try: from IPython.core.display import HTML, display - except ImportError: + except ImportError as e: raise Exception( """We couldn't import IPython utils for html display. Are you running in a notebook? @@ -136,7 +136,7 @@ def __call__( if final_default_to_notebook: try: from IPython.core.display import HTML, display - except ImportError: + except ImportError as e: raise Exception( """We couldn't import IPython utils for html display. Are you running in a notebook?""" @@ -170,12 +170,12 @@ def calculate_label_colors(annotations: AnnotationList) -> Dict[str, str]: if h_step < 20: h_step = 20 s = 32 - light = 64 + l = 64 h = 10 colors = {} for label in sorted(labels): # sort so we always get the same colors for a given set of labels - colors[label] = f"hsl({h},{s}%,{light}%" + colors[label] = f"hsl({h},{s}%,{l}%" h += h_step return colors diff --git a/bindings/python/py_src/tokenizers/trainers/__init__.py b/bindings/python/py_src/tokenizers/trainers/__init__.py index e69de29bb..22f94c50b 100644 --- a/bindings/python/py_src/tokenizers/trainers/__init__.py +++ b/bindings/python/py_src/tokenizers/trainers/__init__.py @@ -0,0 +1,8 @@ +# Generated content DO NOT EDIT +from .. import trainers + +Trainer = trainers.Trainer +BpeTrainer = trainers.BpeTrainer +UnigramTrainer = trainers.UnigramTrainer +WordLevelTrainer = trainers.WordLevelTrainer +WordPieceTrainer = trainers.WordPieceTrainer