
from .imports import is_tqdm_available


if is_tqdm_available():
					from tqdm.auto import tqdm as _tqdm

from ..state import PartialState






def 		_UpperCAmelCase (						UpperCamelCase:  Union[str, Any] = True      ,				*UpperCamelCase:  Dict      ,				**UpperCamelCase:  Tuple	):






	"""simple docstring"""


	if not is_tqdm_available():
		raise ImportError("Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`."	)
	__lowerCAmelCase    =				False
	if main_process_only:
		__lowerCAmelCase    =				PartialState().local_process_index == 0
	return _tqdm(*UpperCamelCase_      ,				**UpperCamelCase_      ,				disable=UpperCamelCase_	)










'''simple docstring'''
import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin






class 					__lowerCAmelCase   (   unittest.TestCase				,			lowercase						):

						"""simple docstring"""






						def 				_UpperCAmelCase       (  self							:      List[str]	):
													A_			    =		load_tool("text-classification"	)
													self.tool.setup()
													A_			    =		load_tool("text-classification" ,  remote=lowerCAmelCase	)






						def 				_UpperCAmelCase       (  self							:      Union[str, Any]	):
													A_			    =		self.tool("That's quite cool" ,  ["positive", "negative"]	)
													self.assertEqual(lowerCAmelCase ,  "positive"	)






						def 				_UpperCAmelCase       (  self							:      str	):
													A_			    =		self.remote_tool("That's quite cool" ,  ["positive", "negative"]	)
													self.assertEqual(lowerCAmelCase ,  "positive"	)






						def 				_UpperCAmelCase       (  self							:      str	):
													A_			    =		self.tool(text="That's quite cool" ,  labels=["positive", "negative"]	)
													self.assertEqual(lowerCAmelCase ,  "positive"	)






						def 				_UpperCAmelCase       (  self							:      List[Any]	):
													A_			    =		self.remote_tool(text="That's quite cool" ,  labels=["positive", "negative"]	)
													self.assertEqual(lowerCAmelCase ,  "positive"	)





