

from tempfile import TemporaryDirectory
from unittest import TestCase
from unittest.mock import MagicMock, patch

from transformers import AutoModel, TFAutoModel
from transformers.onnx import FeaturesManager
from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch







@require_torch
@require_tf
class 			lowercase				(	__a      ):




				def    a							( self	):
											snake_case_          =   SMALL_MODEL_IDENTIFIER
											snake_case_          =   'pt'
											snake_case_          =   'tf'




				def    a							( self				,       snake_case	):
											snake_case_          =   AutoModel.from_pretrained(self.test_model	)
											model_pt.save_pretrained(a__	)




				def    a							( self				,       snake_case	):
											snake_case_          =   TFAutoModel.from_pretrained(self.test_model				,       from_pt=a__	)
											model_tf.save_pretrained(a__	)




				def    a							( self	):
											snake_case_          =   'mock_framework'

											# Framework provided - return whatever the user provides
											snake_case_          =   FeaturesManager.determine_framework(self.test_model				,       a__	)
											self.assertEqual(a__				,       a__	)

											# Local checkpoint and framework provided - return provided framework
											# PyTorch checkpoint
											with TemporaryDirectory() as local_pt_ckpt:
																		self._setup_pt_ckpt(a__	)
																		snake_case_          =   FeaturesManager.determine_framework(a__				,       a__	)
																		self.assertEqual(a__				,       a__	)

											# TensorFlow checkpoint
											with TemporaryDirectory() as local_tf_ckpt:
																		self._setup_tf_ckpt(a__	)
																		snake_case_          =   FeaturesManager.determine_framework(a__				,       a__	)
																		self.assertEqual(a__				,       a__	)




				def    a							( self	):
											# PyTorch checkpoint
											with TemporaryDirectory() as local_pt_ckpt:
																		self._setup_pt_ckpt(a__	)
																		snake_case_          =   FeaturesManager.determine_framework(a__	)
																		self.assertEqual(a__				,       self.framework_pt	)

											# TensorFlow checkpoint
											with TemporaryDirectory() as local_tf_ckpt:
																		self._setup_tf_ckpt(a__	)
																		snake_case_          =   FeaturesManager.determine_framework(a__	)
																		self.assertEqual(a__				,       self.framework_tf	)

											# Invalid local checkpoint
											with TemporaryDirectory() as local_invalid_ckpt:
																		with self.assertRaises(a__	):
																									snake_case_          =   FeaturesManager.determine_framework(a__	)




				def    a							( self	):
											snake_case_          =   MagicMock(return_value=a__	)
											with patch('transformers.onnx.features.is_tf_available'				,       a__	):
																		snake_case_          =   FeaturesManager.determine_framework(self.test_model	)
																		self.assertEqual(a__				,       self.framework_pt	)

											# PyTorch not in environment -> use TensorFlow
											snake_case_          =   MagicMock(return_value=a__	)
											with patch('transformers.onnx.features.is_torch_available'				,       a__	):
																		snake_case_          =   FeaturesManager.determine_framework(self.test_model	)
																		self.assertEqual(a__				,       self.framework_tf	)

											# Both in environment -> use PyTorch
											snake_case_          =   MagicMock(return_value=a__	)
											snake_case_          =   MagicMock(return_value=a__	)
											with patch('transformers.onnx.features.is_tf_available'				,       a__	), patch(
											    'transformers.onnx.features.is_torch_available'				,       a__	):
																		snake_case_          =   FeaturesManager.determine_framework(self.test_model	)
																		self.assertEqual(a__				,       self.framework_pt	)

											# Both not in environment -> raise error
											snake_case_          =   MagicMock(return_value=a__	)
											snake_case_          =   MagicMock(return_value=a__	)
											with patch('transformers.onnx.features.is_tf_available'				,       a__	), patch(
											    'transformers.onnx.features.is_torch_available'				,       a__	):
																		with self.assertRaises(a__	):
																									snake_case_          =   FeaturesManager.determine_framework(self.test_model	)







def  __lowerCamelCase     (			UpperCamelCase__				):







							'''simple docstring'''






							snake_case_          =   1
							snake_case_          =   2
							while i * i <= n:
														snake_case_          =   0
														while n % i == 0:
																					n //= i
																					multiplicity += 1
														n_divisors *= multiplicity + 1
														i += 1
							if n > 1:
														n_divisors *= 2
							return n_divisors





def  __lowerCamelCase     (			):







							'''simple docstring'''






							snake_case_          =   1
							snake_case_          =   1

							while True:
														i += 1
														t_num += i

														if count_divisors(UpperCamelCase__				) > 500:
																					break

							return t_num


if __name__ == "__main__":
					print(solution())




