





'''simple docstring'''






import warnings

from ...utils import logging
from .image_processing_flava import FlavaImageProcessor


A__    :       List[Any]              =logging.get_logger(__name__)




class 			UpperCAmelCase					(      snake_case_       ):




      def __init__(      self      :			Optional[int]      ,      *__snake_case      :			Union[str, Any]      ,      **__snake_case      :			Union[str, Any]  )    ->				None:
            warnings.warn(
                """The class FlavaFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"""
                """ use FlavaImageProcessor instead."""      ,      __snake_case      ,      )
            super().__init__(*__snake_case      ,      **__snake_case  )













'''simple docstring'''






import inspect
import os
import unittest

import torch

import accelerate
from accelerate import debug_launcher
from accelerate.test_utils import (
    execute_subprocess_async,
    require_cpu,
    require_huggingface_suite,
    require_multi_gpu,
    require_single_gpu,
)
from accelerate.utils import patch_environment




@require_huggingface_suite
class 			UpperCAmelCase					(      unittest.TestCase       ):




      def     lowercase__   (      self      :			int  )    ->				Union[str, Any]:
            _lowerCAmelCase												=							inspect.getfile(accelerate.test_utils  )
            _lowerCAmelCase												=							os.path.sep.join(
                mod_file.split(os.path.sep  )[:-1] + ["""scripts""", """external_deps""", """test_metrics.py"""]  )

            from accelerate.test_utils.scripts.external_deps import test_metrics  # noqa: F401

            _lowerCAmelCase												=							test_metrics




      @require_cpu
      def     lowercase__   (      self      :			Optional[Any]  )    ->				Optional[Any]:
            debug_launcher(self.test_metrics.main      ,      num_processes=1  )




      @require_cpu
      def     lowercase__   (      self      :			Tuple  )    ->				Tuple:
            debug_launcher(self.test_metrics.main  )




      @require_single_gpu
      def     lowercase__   (      self      :			Union[str, Any]  )    ->				str:
            self.test_metrics.main()




      @require_multi_gpu
      def     lowercase__   (      self      :			str  )    ->				List[str]:
            print(f"Found {torch.cuda.device_count()} devices."  )
            _lowerCAmelCase												=							["""torchrun""", f"--nproc_per_node={torch.cuda.device_count()}", self.test_file_path]
            with patch_environment(omp_num_threads=1  ):
                  execute_subprocess_async(__snake_case      ,      env=os.environ.copy()  )






