"""simple docstring"""






import time
from dataclasses import dataclass
from multiprocessing import Pool
from unittest import TestCase
from unittest.mock import patch

import multiprocess
import numpy as np
import pytest

from datasets.utils.py_utils import (
    NestedDataStructure,
    asdict,
    iflatmap_unordered,
    map_nested,
    temp_seed,
    temporary_assignment,
    zip_dict,
)

from .utils import require_tf, require_torch


def     UpperCAmelCase__ (       lowerCAmelCase__  :Optional[int]	)				->					Dict:  # picklable for multiprocessing
      '''simple docstring'''


      return x.sum()


def     UpperCAmelCase__ (       lowerCAmelCase__  :str	)				->					Any:  # picklable for multiprocessing
      '''simple docstring'''


      return i + 1





@dataclass
class 				_A		:
      snake_case__    :     int
      snake_case__    :     str






class 				_A		( lowerCAmelCase			):

      def        A__ (		self		):







            """simple docstring"""



            lowercase														=			{}
            lowercase														=			[]
            lowercase														=			1
            lowercase														=			[1, 2]
            lowercase														=			{"""a""": 1, """b""": 2}
            lowercase														=			{"""a""": [1, 2], """b""": [3, 4]}
            lowercase														=			{"""a""": {"""1""": 1}, """b""": 2}
            lowercase														=			{"""a""": 1, """b""": 2, """c""": 3, """d""": 4}
            lowercase														=			{}
            lowercase														=			[]
            lowercase														=			2
            lowercase														=			[2, 3]
            lowercase														=			{"""a""": 2, """b""": 3}
            lowercase														=			{"""a""": [2, 3], """b""": [4, 5]}
            lowercase														=			{"""a""": {"""1""": 2}, """b""": 3}
            lowercase														=			{"""a""": 2, """b""": 3, """c""": 4, """d""": 5}
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase		)	, __lowerCAmelCase		)

            lowercase														=			2
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)

            lowercase														=			{"""a""": np.eye(2		), """b""": np.zeros(3		), """c""": np.ones(2		)}
            lowercase														=			{"""a""": 2, """b""": 0, """c""": 2}
            lowercase														=			{
                """a""": np.eye(2		).astype(__lowerCAmelCase		),
                """b""": np.zeros(3		).astype(__lowerCAmelCase		),
                """c""": np.ones(2		).astype(__lowerCAmelCase		),
            }
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, map_numpy=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(
                {k: v.tolist() for k, v in map_nested(__lowerCAmelCase	, __lowerCAmelCase	, map_numpy=__lowerCAmelCase		).items()}	, {k: v.tolist() for k, v in expected_map_nested_sna_int.items()}	, )
            self.assertEqual(map_nested(__lowerCAmelCase	, __lowerCAmelCase	, map_numpy=__lowerCAmelCase	, num_proc=__lowerCAmelCase		)	, __lowerCAmelCase		)
            self.assertEqual(
                {k: v.tolist() for k, v in map_nested(__lowerCAmelCase	, __lowerCAmelCase	, map_numpy=__lowerCAmelCase	, num_proc=__lowerCAmelCase		).items()}	, {k: v.tolist() for k, v in expected_map_nested_sna_int.items()}	, )
            with self.assertRaises(__lowerCAmelCase		):  # can't pickle a local lambda
                  map_nested(lambda __lowerCAmelCase		: x + 1	, __lowerCAmelCase	, num_proc=__lowerCAmelCase		)

      def        A__ (		self		):







            """simple docstring"""



            lowercase														=			{"""a""": 1, """b""": 2}
            lowercase														=			{"""a""": 3, """b""": 4}
            lowercase														=			{"""a""": 5, """b""": 6}
            lowercase														=			sorted([("""a""", (1, 3, 5)), ("""b""", (2, 4, 6))]		)
            self.assertEqual(sorted(zip_dict(__lowerCAmelCase	, __lowerCAmelCase	, __lowerCAmelCase		)		)	, __lowerCAmelCase		)







      def        A__ (		self		):







            """simple docstring"""



            class 				_A		:
                  snake_case__    :     List[Any]													=			'bar'






            lowercase														=			Foo()
            self.assertEqual(foo.my_attr	, """bar"""		)
            with temporary_assignment(__lowerCAmelCase	, """my_attr"""	, """BAR"""		):
                  self.assertEqual(foo.my_attr	, """BAR"""		)
            self.assertEqual(foo.my_attr	, """bar"""		)






