



'''simple docstring'''
import unittest

from transformers import DonutProcessor


snake_case_			:     str  	=  'naver-clova-ix/donut-base'






class 							lowercase__     (							unittest.TestCase       ):





	def      UpperCamelCase_  (			self :    Union[str, Any]			):







							'''simple docstring'''
							_UpperCamelCase :		Dict			    =       DonutProcessor.from_pretrained(lowerCamelCase__			)





	def      UpperCamelCase_  (			self :    Optional[Any]			):







							'''simple docstring'''
							_UpperCamelCase :		Dict			    =       {
							    'name': 'John Doe',
							    'age': '99',
							    'city': 'Atlanta',
							    'state': 'GA',
							    'zip': '30301',
							    'phone': '123-4567',
							    'nicknames': [{'nickname': 'Johnny'}, {'nickname': 'JD'}],
							}

							_UpperCamelCase :		List[Any]			    =       (
							    '<s_name>John Doe</s_name><s_age>99</s_age><s_city>Atlanta</s_city>'
							    '<s_state>GA</s_state><s_zip>30301</s_zip><s_phone>123-4567</s_phone>'
							    '<s_nicknames><s_nickname>Johnny</s_nickname>'
							    '<sep/><s_nickname>JD</s_nickname></s_nicknames>'
							)
							_UpperCamelCase :		List[Any]			    =       self.processor.tokenajson(lowerCamelCase__			)

							self.assertDictEqual(lowerCamelCase__			,lowerCamelCase__			)







'''simple docstring'''
from torch import nn






def A__   (					UpperCAmelCase_							):
						if act_fn in ["swish", "silu"]:
												return nn.SiLU()
						elif act_fn == "mish":
												return nn.Mish()
						elif act_fn == "gelu":
												return nn.GELU()
						else:
												raise ValueError(f'Unsupported activation function: {act_fn}'							)


