






from typing import Optional, Tuple, Union

import flax
import flax.linen as nn
import jax
import jax.numpy as jnp
from flax.core.frozen_dict import FrozenDict

from ..configuration_utils import ConfigMixin, flax_register_to_config
from ..utils import BaseOutput
from .embeddings_flax import FlaxTimestepEmbedding, FlaxTimesteps
from .modeling_flax_utils import FlaxModelMixin
from .unet_ad_blocks_flax import (
    FlaxCrossAttnDownBlockaD,
    FlaxDownBlockaD,
    FlaxUNetMidBlockaDCrossAttn,
)




@flax.struct.dataclass
class 		UpperCAmelCase_						(	SCREAMING_SNAKE_CASE__					):


						'''simple docstring'''




						A     :   Optional[Any]						=					42
						A     :   List[Any]						=					42




class 		UpperCAmelCase_						(	nn.Module					):


						'''simple docstring'''




						A     :   List[str]						=					42
						A     :   Optional[int]						=					(16, 32, 96, 2_56)
						A     :   Dict						=					jnp.floataa






						def       _lowerCAmelCase       (	self				) ->				Any:
								snake_case_				:							Optional[int]						 =       nn.Conv(
								    self.block_out_channels[0]		,				kernel_size=(3, 3)		,				padding=((1, 1), (1, 1))		,				dtype=self.dtype		,				)

								snake_case_				:							Union[str, Any]						 =       []
								for i in range(len(self.block_out_channels				) - 1				):
										snake_case_				:							Dict						 =       self.block_out_channels[i]
										snake_case_				:							Union[str, Any]						 =       self.block_out_channels[i + 1]
										snake_case_				:							Tuple						 =       nn.Conv(
										    _SCREAMING_SNAKE_CASE		,				kernel_size=(3, 3)		,				padding=((1, 1), (1, 1))		,				dtype=self.dtype		,				)
										blocks.append(_SCREAMING_SNAKE_CASE				)
										snake_case_				:							Optional[int]						 =       nn.Conv(
										    _SCREAMING_SNAKE_CASE		,				kernel_size=(3, 3)		,				strides=(2, 2)		,				padding=((1, 1), (1, 1))		,				dtype=self.dtype		,				)
										blocks.append(_SCREAMING_SNAKE_CASE				)
								snake_case_				:							Optional[int]						 =       blocks

								snake_case_				:							Tuple						 =       nn.Conv(
								    self.conditioning_embedding_channels		,				kernel_size=(3, 3)		,				padding=((1, 1), (1, 1))		,				kernel_init=nn.initializers.zeros_init()		,				bias_init=nn.initializers.zeros_init()		,				dtype=self.dtype		,				)






						def __call__(	self		,				_SCREAMING_SNAKE_CASE				) ->				Union[str, Any]:
								snake_case_				:							Tuple						 =       self.conv_in(_SCREAMING_SNAKE_CASE				)
								snake_case_				:							str						 =       nn.silu(_SCREAMING_SNAKE_CASE				)

								for block in self.blocks:
										snake_case_				:							List[str]						 =       block(_SCREAMING_SNAKE_CASE				)
										snake_case_				:							Optional[int]						 =       nn.silu(_SCREAMING_SNAKE_CASE				)

								snake_case_				:							List[str]						 =       self.conv_out(_SCREAMING_SNAKE_CASE				)

								return embedding