@pytest.mark.parametrize(
    """iterable_length, num_proc, expected_num_proc"""      ,	[
        (1, None, 1),
        (1, 1, 1),
        (2, None, 1),
        (2, 1, 1),
        (2, 2, 1),
        (2, 3, 1),
        (3, 2, 1),
        (1_6, 1_6, 1_6),
        (1_6, 1_7, 1_6),
        (1_7, 1_6, 1_6),
    ]      ,	)
def     UpperCAmelCase__ (       lowerCAmelCase__  :Optional[Any]      ,	lowerCAmelCase__  :Any      ,	lowerCAmelCase__  :Optional[int]	)				->					Tuple:
      '''simple docstring'''


      with patch("""datasets.utils.py_utils._single_map_nested"""	) as mock_single_map_nested, patch(
          """datasets.parallel.parallel.Pool"""	) as mock_multiprocessing_pool:
            lowercase														=			{f'{i}': i for i in range(lowerCAmelCase__	)}
            lowercase														=			map_nested(lambda lowerCAmelCase__	: x + 1_0      ,	lowerCAmelCase__      ,	num_proc=lowerCAmelCase__      ,	parallel_min_length=1_6	)
            if expected_num_proc == 1:
                  assert mock_single_map_nested.called
                  assert not mock_multiprocessing_pool.called
            else:
                  assert not mock_single_map_nested.called
                  assert mock_multiprocessing_pool.called
                  assert mock_multiprocessing_pool.call_args[0][0] == expected_num_proc





class 				_A		( lowerCAmelCase			):

      @require_tf
      def        A__ (		self		):







            """simple docstring"""



            import tensorflow as tf
            from tensorflow.keras import layers

            lowercase														=			layers.Dense(2		)

            def gen_random_output():
                  lowercase														=			tf.random.uniform((1, 3)		)
                  return model(__lowerCAmelCase		).numpy()

            with temp_seed(42	, set_tensorflow=__lowerCAmelCase		):
                  lowercase														=			gen_random_output()
            with temp_seed(42	, set_tensorflow=__lowerCAmelCase		):
                  lowercase														=			gen_random_output()
            lowercase														=			gen_random_output()

            np.testing.assert_equal(__lowerCAmelCase	, __lowerCAmelCase		)
            self.assertGreater(np.abs(outa - outa		).sum()	, 0		)

      @require_torch
      def        A__ (		self		):







            """simple docstring"""



            import torch

            def gen_random_output():
                  lowercase														=			torch.nn.Linear(3	, 2		)
                  lowercase														=			torch.rand(1	, 3		)
                  return model(__lowerCAmelCase		).detach().numpy()

            with temp_seed(42	, set_pytorch=__lowerCAmelCase		):
                  lowercase														=			gen_random_output()
            with temp_seed(42	, set_pytorch=__lowerCAmelCase		):
                  lowercase														=			gen_random_output()
            lowercase														=			gen_random_output()

            np.testing.assert_equal(__lowerCAmelCase	, __lowerCAmelCase		)
            self.assertGreater(np.abs(outa - outa		).sum()	, 0		)







      def        A__ (		self		):







            """simple docstring"""



            def gen_random_output():
                  return np.random.rand(1	, 3		)

            with temp_seed(42		):
                  lowercase														=			gen_random_output()
            with temp_seed(42		):
                  lowercase														=			gen_random_output()
            lowercase														=			gen_random_output()

            np.testing.assert_equal(__lowerCAmelCase	, __lowerCAmelCase		)
            self.assertGreater(np.abs(outa - outa		).sum()	, 0		)






@pytest.mark.parametrize("""input_data"""      ,	[{}]	)
def     UpperCAmelCase__ (       lowerCAmelCase__  :Optional[Any]	)				->					str:
      '''simple docstring'''


      lowercase														=			NestedDataStructure(lowerCAmelCase__	).data
      assert output_data == input_data


