




"""simple docstring"""







import colorsys
import io

import cva
import matplotlib as mpl
import matplotlib.colors as mplc
import matplotlib.figure as mplfigure
import numpy as np
import torch
from matplotlib.backends.backend_agg import FigureCanvasAgg

from utils import img_tensorize


SCREAMING_SNAKE_CASE_      =					1000

class 							snake_case_ :







   """simple docstring"""




   def __init__(		self					,				lowerCamelCase_					,				lowerCamelCase_=1.2					,				lowerCamelCase_="g"					,				lowerCamelCase_=0.5					,				lowerCamelCase_="-"					,				lowerCamelCase_="test_out.jpg"					,				lowerCamelCase_=True					,				lowerCamelCase_=False					,				lowerCamelCase_=None					,				lowerCamelCase_=None					,				lowerCamelCase_=0.7					,				)							->      str:
       if isinstance(lowerCamelCase_					,				torch.Tensor):
           UpperCamelCase										=  img.numpy().astype('''np.uint8''')
       if isinstance(lowerCamelCase_					,				lowerCamelCase_):
           UpperCamelCase										=  img_tensorize(lowerCamelCase_)
       assert isinstance(lowerCamelCase_					,				np.ndarray)

       UpperCamelCase					,  UpperCamelCase										=  img.shape[1], img.shape[0]
       UpperCamelCase										=  mplfigure.Figure(frameon=lowerCamelCase_)
       UpperCamelCase										=  fig.get_dpi()
       UpperCamelCase										=  (width * scale + 1e-2) / dpi
       UpperCamelCase										=  (height * scale + 1e-2) / dpi
       fig.set_size_inches(lowerCamelCase_					,				lowerCamelCase_)
       UpperCamelCase										=  fig.add_axes([0.0, 0.0, 1.0, 1.0])
       ax.axis('''off''')
       ax.set_xlim(0.0					,				lowerCamelCase_)
       ax.set_ylim(lowerCamelCase_)

       UpperCamelCase										=  saveas
       UpperCamelCase										=  rgb
       UpperCamelCase										=  pynb
       UpperCamelCase										=  img
       UpperCamelCase										=  edgecolor
       UpperCamelCase										=  0.5
       UpperCamelCase										=  linestyle
       UpperCamelCase										=  int(np.sqrt(min(lowerCamelCase_					,				lowerCamelCase_)) * scale // 3)
       UpperCamelCase										=  width
       UpperCamelCase										=  height
       UpperCamelCase										=  scale
       UpperCamelCase										=  fig
       UpperCamelCase										=  ax
       UpperCamelCase										=  pad
       UpperCamelCase										=  idaobj
       UpperCamelCase										=  idaattr
       UpperCamelCase										=  FigureCanvasAgg(lowerCamelCase_)







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_					,				lowerCamelCase_=None)							->      str:
       if color is None:
           UpperCamelCase										=  self.edgecolor
       ((UpperCamelCase)					,  (UpperCamelCase)					,  (UpperCamelCase)					,  (UpperCamelCase))										=  box
       UpperCamelCase										=  xa - xa
       UpperCamelCase										=  ya - ya
       self.ax.add_patch(
           mpl.patches.Rectangle(
               (xa, ya)					,				lowerCamelCase_					,				lowerCamelCase_					,				fill=lowerCamelCase_					,				edgecolor=lowerCamelCase_					,				linewidth=self.font_size // 3					,				alpha=self.alpha					,				linestyle=self.linestyle					,				))







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_					,				lowerCamelCase_=None					,				lowerCamelCase_=None					,				lowerCamelCase_=None					,				lowerCamelCase_=None)							->      Dict:
       if len(boxes.shape) > 2:
           UpperCamelCase										=  boxes[0]
       if len(obj_ids.shape) > 1:
           UpperCamelCase										=  obj_ids[0]
       if len(obj_scores.shape) > 1:
           UpperCamelCase										=  obj_scores[0]
       if len(attr_ids.shape) > 1:
           UpperCamelCase										=  attr_ids[0]
       if len(attr_scores.shape) > 1:
           UpperCamelCase										=  attr_scores[0]
       if isinstance(lowerCamelCase_					,				torch.Tensor):
           UpperCamelCase										=  boxes.numpy()
       if isinstance(lowerCamelCase_					,				lowerCamelCase_):
           UpperCamelCase										=  np.array(lowerCamelCase_)
       assert isinstance(lowerCamelCase_					,				np.ndarray)
       UpperCamelCase										=  np.prod(boxes[:, 2:] - boxes[:, :2]					,				axis=1)
       UpperCamelCase										=  np.argsort(-areas).tolist()
       UpperCamelCase										=  boxes[sorted_idxs] if boxes is not None else None
       UpperCamelCase										=  obj_ids[sorted_idxs] if obj_ids is not None else None
       UpperCamelCase										=  obj_scores[sorted_idxs] if obj_scores is not None else None
       UpperCamelCase										=  attr_ids[sorted_idxs] if attr_ids is not None else None
       UpperCamelCase										=  attr_scores[sorted_idxs] if attr_scores is not None else None

       UpperCamelCase										=  [self._random_color(maximum=1) for _ in range(len(lowerCamelCase_))]
       UpperCamelCase										=  [assigned_colors[idx] for idx in sorted_idxs]
       if obj_ids is not None:
           UpperCamelCase										=  self._create_text_labels_attr(lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_)
           for i in range(len(lowerCamelCase_)):
               UpperCamelCase										=  assigned_colors[i]
               self.add_box(boxes[i]					,				lowerCamelCase_)
               self.draw_labels(labels[i]					,				boxes[i]					,				lowerCamelCase_)







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_)							->      List[Any]:
       UpperCamelCase					,  UpperCamelCase					,  UpperCamelCase					,  UpperCamelCase										=  box
       UpperCamelCase										=  (xa, ya)
       UpperCamelCase										=  (ya - ya) * (xa - xa)
       UpperCamelCase										=  _SMALL_OBJ * self.scale
       if instance_area < small or ya - ya < 4_0 * self.scale:
           if ya >= self.height - 5:
               UpperCamelCase										=  (xa, ya)
           else:
               UpperCamelCase										=  (xa, ya)

       UpperCamelCase										=  (ya - ya) / np.sqrt(self.height * self.width)
       UpperCamelCase										=  self._change_color_brightness(lowerCamelCase_					,				brightness_factor=0.7)
       UpperCamelCase										=  np.clip((height_ratio - 0.02) / 0.08 + 1					,				1.2					,				2)
       font_size *= 0.75 * self.font_size

       self.draw_text(
           text=lowerCamelCase_					,				position=lowerCamelCase_					,				color=lowerCamelCase_					,				)







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_="g"					,				lowerCamelCase_="left"					,				)							->      Union[str, Any]:
       UpperCamelCase										=  0
       UpperCamelCase										=  self.font_size
       UpperCamelCase										=  np.maximum(list(mplc.to_rgb(lowerCamelCase_))					,				0.2)
       UpperCamelCase										=  max(0.8					,				np.max(lowerCamelCase_))
       UpperCamelCase										=  {
           '''facecolor''': '''black''',
           '''alpha''': self.alpha,
           '''pad''': self.pad,
           '''edgecolor''': '''none''',
       }
       UpperCamelCase					,  UpperCamelCase										=  position
       self.ax.text(
           lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_					,				size=font_size * self.scale					,				family='''sans-serif'''					,				bbox=lowerCamelCase_					,				verticalalignment='''top'''					,				horizontalalignment=lowerCamelCase_					,				color=lowerCamelCase_					,				zorder=1_0					,				rotation=lowerCamelCase_					,				)







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_=None)							->      Optional[int]:
       if saveas is None:
           UpperCamelCase										=  self.saveas
       if saveas.lower().endswith('''.jpg''') or saveas.lower().endswith('''.png'''):
           cva.imwrite(
               lowerCamelCase_					,				self._get_buffer()[:, :, ::-1]					,				)
       else:
           self.fig.savefig(lowerCamelCase_)







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_)							->      Any:
       UpperCamelCase										=  [self.idaobj[i] for i in classes]
       UpperCamelCase										=  [self.idaattr[i] for i in attr_classes]
       UpperCamelCase										=  [
           F'{label} {score:.2f} {attr} {attr_score:.2f}'
           for label, score, attr, attr_score in zip(lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_					,				lowerCamelCase_)
       ]
       return labels







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_					,				lowerCamelCase_)							->      List[str]:
       UpperCamelCase										=  [self.idaobj[i] for i in classes]
       if scores is not None:
           if labels is None:
               UpperCamelCase										=  ['''{:.0f}%'''.format(s * 1_0_0) for s in scores]
           else:
               UpperCamelCase										=  ['''{} {:.0f}%'''.format(lowerCamelCase_					,				s * 1_0_0) for li, s in zip(lowerCamelCase_					,				lowerCamelCase_)]
       return labels







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_=2_5_5)							->      Optional[int]:
       UpperCamelCase										=  np.random.randint(0					,				len(_COLORS))
       UpperCamelCase										=  _COLORS[idx] * maximum
       if not self.rgb:
           UpperCamelCase										=  ret[::-1]
       return ret







   def      UpperCAmelCase__ (		self)							->      Dict:
       if not self.pynb:
           UpperCamelCase					,  UpperCamelCase										=  self.canvas.print_to_buffer()
           if (width, height) != (self.width, self.height):
               UpperCamelCase										=  cva.resize(self.img					,				(width, height))
           else:
               UpperCamelCase										=  self.img
       else:
           UpperCamelCase										=  io.BytesIO()  # works for cairo backend
           self.canvas.print_rgba(lowerCamelCase_)
           UpperCamelCase					,  UpperCamelCase										=  self.width, self.height
           UpperCamelCase										=  buf.getvalue()
           UpperCamelCase										=  self.img

       UpperCamelCase										=  np.frombuffer(lowerCamelCase_					,				dtype='''uint8''')
       UpperCamelCase										=  buffer.reshape(lowerCamelCase_					,				lowerCamelCase_					,				4)
       UpperCamelCase					,  UpperCamelCase										=  np.split(lowerCamelCase_					,				[3]					,				axis=2)

       try:
           import numexpr as ne  # fuse them with numexpr

           UpperCamelCase										=  ne.evaluate('''img * (1 - alpha / 255.0) + rgb * (alpha / 255.0)''')
       except ImportError:
           UpperCamelCase										=  alpha.astype('''float32''') / 255.0
           UpperCamelCase										=  img * (1 - alpha) + rgb * alpha

       return visualized_image.astype('''uint8''')







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_					,				lowerCamelCase_)							->      Optional[Any]:
       assert brightness_factor >= -1.0 and brightness_factor <= 1.0
       UpperCamelCase										=  mplc.to_rgb(lowerCamelCase_)
       UpperCamelCase										=  colorsys.rgb_to_hls(*mplc.to_rgb(lowerCamelCase_))
       UpperCamelCase										=  polygon_color[1] + (brightness_factor * polygon_color[1])
       UpperCamelCase										=  0.0 if modified_lightness < 0.0 else modified_lightness
       UpperCamelCase										=  1.0 if modified_lightness > 1.0 else modified_lightness
       UpperCamelCase										=  colorsys.hls_to_rgb(polygon_color[0]					,				lowerCamelCase_					,				polygon_color[2])
       return modified_color