@flax_register_to_config
class 		UpperCAmelCase_						(	nn.Module					,  SCREAMING_SNAKE_CASE__					,  SCREAMING_SNAKE_CASE__					):


						'''simple docstring'''




						A     :   Any						=					32
						A     :   List[str]						=					4
						A     :   Optional[Any]						=					(
						    'CrossAttnDownBlock2D',
						    'CrossAttnDownBlock2D',
						    'CrossAttnDownBlock2D',
						    'DownBlock2D',
						)
						A     :   Any						=					False
						A     :   int						=					(3_20, 6_40, 12_80, 12_80)
						A     :   str						=					2
						A     :   List[str]						=					8
						A     :   List[str]						=					None
						A     :   Any						=					12_80
						A     :   Tuple						=					0.0
						A     :   Any						=					False
						A     :   List[str]						=					jnp.floataa
						A     :   List[str]						=					True
						A     :   int						=					0
						A     :   List[str]						=					'rgb'
						A     :   Optional[int]						=					(16, 32, 96, 2_56)






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE				) ->				FrozenDict:
								snake_case_				:							Union[str, Any]						 =       (1, self.in_channels, self.sample_size, self.sample_size)
								snake_case_				:							Tuple						 =       jnp.zeros(_SCREAMING_SNAKE_CASE		,				dtype=jnp.floataa				)
								snake_case_				:							int						 =       jnp.ones((1,)		,				dtype=jnp.intaa				)
								snake_case_				:							List[Any]						 =       jnp.zeros((1, 1, self.cross_attention_dim)		,				dtype=jnp.floataa				)
								snake_case_				:							Any						 =       (1, 3, self.sample_size * 8, self.sample_size * 8)
								snake_case_				:							Tuple						 =       jnp.zeros(_SCREAMING_SNAKE_CASE		,				dtype=jnp.floataa				)

								snake_case_ ,       snake_case_				:							Tuple						 =       jax.random.split(_SCREAMING_SNAKE_CASE				)
								snake_case_				:							Optional[Any]						 =       {"params": params_rng, "dropout": dropout_rng}

								return self.init(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE				)["params"]






						def       _lowerCAmelCase       (	self				) ->				Dict:
								snake_case_				:							Union[str, Any]						 =       self.block_out_channels
								snake_case_				:							int						 =       block_out_channels[0] * 4

								# If `num_attention_heads` is not defined (which is the case for most models)
								# it will default to `attention_head_dim`. This looks weird upon first reading it and it is.
								# The reason for this behavior is to correct for incorrectly named variables that were introduced
								# when this library was created. The incorrect naming was only discovered much later in https://github.com/huggingface/diffusers/issues/2011#issuecomment-1547958131
								# Changing `attention_head_dim` to `num_attention_heads` for 40,000+ configurations is too backwards breaking
								# which is why we correct for the naming here.
								snake_case_				:							List[Any]						 =       self.num_attention_heads or self.attention_head_dim

								# input
								snake_case_				:							Any						 =       nn.Conv(
								    block_out_channels[0]		,				kernel_size=(3, 3)		,				strides=(1, 1)		,				padding=((1, 1), (1, 1))		,				dtype=self.dtype		,				)

								# time
								snake_case_				:							Tuple						 =       FlaxTimesteps(
								    block_out_channels[0]		,				flip_sin_to_cos=self.flip_sin_to_cos		,				freq_shift=self.config.freq_shift				)
								snake_case_				:							Any						 =       FlaxTimestepEmbedding(_SCREAMING_SNAKE_CASE		,				dtype=self.dtype				)

								snake_case_				:							List[str]						 =       FlaxControlNetConditioningEmbedding(
								    conditioning_embedding_channels=block_out_channels[0]		,				block_out_channels=self.conditioning_embedding_out_channels		,				)

								snake_case_				:							Optional[int]						 =       self.only_cross_attention
								if isinstance(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE				):
										snake_case_				:							Union[str, Any]						 =       (only_cross_attention,) * len(self.down_block_types				)

								if isinstance(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE				):
										snake_case_				:							str						 =       (num_attention_heads,) * len(self.down_block_types				)

								# down
								snake_case_				:							Any						 =       []
								snake_case_				:							Any						 =       []

								snake_case_				:							Optional[Any]						 =       block_out_channels[0]

								snake_case_				:							Dict						 =       nn.Conv(
								    _SCREAMING_SNAKE_CASE		,				kernel_size=(1, 1)		,				padding="VALID"		,				kernel_init=nn.initializers.zeros_init()		,				bias_init=nn.initializers.zeros_init()		,				dtype=self.dtype		,				)
								controlnet_down_blocks.append(_SCREAMING_SNAKE_CASE				)

								for i, down_block_type in enumerate(self.down_block_types				):
										snake_case_				:							Any						 =       output_channel
										snake_case_				:							Dict						 =       block_out_channels[i]
										snake_case_				:							List[str]						 =       i == len(_SCREAMING_SNAKE_CASE				) - 1

										if down_block_type == "CrossAttnDownBlock2D":
												snake_case_				:							Optional[Any]						 =       FlaxCrossAttnDownBlockaD(
												    in_channels=_SCREAMING_SNAKE_CASE		,				out_channels=_SCREAMING_SNAKE_CASE		,				dropout=self.dropout		,				num_layers=self.layers_per_block		,				num_attention_heads=num_attention_heads[i]		,				add_downsample=not is_final_block		,				use_linear_projection=self.use_linear_projection		,				only_cross_attention=only_cross_attention[i]		,				dtype=self.dtype		,				)
										else:
												snake_case_				:							str						 =       FlaxDownBlockaD(
												    in_channels=_SCREAMING_SNAKE_CASE		,				out_channels=_SCREAMING_SNAKE_CASE		,				dropout=self.dropout		,				num_layers=self.layers_per_block		,				add_downsample=not is_final_block		,				dtype=self.dtype		,				)

										down_blocks.append(_SCREAMING_SNAKE_CASE				)

										for _ in range(self.layers_per_block				):
												snake_case_				:							List[str]						 =       nn.Conv(
												    _SCREAMING_SNAKE_CASE		,				kernel_size=(1, 1)		,				padding="VALID"		,				kernel_init=nn.initializers.zeros_init()		,				bias_init=nn.initializers.zeros_init()		,				dtype=self.dtype		,				)
												controlnet_down_blocks.append(_SCREAMING_SNAKE_CASE				)

										if not is_final_block:
												snake_case_				:							Tuple						 =       nn.Conv(
												    _SCREAMING_SNAKE_CASE		,				kernel_size=(1, 1)		,				padding="VALID"		,				kernel_init=nn.initializers.zeros_init()		,				bias_init=nn.initializers.zeros_init()		,				dtype=self.dtype		,				)
												controlnet_down_blocks.append(_SCREAMING_SNAKE_CASE				)

								snake_case_				:							List[Any]						 =       down_blocks
								snake_case_				:							Any						 =       controlnet_down_blocks

								# mid
								snake_case_				:							Optional[Any]						 =       block_out_channels[-1]
								snake_case_				:							List[Any]						 =       FlaxUNetMidBlockaDCrossAttn(
								    in_channels=_SCREAMING_SNAKE_CASE		,				dropout=self.dropout		,				num_attention_heads=num_attention_heads[-1]		,				use_linear_projection=self.use_linear_projection		,				dtype=self.dtype		,				)

								snake_case_				:							Dict						 =       nn.Conv(
								    _SCREAMING_SNAKE_CASE		,				kernel_size=(1, 1)		,				padding="VALID"		,				kernel_init=nn.initializers.zeros_init()		,				bias_init=nn.initializers.zeros_init()		,				dtype=self.dtype		,				)






						def __call__(	self		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE = 1.0		,				_SCREAMING_SNAKE_CASE = True		,				_SCREAMING_SNAKE_CASE = False		,				) ->				Union[FlaxControlNetOutput, Tuple]:
								snake_case_				:							Any						 =       self.controlnet_conditioning_channel_order
								if channel_order == "bgr":
										snake_case_				:							str						 =       jnp.flip(_SCREAMING_SNAKE_CASE		,				axis=1				)

								# 1. time
								if not isinstance(_SCREAMING_SNAKE_CASE		,				jnp.ndarray				):
										snake_case_				:							List[str]						 =       jnp.array([timesteps]		,				dtype=jnp.intaa				)
								elif isinstance(_SCREAMING_SNAKE_CASE		,				jnp.ndarray				) and len(timesteps.shape				) == 0:
										snake_case_				:							List[str]						 =       timesteps.astype(dtype=jnp.floataa				)
										snake_case_				:							Dict						 =       jnp.expand_dims(_SCREAMING_SNAKE_CASE		,				0				)

								snake_case_				:							Optional[int]						 =       self.time_proj(_SCREAMING_SNAKE_CASE				)
								snake_case_				:							Tuple						 =       self.time_embedding(_SCREAMING_SNAKE_CASE				)

								# 2. pre-process
								snake_case_				:							Any						 =       jnp.transpose(_SCREAMING_SNAKE_CASE		,				(0, 2, 3, 1)				)
								snake_case_				:							Optional[int]						 =       self.conv_in(_SCREAMING_SNAKE_CASE				)

								snake_case_				:							str						 =       jnp.transpose(_SCREAMING_SNAKE_CASE		,				(0, 2, 3, 1)				)
								snake_case_				:							Dict						 =       self.controlnet_cond_embedding(_SCREAMING_SNAKE_CASE				)
								sample += controlnet_cond

								# 3. down
								snake_case_				:							Optional[Any]						 =       (sample,)
								for down_block in self.down_blocks:
										if isinstance(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE				):
												snake_case_ ,       snake_case_				:							Optional[int]						 =       down_block(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				deterministic=not train				)
										else:
												snake_case_ ,       snake_case_				:							List[str]						 =       down_block(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				deterministic=not train				)
										down_block_res_samples += res_samples

								# 4. mid
								snake_case_				:							Optional[Any]						 =       self.mid_block(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				deterministic=not train				)

								# 5. contronet blocks
								snake_case_				:							Optional[Any]						 =       ()
								for down_block_res_sample, controlnet_block in zip(_SCREAMING_SNAKE_CASE		,				self.controlnet_down_blocks				):
										snake_case_				:							Optional[int]						 =       controlnet_block(_SCREAMING_SNAKE_CASE				)
										controlnet_down_block_res_samples += (down_block_res_sample,)

								snake_case_				:							List[str]						 =       controlnet_down_block_res_samples

								snake_case_				:							int						 =       self.controlnet_mid_block(_SCREAMING_SNAKE_CASE				)

								# 6. scaling
								snake_case_				:							Optional[Any]						 =       [sample * conditioning_scale for sample in down_block_res_samples]
								mid_block_res_sample *= conditioning_scale

								if not return_dict:
										return (down_block_res_samples, mid_block_res_sample)

								return FlaxControlNetOutput(
								    down_block_res_samples=_SCREAMING_SNAKE_CASE		,				mid_block_res_sample=_SCREAMING_SNAKE_CASE				)