@pytest.mark.parametrize(
    """data, expected_output"""      ,	[
        ({}, []),
        ([], []),
        ("""foo""", ["""foo"""]),
        (["""foo""", """bar"""], ["""foo""", """bar"""]),
        ([["""foo""", """bar"""]], ["""foo""", """bar"""]),
        ([[["""foo"""], ["""bar"""]]], ["""foo""", """bar"""]),
        ([[["""foo"""], """bar"""]], ["""foo""", """bar"""]),
        ({"""a""": 1, """b""": 2}, [1, 2]),
        ({"""a""": [1, 2], """b""": [3, 4]}, [1, 2, 3, 4]),
        ({"""a""": [[1, 2]], """b""": [[3, 4]]}, [1, 2, 3, 4]),
        ({"""a""": [[1, 2]], """b""": [3, 4]}, [1, 2, 3, 4]),
        ({"""a""": [[[1], [2]]], """b""": [[[3], [4]]]}, [1, 2, 3, 4]),
        ({"""a""": [[[1], [2]]], """b""": [[3, 4]]}, [1, 2, 3, 4]),
        ({"""a""": [[[1], [2]]], """b""": [3, 4]}, [1, 2, 3, 4]),
        ({"""a""": [[[1], [2]]], """b""": [3, [4]]}, [1, 2, 3, 4]),
        ({"""a""": {"""1""": 1}, """b""": 2}, [1, 2]),
        ({"""a""": {"""1""": [1]}, """b""": 2}, [1, 2]),
        ({"""a""": {"""1""": [1]}, """b""": [2]}, [1, 2]),
    ]      ,	)
def     UpperCAmelCase__ (       lowerCAmelCase__  :Any      ,	lowerCAmelCase__  :List[Any]	)				->					List[Any]:
      '''simple docstring'''


      lowercase														=			NestedDataStructure(lowerCAmelCase__	).flatten()
      assert output == expected_output


def     UpperCAmelCase__ (       )				->					List[Any]:
      '''simple docstring'''


      lowercase														=			A(x=1      ,	y="""foobar"""	)
      lowercase														=			{"""x""": 1, """y""": """foobar"""}
      assert asdict(lowerCAmelCase__	) == expected_output

      lowercase														=			{"""a""": {"""b""": A(x=1_0      ,	y="""foo"""	)}, """c""": [A(x=2_0      ,	y="""bar"""	)]}
      lowercase														=			{"""a""": {"""b""": {"""x""": 1_0, """y""": """foo"""}}, """c""": [{"""x""": 2_0, """y""": """bar"""}]}
      assert asdict(lowerCAmelCase__	) == expected_output

      with pytest.raises(lowerCAmelCase__	):
            asdict([1, A(x=1_0      ,	y="""foo"""	)]	)


def     UpperCAmelCase__ (       lowerCAmelCase__  :str	)				->					Optional[int]:
      '''simple docstring'''


      return text.split()


def     UpperCAmelCase__ (       lowerCAmelCase__  :str	)				->					List[Any]:
      '''simple docstring'''


      yield (time.time(), content)
      time.sleep(2	)
      yield (time.time(), content)






def     UpperCAmelCase__ (       )				->					str:
      '''simple docstring'''


      with Pool(2	) as pool:
            lowercase														=			list(iflatmap_unordered(lowerCAmelCase__      ,	_split_text      ,	kwargs_iterable=[{"""text""": """hello there"""}] * 1_0	)	)
            assert out.count("""hello"""	) == 1_0
            assert out.count("""there"""	) == 1_0
            assert len(lowerCAmelCase__	) == 2_0

      # check multiprocess from pathos (uses dill for pickling)
      with multiprocess.Pool(2	) as pool:
            lowercase														=			list(iflatmap_unordered(lowerCAmelCase__      ,	_split_text      ,	kwargs_iterable=[{"""text""": """hello there"""}] * 1_0	)	)
            assert out.count("""hello"""	) == 1_0
            assert out.count("""there"""	) == 1_0
            assert len(lowerCAmelCase__	) == 2_0

      # check that we get items as fast as possible
      with Pool(2	) as pool:
            lowercase														=			[]
            for yield_time, content in iflatmap_unordered(
                lowerCAmelCase__      ,	_aseconds_generator_of_aitems_with_timing      ,	kwargs_iterable=[{"""content""": """a"""}, {"""content""": """b"""}]	):
                  assert yield_time < time.time() + 0.1, "we should each item directly after it was yielded"
                  out.append(lowerCAmelCase__	)
            assert out.count("""a"""	) == 2
            assert out.count("""b"""	) == 2
            assert len(lowerCAmelCase__	) == 4