SCREAMING_SNAKE_CASE_      =					(
    np.array(
        [
            0.000,
            0.447,
            0.741,
            0.850,
            0.325,
            0.098,
            0.929,
            0.694,
            0.125,
            0.494,
            0.184,
            0.556,
            0.466,
            0.674,
            0.188,
            0.301,
            0.745,
            0.933,
            0.635,
            0.078,
            0.184,
            0.300,
            0.300,
            0.300,
            0.600,
            0.600,
            0.600,
            1.000,
            0.000,
            0.000,
            1.000,
            0.500,
            0.000,
            0.749,
            0.749,
            0.000,
            0.000,
            1.000,
            0.000,
            0.000,
            0.000,
            1.000,
            0.667,
            0.000,
            1.000,
            0.333,
            0.333,
            0.000,
            0.333,
            0.667,
            0.000,
            0.333,
            1.000,
            0.000,
            0.667,
            0.333,
            0.000,
            0.667,
            0.667,
            0.000,
            0.667,
            1.000,
            0.000,
            1.000,
            0.333,
            0.000,
            1.000,
            0.667,
            0.000,
            1.000,
            1.000,
            0.000,
            0.000,
            0.333,
            0.500,
            0.000,
            0.667,
            0.500,
            0.000,
            1.000,
            0.500,
            0.333,
            0.000,
            0.500,
            0.333,
            0.333,
            0.500,
            0.333,
            0.667,
            0.500,
            0.333,
            1.000,
            0.500,
            0.667,
            0.000,
            0.500,
            0.667,
            0.333,
            0.500,
            0.667,
            0.667,
            0.500,
            0.667,
            1.000,
            0.500,
            1.000,
            0.000,
            0.500,
            1.000,
            0.333,
            0.500,
            1.000,
            0.667,
            0.500,
            1.000,
            1.000,
            0.500,
            0.000,
            0.333,
            1.000,
            0.000,
            0.667,
            1.000,
            0.000,
            1.000,
            1.000,
            0.333,
            0.000,
            1.000,
            0.333,
            0.333,
            1.000,
            0.333,
            0.667,
            1.000,
            0.333,
            1.000,
            1.000,
            0.667,
            0.000,
            1.000,
            0.667,
            0.333,
            1.000,
            0.667,
            0.667,
            1.000,
            0.667,
            1.000,
            1.000,
            1.000,
            0.000,
            1.000,
            1.000,
            0.333,
            1.000,
            1.000,
            0.667,
            1.000,
            0.333,
            0.000,
            0.000,
            0.500,
            0.000,
            0.000,
            0.667,
            0.000,
            0.000,
            0.833,
            0.000,
            0.000,
            1.000,
            0.000,
            0.000,
            0.000,
            0.167,
            0.000,
            0.000,
            0.333,
            0.000,
            0.000,
            0.500,
            0.000,
            0.000,
            0.667,
            0.000,
            0.000,
            0.833,
            0.000,
            0.000,
            1.000,
            0.000,
            0.000,
            0.000,
            0.167,
            0.000,
            0.000,
            0.333,
            0.000,
            0.000,
            0.500,
            0.000,
            0.000,
            0.667,
            0.000,
            0.000,
            0.833,
            0.000,
            0.000,
            1.000,
            0.000,
            0.000,
            0.000,
            0.143,
            0.143,
            0.143,
            0.857,
            0.857,
            0.857,
            1.000,
            1.000,
            1.000,
        ]
    )
    .astype(np.floataa)
    .reshape(-1, 3)
)