import logging
import os
from dataclasses import dataclass
from typing import List, Optional, Union

import tqdm
from filelock import FileLock

from transformers import (
    BartTokenizer,
    BartTokenizerFast,
    DataProcessor,
    PreTrainedTokenizer,
    RobertaTokenizer,
    RobertaTokenizerFast,
    XLMRobertaTokenizer,
    is_tf_available,
    is_torch_available,
)


lowercase  :							Optional[Any]			  =    logging.getLogger(__name__)




@dataclass(frozen=SCREAMING_SNAKE_CASE__					)
class 		UpperCAmelCase_						:


						'''simple docstring'''




						A     :   str
						A     :   str
						A     :   Optional[str]						=					None
						A     :   Optional[str]						=					None
						A     :   Optional[str]						=					None




@dataclass(frozen=SCREAMING_SNAKE_CASE__					)
class 		UpperCAmelCase_						:


						'''simple docstring'''




						A     :   List[int]
						A     :   Optional[List[int]]						=					None
						A     :   Optional[List[int]]						=					None
						A     :   Optional[Union[int, float]]						=					None
						A     :   Optional[int]						=					None


if is_torch_available():
							import torch
							from torch.utils.data import Dataset




							class 		UpperCAmelCase_						(	SCREAMING_SNAKE_CASE__					):


													'''simple docstring'''




													A     :   List[InputFeatures]






													def __init__(	self		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE = None		,				_SCREAMING_SNAKE_CASE=False		,				_SCREAMING_SNAKE_CASE = False		,				) ->				Union[str, Any]:
															snake_case_				:							str						 =       hans_processors[task]()

															snake_case_				:							Tuple						 =       os.path.join(
															    _SCREAMING_SNAKE_CASE		,				"cached_{}_{}_{}_{}".format(
															        "dev" if evaluate else "train"		,				tokenizer.__class__.__name__		,				str(_SCREAMING_SNAKE_CASE				)		,				_SCREAMING_SNAKE_CASE		,				)		,				)
															snake_case_				:							Dict						 =       processor.get_labels()
															if tokenizer.__class__ in (
															    RobertaTokenizer,
															    RobertaTokenizerFast,
															    XLMRobertaTokenizer,
															    BartTokenizer,
															    BartTokenizerFast,
															):
																	# HACK(label indices are swapped in RoBERTa pretrained model)
																	snake_case_ ,       snake_case_				:							Any						 =       label_list[2], label_list[1]
															snake_case_				:							Tuple						 =       label_list

															# Make sure only the first process in distributed training processes the dataset,
															# and the others will use the cache.
															snake_case_				:							Dict						 =       cached_features_file + ".lock"
															with FileLock(_SCREAMING_SNAKE_CASE				):
																	if os.path.exists(_SCREAMING_SNAKE_CASE				) and not overwrite_cache:
																			logger.info(f'''Loading features from cached file {cached_features_file}'''				)
																			snake_case_				:							Dict						 =       torch.load(_SCREAMING_SNAKE_CASE				)
																	else:
																			logger.info(f'''Creating features from dataset file at {data_dir}'''				)

																			snake_case_				:							Any						 =       (
																			    processor.get_dev_examples(_SCREAMING_SNAKE_CASE				) if evaluate else processor.get_train_examples(_SCREAMING_SNAKE_CASE				)
																			)

																			logger.info("Training examples: %s"		,				len(_SCREAMING_SNAKE_CASE				)				)
																			snake_case_				:							Union[str, Any]						 =       hans_convert_examples_to_features(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE				)
																			logger.info("Saving features into cached file %s"		,				_SCREAMING_SNAKE_CASE				)
																			torch.save(self.features		,				_SCREAMING_SNAKE_CASE				)






													def __len__(	self				) ->				Tuple:
															return len(self.features				)






													def __getitem__(	self		,				_SCREAMING_SNAKE_CASE				) ->				InputFeatures:
															return self.features[i]






													def       _lowerCAmelCase       (	self				) ->				Dict:
															return self.label_list


