Really fix quality due to ruff release

This commit is contained in:
Sylvain Gugger
2023-03-22 20:56:22 -04:00
parent ef28df0572
commit 80e3b36361
2 changed files with 8 additions and 6 deletions

View File

@@ -56,8 +56,10 @@ if is_torch_available():
@is_pipeline_test @is_pipeline_test
class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase): class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase):
model_mapping = dict((list(MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING.items()) if MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING else []) model_mapping = dict(
+ (MODEL_FOR_CTC_MAPPING.items() if MODEL_FOR_CTC_MAPPING else [])) (list(MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING.items()) if MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING else [])
+ (MODEL_FOR_CTC_MAPPING.items() if MODEL_FOR_CTC_MAPPING else [])
)
def get_test_pipeline(self, model, tokenizer, processor): def get_test_pipeline(self, model, tokenizer, processor):
if tokenizer is None: if tokenizer is None:

View File

@@ -80,11 +80,11 @@ def mask_to_test_readable_only_shape(mask: Image) -> Dict:
@require_timm @require_timm
@require_torch @require_torch
class ImageSegmentationPipelineTests(unittest.TestCase): class ImageSegmentationPipelineTests(unittest.TestCase):
model_mapping = dict(( model_mapping = dict(
list(MODEL_FOR_IMAGE_SEGMENTATION_MAPPING.items()) if MODEL_FOR_IMAGE_SEGMENTATION_MAPPING else [] (list(MODEL_FOR_IMAGE_SEGMENTATION_MAPPING.items()) if MODEL_FOR_IMAGE_SEGMENTATION_MAPPING else [])
)
+ (MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING.items() if MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING else []) + (MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING.items() if MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING else [])
+ (MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING.items() if MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING else [])) + (MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING.items() if MODEL_FOR_INSTANCE_SEGMENTATION_MAPPING else [])
)
def get_test_pipeline(self, model, tokenizer, processor): def get_test_pipeline(self, model, tokenizer, processor):
image_segmenter = ImageSegmentationPipeline(model=model, image_processor=processor) image_segmenter = ImageSegmentationPipeline(model=model, image_processor=processor)