def test_tf_sentiment_analysis(self):
     mandatory_keys = {"label", "score"}
     for model_name in TEXT_CLASSIF_FINETUNED_MODELS:
         nlp = pipeline(task="sentiment-analysis",
                        model=model_name,
                        tokenizer=model_name)
         self._test_mono_column_pipeline(nlp, VALID_INPUTS, mandatory_keys)
 def test_tf_fill_mask_results(self):
     mandatory_keys = {"sequence", "score", "token"}
     valid_inputs = [
         "My name is <mask>",
         "The largest city in France is <mask>",
     ]
     invalid_inputs = [
         "This is <mask> <mask>"  # More than 1 mask_token in the input is not supported
         "This is"  # No mask_token is not supported
     ]
     for model_name in FILL_MASK_FINETUNED_MODELS:
         nlp = pipeline(task="fill-mask",
                        model=model_name,
                        tokenizer=model_name)
         self._test_mono_column_pipeline(
             nlp,
             valid_inputs,
             mandatory_keys,
             invalid_inputs,
             expected_multi_result=expected_fill_mask_result,
             expected_check_keys=["sequence"],
         )
 def test_tf_defaults(self):
     # Test that pipelines can be correctly loaded without any argument
     for task in self.pipelines:
         with self.subTest(
                 msg="Testing TF defaults with TF and {}".format(task)):
             pipeline(task)
 def test_tf_zero_shot_outputs(self):
     nlp = pipeline(task="zero-shot-classification",
                    model="roberta-large-mnli")
     self._test_zero_shot_pipeline_outputs(nlp)
 def test_tf_zero_shot_classification(self):
     for model_name in TEXT_CLASSIF_FINETUNED_MODELS:
         nlp = pipeline(task="zero-shot-classification",
                        model=model_name,
                        tokenizer=model_name)
         self._test_zero_shot_pipeline(nlp)
 def test_tf_feature_extraction(self):
     for model_name in FEATURE_EXTRACT_FINETUNED_MODELS:
         nlp = pipeline(task="feature-extraction",
                        model=model_name,
                        tokenizer=model_name)
         self._test_mono_column_pipeline(nlp, VALID_INPUTS, {})