if is_tf_available():
							import tensorflow as tf




							class 		UpperCAmelCase_						:


													'''simple docstring'''




													A     :   List[InputFeatures]






													def __init__(	self		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE = 128		,				_SCREAMING_SNAKE_CASE=False		,				_SCREAMING_SNAKE_CASE = False		,				) ->				Optional[int]:
															snake_case_				:							Tuple						 =       hans_processors[task]()
															snake_case_				:							Dict						 =       processor.get_labels()
															if tokenizer.__class__ in (
															    RobertaTokenizer,
															    RobertaTokenizerFast,
															    XLMRobertaTokenizer,
															    BartTokenizer,
															    BartTokenizerFast,
															):
																	# HACK(label indices are swapped in RoBERTa pretrained model)
																	snake_case_ ,       snake_case_				:							List[str]						 =       label_list[2], label_list[1]
															snake_case_				:							Dict						 =       label_list

															snake_case_				:							int						 =       processor.get_dev_examples(_SCREAMING_SNAKE_CASE				) if evaluate else processor.get_train_examples(_SCREAMING_SNAKE_CASE				)
															snake_case_				:							str						 =       hans_convert_examples_to_features(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE				)

															def gen():
																	for ex_index, ex in tqdm.tqdm(enumerate(self.features				)		,				desc="convert examples to features"				):
																			if ex_index % 1_0000 == 0:
																					logger.info("Writing example %d of %d" % (ex_index, len(_SCREAMING_SNAKE_CASE				))				)

																			yield (
																			    {
																			        "example_id": 0,
																			        "input_ids": ex.input_ids,
																			        "attention_mask": ex.attention_mask,
																			        "token_type_ids": ex.token_type_ids,
																			    },
																			    ex.label,
																			)

															snake_case_				:							List[Any]						 =       tf.data.Dataset.from_generator(
															    _SCREAMING_SNAKE_CASE		,				(
															        {
															            "example_id": tf.intaa,
															            "input_ids": tf.intaa,
															            "attention_mask": tf.intaa,
															            "token_type_ids": tf.intaa,
															        },
															        tf.intaa,
															    )		,				(
															        {
															            "example_id": tf.TensorShape([]				),
															            "input_ids": tf.TensorShape([None, None]				),
															            "attention_mask": tf.TensorShape([None, None]				),
															            "token_type_ids": tf.TensorShape([None, None]				),
															        },
															        tf.TensorShape([]				),
															    )		,				)






													def       _lowerCAmelCase       (	self				) ->				int:
															return self.dataset






													def __len__(	self				) ->				int:
															return len(self.features				)






													def __getitem__(	self		,				_SCREAMING_SNAKE_CASE				) ->				InputFeatures:
															return self.features[i]






													def       _lowerCAmelCase       (	self				) ->				Dict:
															return self.label_list




