



'''simple docstring'''

import unittest

from transformers import (
    MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
    TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
    Pipeline,
    ZeroShotClassificationPipeline,
    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.
SCREAMING_SNAKE_CASE__     :						List[Any]	=  {'''LayoutLMv2Config''', '''LayoutLMv3Config'''}

@is_pipeline_test
class 							a__( unittest.TestCase     ):
			a_	: str									=      MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING
			a_	: Dict									=      TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING

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






			def 						_lowercase  (     self					,   _UpperCAmelCase					,   _UpperCAmelCase					,   _UpperCAmelCase						)							->							Optional[int]:
					snake_case__	     =ZeroShotClassificationPipeline(
					    model=A_					,   tokenizer=A_					,   candidate_labels=['polics', 'health']						)
					return classifier, ["Who are you voting for in 2020?", "My stomach hurts."]






			def 						_lowercase  (     self					,   _UpperCAmelCase					,   _UpperCAmelCase						)							->							Union[str, Any]:
					snake_case__	     =classifier('Who are you voting for in 2020?'					,   candidate_labels='politics'						)
					self.assertEqual(A_					,   {'sequence': ANY(A_						), 'labels': [ANY(A_						)], 'scores': [ANY(A_						)]}						)

					# No kwarg
					snake_case__	     =classifier('Who are you voting for in 2020?'					,   ['politics']						)
					self.assertEqual(A_					,   {'sequence': ANY(A_						), 'labels': [ANY(A_						)], 'scores': [ANY(A_						)]}						)

					snake_case__	     =classifier('Who are you voting for in 2020?'					,   candidate_labels=['politics']						)
					self.assertEqual(A_					,   {'sequence': ANY(A_						), 'labels': [ANY(A_						)], 'scores': [ANY(A_						)]}						)

					snake_case__	     =classifier('Who are you voting for in 2020?'					,   candidate_labels='politics, public health'						)
					self.assertEqual(
					    A_					,   {'sequence': ANY(A_						), 'labels': [ANY(A_						), ANY(A_						)], 'scores': [ANY(A_						), ANY(A_						)]}						)
					self.assertAlmostEqual(sum(nested_simplify(outputs['scores']						)						)					,   1.0						)

					snake_case__	     =classifier('Who are you voting for in 2020?'					,   candidate_labels=['politics', 'public health']						)
					self.assertEqual(
					    A_					,   {'sequence': ANY(A_						), 'labels': [ANY(A_						), ANY(A_						)], 'scores': [ANY(A_						), ANY(A_						)]}						)
					self.assertAlmostEqual(sum(nested_simplify(outputs['scores']						)						)					,   1.0						)

					snake_case__	     =classifier(
					    'Who are you voting for in 2020?'					,   candidate_labels='politics'					,   hypothesis_template='This text is about {}'						)
					self.assertEqual(A_					,   {'sequence': ANY(A_						), 'labels': [ANY(A_						)], 'scores': [ANY(A_						)]}						)

					# https://github.com/huggingface/transformers/issues/13846
					snake_case__	     =classifier(['I am happy']					,   ['positive', 'negative']						)
					self.assertEqual(
					    A_					,   [
					        {'sequence': ANY(A_						), 'labels': [ANY(A_						), ANY(A_						)], 'scores': [ANY(A_						), ANY(A_						)]}
					        for i in range(1						)
					    ]					,   )
					snake_case__	     =classifier(['I am happy', 'I am sad']					,   ['positive', 'negative']						)
					self.assertEqual(
					    A_					,   [
					        {'sequence': ANY(A_						), 'labels': [ANY(A_						), ANY(A_						)], 'scores': [ANY(A_						), ANY(A_						)]}
					        for i in range(2						)
					    ]					,   )

					with self.assertRaises(A_						):
							classifier(''					,   candidate_labels='politics'						)

					with self.assertRaises(A_						):
							classifier(A_					,   candidate_labels='politics'						)

					with self.assertRaises(A_						):
							classifier('Who are you voting for in 2020?'					,   candidate_labels=''						)

					with self.assertRaises(A_						):
							classifier('Who are you voting for in 2020?'					,   candidate_labels=A_						)

					with self.assertRaises(A_						):
							classifier(
							    'Who are you voting for in 2020?'					,   candidate_labels='politics'					,   hypothesis_template='Not formatting template'					,   )

					with self.assertRaises(A_						):
							classifier(
							    'Who are you voting for in 2020?'					,   candidate_labels='politics'					,   hypothesis_template=A_					,   )

					self.run_entailment_id(A_						)






			def 						_lowercase  (     self					,   _UpperCAmelCase						)							->							Any:
					snake_case__	     =zero_shot_classifier.model.config
					snake_case__	     =config.labelaid
					snake_case__	     =zero_shot_classifier.entailment_id

					snake_case__	     ={'LABEL_0': 0, 'LABEL_1': 1, 'LABEL_2': 2}
					self.assertEqual(zero_shot_classifier.entailment_id					,   -1						)

					snake_case__	     ={'entailment': 0, 'neutral': 1, 'contradiction': 2}
					self.assertEqual(zero_shot_classifier.entailment_id					,   0						)

					snake_case__	     ={'ENTAIL': 0, 'NON-ENTAIL': 1}
					self.assertEqual(zero_shot_classifier.entailment_id					,   0						)

					snake_case__	     ={'ENTAIL': 2, 'NEUTRAL': 1, 'CONTR': 0}
					self.assertEqual(zero_shot_classifier.entailment_id					,   2						)

					snake_case__	     =original_labelaid
					self.assertEqual(A_					,   zero_shot_classifier.entailment_id						)






			@require_torch
			def 						_lowercase  (     self						)							->							List[str]:
					snake_case__	     =pipeline(
					    'zero-shot-classification'					,   model='sshleifer/tiny-distilbert-base-cased-distilled-squad'					,   framework='pt'					,   )
					# There was a regression in 4.10 for this
					# Adding a test so we don't make the mistake again.
					# https://github.com/huggingface/transformers/issues/13381#issuecomment-912343499
					zero_shot_classifier(
					    'Who are you voting for in 2020?' * 100					,   candidate_labels=['politics', 'public health', 'science']						)






			@require_torch
			def 						_lowercase  (     self						)							->							Any:
					snake_case__	     =pipeline(
					    'zero-shot-classification'					,   model='sshleifer/tiny-distilbert-base-cased-distilled-squad'					,   framework='pt'					,   )
					snake_case__	     =zero_shot_classifier(
					    'Who are you voting for in 2020?'					,   candidate_labels=['politics', 'public health', 'science']						)

					self.assertEqual(
					    nested_simplify(A_						)					,   {
					        'sequence': 'Who are you voting for in 2020?',
					        'labels': ['science', 'public health', 'politics'],
					        'scores': [0.333, 0.333, 0.333],
					    }					,   )






			@require_tf
			def 						_lowercase  (     self						)							->							List[Any]:
					snake_case__	     =pipeline(
					    'zero-shot-classification'					,   model='sshleifer/tiny-distilbert-base-cased-distilled-squad'					,   framework='tf'					,   )
					snake_case__	     =zero_shot_classifier(
					    'Who are you voting for in 2020?'					,   candidate_labels=['politics', 'public health', 'science']						)

					self.assertEqual(
					    nested_simplify(A_						)					,   {
					        'sequence': 'Who are you voting for in 2020?',
					        'labels': ['science', 'public health', 'politics'],
					        'scores': [0.333, 0.333, 0.333],
					    }					,   )






			@slow
			@require_torch
			def 						_lowercase  (     self						)							->							Optional[int]:
					snake_case__	     =pipeline('zero-shot-classification'					,   model='roberta-large-mnli'					,   framework='pt'						)
					snake_case__	     =zero_shot_classifier(
					    'Who are you voting for in 2020?'					,   candidate_labels=['politics', 'public health', 'science']						)

					self.assertEqual(
					    nested_simplify(A_						)					,   {
					        'sequence': 'Who are you voting for in 2020?',
					        'labels': ['politics', 'public health', 'science'],
					        'scores': [0.976, 0.015, 0.009],
					    }					,   )
					snake_case__	     =zero_shot_classifier(
					    'The dominant sequence transduction models are based on complex recurrent or convolutional neural networks'
					    ' in an encoder-decoder configuration. The best performing models also connect the encoder and decoder'
					    ' through an attention mechanism. We propose a new simple network architecture, the Transformer, based'
					    ' solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two'
					    ' machine translation tasks show these models to be superior in quality while being more parallelizable'
					    ' and requiring significantly less time to train. Our model achieves 28.4 BLEU on the WMT 2014'
					    ' English-to-German translation task, improving over the existing best results, including ensembles by'
					    ' over 2 BLEU. On the WMT 2014 English-to-French translation task, our model establishes a new'
					    ' single-model state-of-the-art BLEU score of 41.8 after training for 3.5 days on eight GPUs, a small'
					    ' fraction of the training costs of the best models from the literature. We show that the Transformer'
					    ' generalizes well to other tasks by applying it successfully to English constituency parsing both with'
					    ' large and limited training data.'					,   candidate_labels=['machine learning', 'statistics', 'translation', 'vision']					,   multi_label=A_					,   )
					self.assertEqual(
					    nested_simplify(A_						)					,   {
					        'sequence': (
					            'The dominant sequence transduction models are based on complex recurrent or convolutional neural'
					            ' networks in an encoder-decoder configuration. The best performing models also connect the'
					            ' encoder and decoder through an attention mechanism. We propose a new simple network'
					            ' architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence'
					            ' and convolutions entirely. Experiments on two machine translation tasks show these models to be'
					            ' superior in quality while being more parallelizable and requiring significantly less time to'
					            ' train. Our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task,'
					            ' improving over the existing best results, including ensembles by over 2 BLEU. On the WMT 2014'
					            ' English-to-French translation task, our model establishes a new single-model state-of-the-art'
					            ' BLEU score of 41.8 after training for 3.5 days on eight GPUs, a small fraction of the training'
					            ' costs of the best models from the literature. We show that the Transformer generalizes well to'
					            ' other tasks by applying it successfully to English constituency parsing both with large and'
					            ' limited training data.'
					        ),
					        'labels': ['translation', 'machine learning', 'vision', 'statistics'],
					        'scores': [0.817, 0.713, 0.018, 0.018],
					    }					,   )






			@slow
			@require_tf
			def 						_lowercase  (     self						)							->							Union[str, Any]:
					snake_case__	     =pipeline('zero-shot-classification'					,   model='roberta-large-mnli'					,   framework='tf'						)
					snake_case__	     =zero_shot_classifier(
					    'Who are you voting for in 2020?'					,   candidate_labels=['politics', 'public health', 'science']						)

					self.assertEqual(
					    nested_simplify(A_						)					,   {
					        'sequence': 'Who are you voting for in 2020?',
					        'labels': ['politics', 'public health', 'science'],
					        'scores': [0.976, 0.015, 0.009],
					    }					,   )
					snake_case__	     =zero_shot_classifier(
					    'The dominant sequence transduction models are based on complex recurrent or convolutional neural networks'
					    ' in an encoder-decoder configuration. The best performing models also connect the encoder and decoder'
					    ' through an attention mechanism. We propose a new simple network architecture, the Transformer, based'
					    ' solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two'
					    ' machine translation tasks show these models to be superior in quality while being more parallelizable'
					    ' and requiring significantly less time to train. Our model achieves 28.4 BLEU on the WMT 2014'
					    ' English-to-German translation task, improving over the existing best results, including ensembles by'
					    ' over 2 BLEU. On the WMT 2014 English-to-French translation task, our model establishes a new'
					    ' single-model state-of-the-art BLEU score of 41.8 after training for 3.5 days on eight GPUs, a small'
					    ' fraction of the training costs of the best models from the literature. We show that the Transformer'
					    ' generalizes well to other tasks by applying it successfully to English constituency parsing both with'
					    ' large and limited training data.'					,   candidate_labels=['machine learning', 'statistics', 'translation', 'vision']					,   multi_label=A_					,   )
					self.assertEqual(
					    nested_simplify(A_						)					,   {
					        'sequence': (
					            'The dominant sequence transduction models are based on complex recurrent or convolutional neural'
					            ' networks in an encoder-decoder configuration. The best performing models also connect the'
					            ' encoder and decoder through an attention mechanism. We propose a new simple network'
					            ' architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence'
					            ' and convolutions entirely. Experiments on two machine translation tasks show these models to be'
					            ' superior in quality while being more parallelizable and requiring significantly less time to'
					            ' train. Our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task,'
					            ' improving over the existing best results, including ensembles by over 2 BLEU. On the WMT 2014'
					            ' English-to-French translation task, our model establishes a new single-model state-of-the-art'
					            ' BLEU score of 41.8 after training for 3.5 days on eight GPUs, a small fraction of the training'
					            ' costs of the best models from the literature. We show that the Transformer generalizes well to'
					            ' other tasks by applying it successfully to English constituency parsing both with large and'
					            ' limited training data.'
					        ),
					        'labels': ['translation', 'machine learning', 'vision', 'statistics'],
					        'scores': [0.817, 0.713, 0.018, 0.018],
					    }					,   )








import logging
import os
import sys
from dataclasses import dataclass, field
from importlib import import_module
from typing import Dict, List, Optional, Tuple

import numpy as np
from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score
from torch import nn
from utils_ner import Split, TokenClassificationDataset, TokenClassificationTask

import transformers
from transformers import (
    AutoConfig,
    AutoModelForTokenClassification,
    AutoTokenizer,
    DataCollatorWithPadding,
    EvalPrediction,
    HfArgumentParser,
    Trainer,
    TrainingArguments,
    set_seed,
)
from transformers.trainer_utils import is_main_process


__snake_case   							=						logging.getLogger(__name__)



@dataclass
class 	__lowerCamelCase			:
       _lowercase											=     field(
           metadata={"""help""": """Path to pretrained model or model identifier from huggingface.co/models"""}						)
       _lowercase											=     field(
           default=_a				,      metadata={"""help""": """Pretrained config name or path if not the same as model_name"""}						)
       _lowercase											=     field(
           default="""NER"""				,      metadata={"""help""": """Task type to fine tune in training (e.g. NER, POS, etc)"""}						)
       _lowercase											=     field(
           default=_a				,      metadata={"""help""": """Pretrained tokenizer name or path if not the same as model_name"""}						)
       _lowercase											=     field(default=_a				,      metadata={"""help""": """Set this flag to use fast tokenization."""}						)
       # If you want to tweak more attributes on your tokenizer, you should do it in a distinct script,
       # or just modify its tokenizer_config.json.
       _lowercase											=     field(
           default=_a				,      metadata={"""help""": """Where do you want to store the pretrained models downloaded from huggingface.co"""}				,      )



@dataclass
class 	__lowerCamelCase			:
       _lowercase											=     field(
           metadata={"""help""": """The input data dir. Should contain the .txt files for a CoNLL-2003-formatted task."""}						)
       _lowercase											=     field(
           default=_a				,      metadata={"""help""": """Path to a file containing all labels. If not specified, CoNLL-2003 labels are used."""}				,      )
       _lowercase											=     field(
           default=128				,      metadata={
               """help""": (
                   """The maximum total input sequence length after tokenization. Sequences longer """
                   """than this will be truncated, sequences shorter will be padded."""
               )
           }				,      )
       _lowercase											=     field(
           default=_a				,      metadata={"""help""": """Overwrite the cached training and evaluation sets"""}						)






def 		_A		(		)					-> str:


     """simple docstring"""


     __UpperCamelCase =			HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments) )
     if len(sys.argv ) == 2 and sys.argv[1].endswith('.json' ):
          # If we pass only one argument to the script and it's the path to a json file,
          # let's parse it to get our arguments.
          __UpperCamelCase,    __UpperCamelCase,    __UpperCamelCase =			parser.parse_json_file(json_file=os.path.abspath(sys.argv[1] ) )
     else:
          __UpperCamelCase,    __UpperCamelCase,    __UpperCamelCase =			parser.parse_args_into_dataclasses()

     if (
         os.path.exists(training_args.output_dir )
         and os.listdir(training_args.output_dir )
         and training_args.do_train
         and not training_args.overwrite_output_dir
     ):
          raise ValueError(
              f'''Output directory ({training_args.output_dir}) already exists and is not empty. Use'''
              ' --overwrite_output_dir to overcome.' )

     __UpperCamelCase =			import_module('tasks' )
     try:
          __UpperCamelCase =			getattr(_lowercase					,  model_args.task_type )
          __UpperCamelCase =			token_classification_task_clazz()
     except AttributeError:
          raise ValueError(
              f'''Task {model_args.task_type} needs to be defined as a TokenClassificationTask subclass in {module}. '''
              f'''Available tasks classes are: {TokenClassificationTask.__subclasses__()}''' )

     # Setup logging
     logging.basicConfig(
         format='%(asctime)s - %(levelname)s - %(name)s - %(message)s'					,  datefmt='%m/%d/%Y %H:%M:%S'					,  level=logging.INFO if training_args.local_rank in [-1, 0] else logging.WARN					,  )
     logger.warning(
         'Process rank: %s, device: %s, n_gpu: %s, distributed training: %s, 16-bits training: %s'					,  training_args.local_rank					,  training_args.device					,  training_args.n_gpu					,  bool(training_args.local_rank != -1 )					,  training_args.fpaa					,  )
     # Set the verbosity to info of the Transformers logger (on main process only):
     if is_main_process(training_args.local_rank ):
          transformers.utils.logging.set_verbosity_info()
          transformers.utils.logging.enable_default_handler()
          transformers.utils.logging.enable_explicit_format()
     logger.info('Training/evaluation parameters %s'					,  _lowercase )

     # Set seed
     set_seed(training_args.seed )

     # Prepare CONLL-2003 task
     __UpperCamelCase =			token_classification_task.get_labels(data_args.labels )
     __UpperCamelCase =			dict(enumerate(_lowercase ) )
     __UpperCamelCase =			len(_lowercase )

     # Load pretrained model and tokenizer
     #
     # Distributed training:
     # The .from_pretrained methods guarantee that only one local process can concurrently
     # download model & vocab.

     __UpperCamelCase =			AutoConfig.from_pretrained(
         model_args.config_name if model_args.config_name else model_args.model_name_or_path					,  num_labels=_lowercase					,  idalabel=_lowercase					,  labelaid={label: i for i, label in enumerate(_lowercase )}					,  cache_dir=model_args.cache_dir					,  )
     __UpperCamelCase =			AutoTokenizer.from_pretrained(
         model_args.tokenizer_name if model_args.tokenizer_name else model_args.model_name_or_path					,  cache_dir=model_args.cache_dir					,  use_fast=model_args.use_fast					,  )
     __UpperCamelCase =			AutoModelForTokenClassification.from_pretrained(
         model_args.model_name_or_path					,  from_tf=bool('.ckpt' in model_args.model_name_or_path )					,  config=_lowercase					,  cache_dir=model_args.cache_dir					,  )

     # Get datasets
     __UpperCamelCase =			(
         TokenClassificationDataset(
             token_classification_task=_lowercase					,  data_dir=data_args.data_dir					,  tokenizer=_lowercase					,  labels=_lowercase					,  model_type=config.model_type					,  max_seq_length=data_args.max_seq_length					,  overwrite_cache=data_args.overwrite_cache					,  mode=Split.train					,  )
         if training_args.do_train
         else None
     )
     __UpperCamelCase =			(
         TokenClassificationDataset(
             token_classification_task=_lowercase					,  data_dir=data_args.data_dir					,  tokenizer=_lowercase					,  labels=_lowercase					,  model_type=config.model_type					,  max_seq_length=data_args.max_seq_length					,  overwrite_cache=data_args.overwrite_cache					,  mode=Split.dev					,  )
         if training_args.do_eval
         else None
     )

     def align_predictions(_lowercase					,  _lowercase ) -> Tuple[List[int], List[int]]:
          __UpperCamelCase =			np.argmax(_lowercase					,  axis=2 )

          __UpperCamelCase,    __UpperCamelCase =			preds.shape

          __UpperCamelCase =			[[] for _ in range(_lowercase )]
          __UpperCamelCase =			[[] for _ in range(_lowercase )]

          for i in range(_lowercase ):
               for j in range(_lowercase ):
                    if label_ids[i, j] != nn.CrossEntropyLoss().ignore_index:
                         out_label_list[i].append(label_map[label_ids[i][j]] )
                         preds_list[i].append(label_map[preds[i][j]] )

          return preds_list, out_label_list

     def compute_metrics(_lowercase ) -> Dict:
          __UpperCamelCase,    __UpperCamelCase =			align_predictions(p.predictions					,  p.label_ids )
          return {
              "accuracy_score": accuracy_score(_lowercase					,  _lowercase ),
              "precision": precision_score(_lowercase					,  _lowercase ),
              "recall": recall_score(_lowercase					,  _lowercase ),
              "f1": fa_score(_lowercase					,  _lowercase ),
          }

     # Data collator
     __UpperCamelCase =			DataCollatorWithPadding(_lowercase					,  pad_to_multiple_of=8 ) if training_args.fpaa else None

     # Initialize our Trainer
     __UpperCamelCase =			Trainer(
         model=_lowercase					,  args=_lowercase					,  train_dataset=_lowercase					,  eval_dataset=_lowercase					,  compute_metrics=_lowercase					,  data_collator=_lowercase					,  )

     # Training
     if training_args.do_train:
          trainer.train(
              model_path=model_args.model_name_or_path if os.path.isdir(model_args.model_name_or_path ) else None )
          trainer.save_model()
          # For convenience, we also re-save the tokenizer to the same directory,
          # so that you can share your model easily on huggingface.co/models =)
          if trainer.is_world_process_zero():
               tokenizer.save_pretrained(training_args.output_dir )

    # Evaluation
     __UpperCamelCase =			{}
     if training_args.do_eval:
          logger.info('*** Evaluate ***' )

          __UpperCamelCase =			trainer.evaluate()

          __UpperCamelCase =			os.path.join(training_args.output_dir					,  'eval_results.txt' )
          if trainer.is_world_process_zero():
               with open(_lowercase					,  'w' ) as writer:
                    logger.info('***** Eval results *****' )
                    for key, value in result.items():
                         logger.info('  %s = %s'					,  _lowercase					,  _lowercase )
                         writer.write('%s = %s\n' % (key, value) )

               results.update(_lowercase )

    # Predict
     if training_args.do_predict:
          __UpperCamelCase =			TokenClassificationDataset(
              token_classification_task=_lowercase					,  data_dir=data_args.data_dir					,  tokenizer=_lowercase					,  labels=_lowercase					,  model_type=config.model_type					,  max_seq_length=data_args.max_seq_length					,  overwrite_cache=data_args.overwrite_cache					,  mode=Split.test					,  )

          __UpperCamelCase,    __UpperCamelCase,    __UpperCamelCase =			trainer.predict(_lowercase )
          __UpperCamelCase,    __UpperCamelCase =			align_predictions(_lowercase					,  _lowercase )

          __UpperCamelCase =			os.path.join(training_args.output_dir					,  'test_results.txt' )
          if trainer.is_world_process_zero():
               with open(_lowercase					,  'w' ) as writer:
                    for key, value in metrics.items():
                         logger.info('  %s = %s'					,  _lowercase					,  _lowercase )
                         writer.write('%s = %s\n' % (key, value) )

        # Save predictions
          __UpperCamelCase =			os.path.join(training_args.output_dir					,  'test_predictions.txt' )
          if trainer.is_world_process_zero():
               with open(_lowercase					,  'w' ) as writer:
                    with open(os.path.join(data_args.data_dir					,  'test.txt' )					,  'r' ) as f:
                         token_classification_task.write_predictions_to_file(_lowercase					,  _lowercase					,  _lowercase )

     return results






def 		_A		(		_lowercase )					-> Dict:


     """simple docstring"""


     main()


if __name__ == "__main__":
    main()