"""simple docstring"""






import unittest

from transformers import (
    MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
    TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
    TextClassificationPipeline,
    pipeline,
)
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow

from .test_pipelines_common import ANY


# These 2 model types require different inputs than those of the usual text models.
__lowerCAmelCase					: int        ={"""LayoutLMv2Config""", """LayoutLMv3Config"""}





@is_pipeline_test
class 				_A		( unittest.TestCase			):
      snake_case__    :     Optional[int]													=			MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING
      snake_case__    :     str													=			TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING

      if model_mapping is not None:
            snake_case__    :     Optional[Any]													=			{config: model for config, model in model_mapping.items() if config.__name__ not in _TO_SKIP}
      if tf_model_mapping is not None:
            snake_case__    :     List[Any]													=			{
                config: model for config, model in tf_model_mapping.items() if config.__name__ not in _TO_SKIP
            }

      @require_torch
      def        A__ (		self		):







            """simple docstring"""



            lowercase														=			pipeline(
                task="""text-classification"""	, model="""hf-internal-testing/tiny-random-distilbert"""	, framework="""pt"""		)

            lowercase														=			text_classifier("""This is great !"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """LABEL_0""", """score""": 0.5_0_4}]		)

            lowercase														=			text_classifier("""This is great !"""	, top_k=2		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [{"""label""": """LABEL_0""", """score""": 0.5_0_4}, {"""label""": """LABEL_1""", """score""": 0.4_9_6}]		)

            lowercase														=			text_classifier(["""This is great !""", """This is bad"""]	, top_k=2		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [
                    [{"""label""": """LABEL_0""", """score""": 0.5_0_4}, {"""label""": """LABEL_1""", """score""": 0.4_9_6}],
                    [{"""label""": """LABEL_0""", """score""": 0.5_0_4}, {"""label""": """LABEL_1""", """score""": 0.4_9_6}],
                ]	, )

            lowercase														=			text_classifier("""This is great !"""	, top_k=1		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """LABEL_0""", """score""": 0.5_0_4}]		)

            # Legacy behavior
            lowercase														=			text_classifier("""This is great !"""	, return_all_scores=__lowerCAmelCase		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """LABEL_0""", """score""": 0.5_0_4}]		)

            lowercase														=			text_classifier("""This is great !"""	, return_all_scores=__lowerCAmelCase		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [[{"""label""": """LABEL_0""", """score""": 0.5_0_4}, {"""label""": """LABEL_1""", """score""": 0.4_9_6}]]		)

            lowercase														=			text_classifier(["""This is great !""", """Something else"""]	, return_all_scores=__lowerCAmelCase		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [
                    [{"""label""": """LABEL_0""", """score""": 0.5_0_4}, {"""label""": """LABEL_1""", """score""": 0.4_9_6}],
                    [{"""label""": """LABEL_0""", """score""": 0.5_0_4}, {"""label""": """LABEL_1""", """score""": 0.4_9_6}],
                ]	, )

            lowercase														=			text_classifier(["""This is great !""", """Something else"""]	, return_all_scores=__lowerCAmelCase		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [
                    {"""label""": """LABEL_0""", """score""": 0.5_0_4},
                    {"""label""": """LABEL_0""", """score""": 0.5_0_4},
                ]	, )

      @require_torch
      def        A__ (		self		):







            """simple docstring"""



            import torch

            lowercase														=			pipeline(
                task="""text-classification"""	, model="""hf-internal-testing/tiny-random-distilbert"""	, framework="""pt"""	, device=torch.device("""cpu"""		)	, )

            lowercase														=			text_classifier("""This is great !"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """LABEL_0""", """score""": 0.5_0_4}]		)

      @require_tf
      def        A__ (		self		):







            """simple docstring"""



            lowercase														=			pipeline(
                task="""text-classification"""	, model="""hf-internal-testing/tiny-random-distilbert"""	, framework="""tf"""		)

            lowercase														=			text_classifier("""This is great !"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """LABEL_0""", """score""": 0.5_0_4}]		)

      @slow
      @require_torch
      def        A__ (		self		):







            """simple docstring"""



            lowercase														=			pipeline("""text-classification"""		)

            lowercase														=			text_classifier("""This is great !"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """POSITIVE""", """score""": 1.0}]		)
            lowercase														=			text_classifier("""This is bad !"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """NEGATIVE""", """score""": 1.0}]		)
            lowercase														=			text_classifier("""Birds are a type of animal"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """POSITIVE""", """score""": 0.9_8_8}]		)

      @slow
      @require_tf
      def        A__ (		self		):







            """simple docstring"""



            lowercase														=			pipeline("""text-classification"""	, framework="""tf"""		)

            lowercase														=			text_classifier("""This is great !"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """POSITIVE""", """score""": 1.0}]		)
            lowercase														=			text_classifier("""This is bad !"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """NEGATIVE""", """score""": 1.0}]		)
            lowercase														=			text_classifier("""Birds are a type of animal"""		)
            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": """POSITIVE""", """score""": 0.9_8_8}]		)

      def        A__ (		self	, __lowerCAmelCase	, __lowerCAmelCase	, __lowerCAmelCase		):







            """simple docstring"""



            lowercase														=			TextClassificationPipeline(model=__lowerCAmelCase	, tokenizer=__lowerCAmelCase		)
            return text_classifier, ["HuggingFace is in", "This is another test"]







      def        A__ (		self	, __lowerCAmelCase	, __lowerCAmelCase		):







            """simple docstring"""



            lowercase														=			text_classifier.model
            # Small inputs because BartTokenizer tiny has maximum position embeddings = 22
            lowercase														=			"""HuggingFace is in"""
            lowercase														=			text_classifier(__lowerCAmelCase		)

            self.assertEqual(nested_simplify(__lowerCAmelCase		)	, [{"""label""": ANY(__lowerCAmelCase		), """score""": ANY(__lowerCAmelCase		)}]		)
            self.assertTrue(outputs[0]["""label"""] in model.config.idalabel.values()		)

            lowercase														=			["""HuggingFace is in """, """Paris is in France"""]
            lowercase														=			text_classifier(__lowerCAmelCase		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [{"""label""": ANY(__lowerCAmelCase		), """score""": ANY(__lowerCAmelCase		)}, {"""label""": ANY(__lowerCAmelCase		), """score""": ANY(__lowerCAmelCase		)}]	, )
            self.assertTrue(outputs[0]["""label"""] in model.config.idalabel.values()		)
            self.assertTrue(outputs[1]["""label"""] in model.config.idalabel.values()		)

            # Forcing to get all results with `top_k=None`
            # This is NOT the legacy format
            lowercase														=			text_classifier(__lowerCAmelCase	, top_k=__lowerCAmelCase		)
            lowercase														=			len(model.config.idalabel.values()		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [[{"""label""": ANY(__lowerCAmelCase		), """score""": ANY(__lowerCAmelCase		)}] * N, [{"""label""": ANY(__lowerCAmelCase		), """score""": ANY(__lowerCAmelCase		)}] * N]	, )

            lowercase														=			{"""text""": """HuggingFace is in """, """text_pair""": """Paris is in France"""}
            lowercase														=			text_classifier(__lowerCAmelCase		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, {"""label""": ANY(__lowerCAmelCase		), """score""": ANY(__lowerCAmelCase		)}	, )
            self.assertTrue(outputs["""label"""] in model.config.idalabel.values()		)

            # This might be used a text pair, but tokenizer + pipe interaction
            # makes it hard to understand that it's not using the pair properly
            # https://github.com/huggingface/transformers/issues/17305
            # We disabled this usage instead as it was outputting wrong outputs.
            lowercase														=			[["""HuggingFace is in """, """Paris is in France"""]]
            with self.assertRaises(__lowerCAmelCase		):
                  text_classifier(__lowerCAmelCase		)

            # This used to be valid for doing text pairs
            # We're keeping it working because of backward compatibility
            lowercase														=			text_classifier([[["""HuggingFace is in """, """Paris is in France"""]]]		)
            self.assertEqual(
                nested_simplify(__lowerCAmelCase		)	, [{"""label""": ANY(__lowerCAmelCase		), """score""": ANY(__lowerCAmelCase		)}]	, )
            self.assertTrue(outputs[0]["""label"""] in model.config.idalabel.values()		)