class 		UpperCAmelCase_						(	SCREAMING_SNAKE_CASE__					):


						'''simple docstring'''




						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE				) ->				int:
								return self._create_examples(self._read_tsv(os.path.join(_SCREAMING_SNAKE_CASE		,				"heuristics_train_set.txt"				)				)		,				"train"				)






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE				) ->				List[Any]:
								return self._create_examples(self._read_tsv(os.path.join(_SCREAMING_SNAKE_CASE		,				"heuristics_evaluation_set.txt"				)				)		,				"dev"				)






						def       _lowerCAmelCase       (	self				) ->				Dict:
								return ["contradiction", "entailment", "neutral"]






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE				) ->				Optional[int]:
								snake_case_				:							Optional[Any]						 =       []
								for i, line in enumerate(_SCREAMING_SNAKE_CASE				):
										if i == 0:
												continue
										snake_case_				:							List[Any]						 =       "%s-%s" % (set_type, line[0])
										snake_case_				:							int						 =       line[5]
										snake_case_				:							str						 =       line[6]
										snake_case_				:							Any						 =       line[7][2:] if line[7].startswith("ex"				) else line[7]
										snake_case_				:							Dict						 =       line[0]
										examples.append(InputExample(guid=_SCREAMING_SNAKE_CASE		,				text_a=_SCREAMING_SNAKE_CASE		,				text_b=_SCREAMING_SNAKE_CASE		,				label=_SCREAMING_SNAKE_CASE		,				pairID=_SCREAMING_SNAKE_CASE				)				)
								return examples




