

'''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 							lowercase_						(		unittest.TestCase			):

  '''simple docstring'''





  def     snake_case_      (  self  )				->					Tuple:


    """simple docstring"""
    UpperCAmelCase    				=						inspect.getfile(accelerate.test_utils  )
    UpperCAmelCase    				=						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

    UpperCAmelCase    				=						test_metrics
  @require_cpu
  def     snake_case_      (  self  )				->					List[str]:


    """simple docstring"""
    debug_launcher(self.test_metrics.main ,			num_processes=1  )
  @require_cpu
  def     snake_case_      (  self  )				->					str:


    """simple docstring"""
    debug_launcher(self.test_metrics.main  )
  @require_single_gpu
  def     snake_case_      (  self  )				->					Optional[Any]:


    """simple docstring"""
    self.test_metrics.main()





  @require_multi_gpu
  def     snake_case_      (  self  )				->					Optional[Any]:


    """simple docstring"""
    print(F'''Found {torch.cuda.device_count()} devices.'''  )
    UpperCAmelCase    				=						['torchrun', F'''--nproc_per_node={torch.cuda.device_count()}''', self.test_file_path]
    with patch_environment(omp_num_threads=1  ):
      execute_subprocess_async(a_ ,			env=os.environ.copy()  )





'''simple docstring'''




import warnings

from ...utils import logging
from .image_processing_donut import DonutImageProcessor


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



class 							lowercase_						(		a			):

  '''simple docstring'''





  def __init__(  self ,			*a_ ,			**a_  )				->					None:


    """simple docstring"""
    warnings.warn(
        'The class DonutFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'
        ' use DonutImageProcessor instead.' ,			a_ ,			)
    super().__init__(*a_ ,			**a_  )