"""simple docstring"""







import unittest

from transformers import ErnieMTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin


SCREAMING_SNAKE_CASE_      =					get_tests_dir('fixtures/spiece.model')

@require_sentencepiece
@require_tokenizers
class 							snake_case_ (				lowerCamelCase_  ,   unittest.TestCase ):







   """simple docstring"""




   A_										=					ErnieMTokenizer
   A_										=					False
   A_										=					True
   A_										=					False
   A_										=					False







   def      UpperCAmelCase__ (		self)							->      List[str]:
       super().setUp()

       # We have a SentencePiece fixture for testing
       UpperCamelCase										=  ErnieMTokenizer(lowerCamelCase_					,				unk_token='''<unk>'''					,				pad_token='''<pad>''')
       tokenizer.save_pretrained(self.tmpdirname)







   def      UpperCAmelCase__ (		self					,				lowerCamelCase_)							->      Optional[Any]:
       UpperCamelCase										=  '''this is a test'''
       UpperCamelCase										=  '''this is a test'''
       return input_text, output_text







   def      UpperCAmelCase__ (		self)							->      Optional[Any]:
       UpperCamelCase										=  '''<pad>'''
       UpperCamelCase										=  0

       self.assertEqual(self.get_tokenizer()._convert_token_to_id(lowerCamelCase_)					,				lowerCamelCase_)
       self.assertEqual(self.get_tokenizer()._convert_id_to_token(lowerCamelCase_)					,				lowerCamelCase_)







   def      UpperCAmelCase__ (		self)							->      Optional[Any]:
       UpperCamelCase										=  list(self.get_tokenizer().get_vocab().keys())

       self.assertEqual(vocab_keys[0]					,				'''<pad>''')
       self.assertEqual(vocab_keys[1]					,				'''<unk>''')
       self.assertEqual(vocab_keys[-1]					,				'''▁eloquent''')
       self.assertEqual(len(lowerCamelCase_)					,				3_0_0_0_0)







   def      UpperCAmelCase__ (		self)							->      int:
       self.assertEqual(self.get_tokenizer().vocab_size					,				3_0_0_0_0)







   def      UpperCAmelCase__ (		self)							->      List[Any]:
       if not self.test_rust_tokenizer:
           return

       UpperCamelCase										=  self.get_tokenizer()
       UpperCamelCase										=  self.get_rust_tokenizer()

       UpperCamelCase										=  '''I was born in 92000, and this is falsé.'''

       UpperCamelCase										=  tokenizer.tokenize(lowerCamelCase_)
       UpperCamelCase										=  rust_tokenizer.tokenize(lowerCamelCase_)
       self.assertListEqual(lowerCamelCase_					,				lowerCamelCase_)

       UpperCamelCase										=  tokenizer.encode(lowerCamelCase_					,				add_special_tokens=lowerCamelCase_)
       UpperCamelCase										=  rust_tokenizer.encode(lowerCamelCase_					,				add_special_tokens=lowerCamelCase_)
       self.assertListEqual(lowerCamelCase_					,				lowerCamelCase_)

       UpperCamelCase										=  self.get_rust_tokenizer()
       UpperCamelCase										=  tokenizer.encode(lowerCamelCase_)
       UpperCamelCase										=  rust_tokenizer.encode(lowerCamelCase_)
       self.assertListEqual(lowerCamelCase_					,				lowerCamelCase_)







   def      UpperCAmelCase__ (		self)							->      List[Any]:
       UpperCamelCase										=  ErnieMTokenizer(lowerCamelCase_					,				do_lower_case=lowerCamelCase_					,				unk_token='''<unk>'''					,				pad_token='''<pad>''')

       UpperCamelCase										=  tokenizer.tokenize('''This is a test''')
       self.assertListEqual(lowerCamelCase_					,				['''▁this''', '''▁is''', '''▁a''', '''▁test'''])

       self.assertListEqual(tokenizer.convert_tokens_to_ids(lowerCamelCase_)					,				[4_8, 2_5, 2_1, 1_2_8_9])

       UpperCamelCase										=  tokenizer.tokenize('''I was born in 92000, and this is falsé.''')
       # ErnieMTokenizer(paddlenlp implementation) outputs '9' instead of '_9' so to mimic that '_9' is changed to '9'
       self.assertListEqual(
           lowerCamelCase_					,				['''▁i''', '''▁was''', '''▁born''', '''▁in''', '''9''', '''2000''', ''',''', '''▁and''', '''▁this''', '''▁is''', '''▁fal''', '''s''', '''é''', '''.'''])
       UpperCamelCase										=  tokenizer.convert_tokens_to_ids(lowerCamelCase_)
       self.assertListEqual(lowerCamelCase_					,				[3_1, 2_3, 3_8_6, 1_9, 5_1_8, 3_0_5_0, 1_5, 1_7, 4_8, 2_5, 8_2_5_6, 1_8, 1, 9])

       UpperCamelCase										=  tokenizer.convert_ids_to_tokens(lowerCamelCase_)
       self.assertListEqual(
           lowerCamelCase_					,				['''▁i''', '''▁was''', '''▁born''', '''▁in''', '''9''', '''2000''', ''',''', '''▁and''', '''▁this''', '''▁is''', '''▁fal''', '''s''', '''<unk>''', '''.''']					,				)







   def      UpperCAmelCase__ (		self)							->      Dict:
       UpperCamelCase										=  ErnieMTokenizer(lowerCamelCase_					,				unk_token='''<unk>'''					,				pad_token='''<pad>''')

       UpperCamelCase										=  tokenizer.encode('''sequence builders''')
       UpperCamelCase										=  tokenizer.encode('''multi-sequence build''')

       UpperCamelCase										=  tokenizer.build_inputs_with_special_tokens(lowerCamelCase_)
       UpperCamelCase										=  tokenizer.build_inputs_with_special_tokens(lowerCamelCase_					,				lowerCamelCase_)

       assert encoded_sentence == [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id]
       assert encoded_pair == [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id] + [
           tokenizer.sep_token_id
       ] + text_a + [tokenizer.sep_token_id]







   @slow
   def      UpperCAmelCase__ (		self)							->      List[str]:
       # fmt: off
       UpperCamelCase										=  {'''input_ids''': [[0, 1_1_0_6_2, 8_2_7_7_2, 7, 1_5, 8_2_7_7_2, 5_3_8, 5_1_5_2_9, 2_3_7, 1_7_1_9_8, 1_2_9_0, 2_0_6, 9, 2_1_5_1_7_5, 1_3_1_4, 1_3_6, 1_7_1_9_8, 1_2_9_0, 2_0_6, 9, 5_6_3_5_9, 4_2, 1_2_2_0_0_9, 9, 1_6_4_6_6, 1_6, 8_7_3_4_4, 4_5_3_7, 9, 4_7_1_7, 7_8_3_8_1, 6, 1_5_9_9_5_8, 7, 1_5, 2_4_4_8_0, 6_1_8, 4, 5_2_7, 2_2_6_9_3, 9, 3_0_4, 4, 2_7_7_7, 2_4_4_8_0, 9_8_7_4, 4, 4_3_5_2_3, 5_9_4, 4, 8_0_3, 1_8_3_9_2, 3_3_1_8_9, 1_8, 4, 4_3_5_2_3, 2_4_4_4_7, 5, 5, 5, 1_6, 1_0_0, 2_4_9_5_5, 8_3_6_5_8, 9_6_2_6, 1_4_4_0_5_7, 1_5, 8_3_9, 2_2_3_3_5, 1_6, 1_3_6, 2_4_9_5_5, 8_3_6_5_8, 8_3_4_7_9, 1_5, 3_9_1_0_2, 7_2_4, 1_6, 6_7_8, 6_4_5, 6_4_6_0, 1_3_2_8, 4_5_8_9, 4_2, 1_2_2_0_0_9, 1_1_5_7_7_4, 2_3, 3_5_5_9, 1_3_2_8, 4_6_8_7_6, 7, 1_3_6, 5_3_8_9_4, 1_9_4_0, 4_2_2_2_7, 4_1_1_5_9, 1_7_7_2_1, 8_2_3, 4_2_5, 4, 2_7_5_1_2, 9_8_7_2_2, 2_0_6, 1_3_6, 5_5_3_1, 4_9_7_0, 9_1_9, 1_7_3_3_6, 5, 2], [0, 2_0_0_8_0, 6_1_8, 8_3, 8_2_7_7_5, 4_7, 4_7_9, 9, 1_5_1_7, 7_3, 5_3_8_9_4, 3_3_3, 8_0_5_8_1, 1_1_0_1_1_7, 1_8_8_1_1, 5_2_5_6, 1_2_9_5, 5_1, 1_5_2_5_2_6, 2_9_7, 7_9_8_6, 3_9_0, 1_2_4_4_1_6, 5_3_8, 3_5_4_3_1, 2_1_4, 9_8, 1_5_0_4_4, 2_5_7_3_7, 1_3_6, 7_1_0_8, 4_3_7_0_1, 2_3, 7_5_6, 1_3_5_3_5_5, 7, 5, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 5_8_1, 6_3_7_7_3, 1_1_9_4_5_5, 6, 1_4_7_7_9_7, 8_8_2_0_3, 7, 6_4_5, 7_0, 2_1, 3_2_8_5, 1_0_2_6_9, 5, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]}
       # fmt: on

       self.tokenizer_integration_test_util(
           expected_encoding=lowerCamelCase_					,				model_name='''susnato/ernie-m-base_pytorch'''					,				sequences=[
               '''Transformers (formerly known as pytorch-transformers and pytorch-pretrained-bert) provides '''
               '''general-purpose architectures (BERT, GPT-2, RoBERTa, XLM, DistilBert, XLNet...) for Natural '''
               '''Language Understanding (NLU) and Natural Language Generation (NLG) with over32+ pretrained '''
               '''models in100+ languages and deep interoperability between Jax, PyTorch and TensorFlow.''',
               '''BERT is designed to pre-train deep bidirectional representations from unlabeled text by jointly '''
               '''conditioning on both left and right context in all layers.''',
               '''The quick brown fox jumps over the lazy dog.''',
           ]					,				)