def      lowerCAmelCase__	(    _a       :			List[InputExample]  ,      _a       :			List[str]  ,      _a       :			int  ,      _a       :			PreTrainedTokenizer  ,      ):
		snake_case_				:							Optional[Any]						 =       {label: i for i, label in enumerate(_a    )}

		snake_case_				:							Optional[Any]						 =       []
		for ex_index, example in tqdm.tqdm(enumerate(_a    )  ,      desc="convert examples to features"    ):
				if ex_index % 1_00_00 == 0:
						logger.info("Writing example %d" % (ex_index)    )

				snake_case_				:							Optional[Any]						 =       tokenizer(
				    example.text_a  ,      example.text_b  ,      add_special_tokens=_a  ,      max_length=_a  ,      padding="max_length"  ,      truncation=_a  ,      return_overflowing_tokens=_a  ,      )

				snake_case_				:							Dict						 =       label_map[example.label] if example.label in label_map else 0

				snake_case_				:							Optional[Any]						 =       int(example.pairID    )

				features.append(InputFeatures(**_a  ,      label=_a  ,      pairID=_a    )    )

		for i, example in enumerate(examples[:5]    ):
				logger.info("*** Example ***"    )
				logger.info(F'''guid: {example}'''    )
				logger.info(F'''features: {features[i]}'''    )

		return features


lowercase  :							List[str]			  =    {
    '''hans''': 3,
}

lowercase  :							int			  =    {
    '''hans''': HansProcessor,
}
