
"""simple docstring"""




import argparse
from collections import OrderedDict
from pathlib import Path

import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from torchvision.transforms import functional as F

from transformers import DetrImageProcessor, TableTransformerConfig, TableTransformerForObjectDetection
from transformers.utils import logging


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

# here we list all keys to be renamed (original name on the left, our name on the right)
A__   :					Union[str, Any]							=   []
for i in range(6):
   # encoder layers: output projection, 2 feedforward neural networks and 2 layernorms
   rename_keys.append(
       (f"""transformer.encoder.layers.{i}.self_attn.out_proj.weight""", f"""encoder.layers.{i}.self_attn.out_proj.weight""")
   )
   rename_keys.append(
       (f"""transformer.encoder.layers.{i}.self_attn.out_proj.bias""", f"""encoder.layers.{i}.self_attn.out_proj.bias""")
   )
   rename_keys.append((f"""transformer.encoder.layers.{i}.linear1.weight""", f"""encoder.layers.{i}.fc1.weight"""))
   rename_keys.append((f"""transformer.encoder.layers.{i}.linear1.bias""", f"""encoder.layers.{i}.fc1.bias"""))
   rename_keys.append((f"""transformer.encoder.layers.{i}.linear2.weight""", f"""encoder.layers.{i}.fc2.weight"""))
   rename_keys.append((f"""transformer.encoder.layers.{i}.linear2.bias""", f"""encoder.layers.{i}.fc2.bias"""))
   rename_keys.append(
       (f"""transformer.encoder.layers.{i}.norm1.weight""", f"""encoder.layers.{i}.self_attn_layer_norm.weight""")
   )
   rename_keys.append((f"""transformer.encoder.layers.{i}.norm1.bias""", f"""encoder.layers.{i}.self_attn_layer_norm.bias"""))
   rename_keys.append((f"""transformer.encoder.layers.{i}.norm2.weight""", f"""encoder.layers.{i}.final_layer_norm.weight"""))
   rename_keys.append((f"""transformer.encoder.layers.{i}.norm2.bias""", f"""encoder.layers.{i}.final_layer_norm.bias"""))
   # decoder layers: 2 times output projection, 2 feedforward neural networks and 3 layernorms
   rename_keys.append(
       (f"""transformer.decoder.layers.{i}.self_attn.out_proj.weight""", f"""decoder.layers.{i}.self_attn.out_proj.weight""")
   )
   rename_keys.append(
       (f"""transformer.decoder.layers.{i}.self_attn.out_proj.bias""", f"""decoder.layers.{i}.self_attn.out_proj.bias""")
   )
   rename_keys.append(
       (
           f"""transformer.decoder.layers.{i}.multihead_attn.out_proj.weight""",
           f"""decoder.layers.{i}.encoder_attn.out_proj.weight""",
       )
   )
   rename_keys.append(
       (
           f"""transformer.decoder.layers.{i}.multihead_attn.out_proj.bias""",
           f"""decoder.layers.{i}.encoder_attn.out_proj.bias""",
       )
   )
   rename_keys.append((f"""transformer.decoder.layers.{i}.linear1.weight""", f"""decoder.layers.{i}.fc1.weight"""))
   rename_keys.append((f"""transformer.decoder.layers.{i}.linear1.bias""", f"""decoder.layers.{i}.fc1.bias"""))
   rename_keys.append((f"""transformer.decoder.layers.{i}.linear2.weight""", f"""decoder.layers.{i}.fc2.weight"""))
   rename_keys.append((f"""transformer.decoder.layers.{i}.linear2.bias""", f"""decoder.layers.{i}.fc2.bias"""))
   rename_keys.append(
       (f"""transformer.decoder.layers.{i}.norm1.weight""", f"""decoder.layers.{i}.self_attn_layer_norm.weight""")
   )
   rename_keys.append((f"""transformer.decoder.layers.{i}.norm1.bias""", f"""decoder.layers.{i}.self_attn_layer_norm.bias"""))
   rename_keys.append(
       (f"""transformer.decoder.layers.{i}.norm2.weight""", f"""decoder.layers.{i}.encoder_attn_layer_norm.weight""")
   )
   rename_keys.append(
       (f"""transformer.decoder.layers.{i}.norm2.bias""", f"""decoder.layers.{i}.encoder_attn_layer_norm.bias""")
   )
   rename_keys.append((f"""transformer.decoder.layers.{i}.norm3.weight""", f"""decoder.layers.{i}.final_layer_norm.weight"""))
   rename_keys.append((f"""transformer.decoder.layers.{i}.norm3.bias""", f"""decoder.layers.{i}.final_layer_norm.bias"""))

# convolutional projection + query embeddings + layernorm of encoder + layernorm of decoder + class and bounding box heads
rename_keys.extend(
    [
        ('input_proj.weight', 'input_projection.weight'),
        ('input_proj.bias', 'input_projection.bias'),
        ('query_embed.weight', 'query_position_embeddings.weight'),
        ('transformer.encoder.norm.weight', 'encoder.layernorm.weight'),
        ('transformer.encoder.norm.bias', 'encoder.layernorm.bias'),
        ('transformer.decoder.norm.weight', 'decoder.layernorm.weight'),
        ('transformer.decoder.norm.bias', 'decoder.layernorm.bias'),
        ('class_embed.weight', 'class_labels_classifier.weight'),
        ('class_embed.bias', 'class_labels_classifier.bias'),
        ('bbox_embed.layers.0.weight', 'bbox_predictor.layers.0.weight'),
        ('bbox_embed.layers.0.bias', 'bbox_predictor.layers.0.bias'),
        ('bbox_embed.layers.1.weight', 'bbox_predictor.layers.1.weight'),
        ('bbox_embed.layers.1.bias', 'bbox_predictor.layers.1.bias'),
        ('bbox_embed.layers.2.weight', 'bbox_predictor.layers.2.weight'),
        ('bbox_embed.layers.2.bias', 'bbox_predictor.layers.2.bias'),
    ]
)




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			Union[str, Any]       =     state_dict.pop(_UpperCamelCase						)
  _lowercase:			Dict       =     val




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			Optional[Any]       =     OrderedDict()
  for key, value in state_dict.items():
    if "backbone.0.body" in key:
      _lowercase:			Optional[int]       =     key.replace('''backbone.0.body''' ,				'''backbone.conv_encoder.model'''						)
      _lowercase:			Union[str, Any]       =     value
    else:
      _lowercase:			str       =     value

  return new_state_dict




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			Dict       =     ''''''

  # first: transformer encoder
  for i in range(6						):
    # read in weights + bias of input projection layer (in PyTorch's MultiHeadAttention, this is a single matrix + bias)
    _lowercase:			Optional[int]       =     state_dict.pop(f'''{prefix}transformer.encoder.layers.{i}.self_attn.in_proj_weight'''						)
    _lowercase:			List[Any]       =     state_dict.pop(f'''{prefix}transformer.encoder.layers.{i}.self_attn.in_proj_bias'''						)
    # next, add query, keys and values (in that order) to the state dict
    _lowercase:			Optional[Any]       =     in_proj_weight[:256, :]
    _lowercase:			Union[str, Any]       =     in_proj_bias[:256]
    _lowercase:			Optional[int]       =     in_proj_weight[256:512, :]
    _lowercase:			List[str]       =     in_proj_bias[256:512]
    _lowercase:			Union[str, Any]       =     in_proj_weight[-256:, :]
    _lowercase:			Dict       =     in_proj_bias[-256:]
  # next: transformer decoder (which is a bit more complex because it also includes cross-attention)
  for i in range(6						):
    # read in weights + bias of input projection layer of self-attention
    _lowercase:			Any       =     state_dict.pop(f'''{prefix}transformer.decoder.layers.{i}.self_attn.in_proj_weight'''						)
    _lowercase:			str       =     state_dict.pop(f'''{prefix}transformer.decoder.layers.{i}.self_attn.in_proj_bias'''						)
    # next, add query, keys and values (in that order) to the state dict
    _lowercase:			int       =     in_proj_weight[:256, :]
    _lowercase:			Optional[int]       =     in_proj_bias[:256]
    _lowercase:			Tuple       =     in_proj_weight[256:512, :]
    _lowercase:			Any       =     in_proj_bias[256:512]
    _lowercase:			Union[str, Any]       =     in_proj_weight[-256:, :]
    _lowercase:			Union[str, Any]       =     in_proj_bias[-256:]
    # read in weights + bias of input projection layer of cross-attention
    _lowercase:			List[str]       =     state_dict.pop(
        f'''{prefix}transformer.decoder.layers.{i}.multihead_attn.in_proj_weight'''						)
    _lowercase:			Tuple       =     state_dict.pop(f'''{prefix}transformer.decoder.layers.{i}.multihead_attn.in_proj_bias'''						)
    # next, add query, keys and values (in that order) of cross-attention to the state dict
    _lowercase:			Any       =     in_proj_weight_cross_attn[:256, :]
    _lowercase:			List[str]       =     in_proj_bias_cross_attn[:256]
    _lowercase:			List[Any]       =     in_proj_weight_cross_attn[256:512, :]
    _lowercase:			Tuple       =     in_proj_bias_cross_attn[256:512]
    _lowercase:			int       =     in_proj_weight_cross_attn[-256:, :]
    _lowercase:			Optional[int]       =     in_proj_bias_cross_attn[-256:]




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			List[str]       =     image.size
  _lowercase:			Any       =     max(_UpperCamelCase ,				_UpperCamelCase						)
  _lowercase:			List[str]       =     800 if '''detection''' in checkpoint_url else 1_000
  _lowercase:			Union[str, Any]       =     target_max_size / current_max_size
  _lowercase:			Dict       =     image.resize((int(round(scale * width						)						), int(round(scale * height						)						))						)

  return resized_image




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			List[str]       =     F.to_tensor(_UpperCamelCase						)
  _lowercase:			List[str]       =     F.normalize(_UpperCamelCase ,				mean=[0.485, 0.456, 0.406] ,				std=[0.229, 0.224, 0.225]						)
  return image




@torch.no_grad()
def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  logger.info('''Converting model...'''						)

  # load original state dict
  _lowercase:			Union[str, Any]       =     torch.hub.load_state_dict_from_url(_UpperCamelCase ,				map_location='''cpu'''						)
  # rename keys
  for src, dest in rename_keys:
    rename_key(_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						)
  _lowercase:			List[str]       =     rename_backbone_keys(_UpperCamelCase						)
  # query, key and value matrices need special treatment
  read_in_q_k_v(_UpperCamelCase						)
  # important: we need to prepend a prefix to each of the base model keys as the head models use different attributes for them
  _lowercase:			Optional[int]       =     '''model.'''
  for key in state_dict.copy().keys():
    if not key.startswith('''class_labels_classifier'''						) and not key.startswith('''bbox_predictor'''						):
      _lowercase:			Any       =     state_dict.pop(_UpperCamelCase						)
      _lowercase:			Union[str, Any]       =     val
    # create HuggingFace model and load state dict
  _lowercase:			Dict       =     TableTransformerConfig(
      backbone='''resnet18''' ,				mask_loss_coefficient=1 ,				dice_loss_coefficient=1 ,				ce_loss_coefficient=1 ,				bbox_loss_coefficient=5 ,				giou_loss_coefficient=2 ,				eos_coefficient=0.4 ,				class_cost=1 ,				bbox_cost=5 ,				giou_cost=2 ,				)

  if "detection" in checkpoint_url:
    _lowercase:			Optional[Any]       =     15
    _lowercase:			int       =     2
    _lowercase:			str       =     {0: '''table''', 1: '''table rotated'''}
    _lowercase:			Union[str, Any]       =     idalabel
    _lowercase:			List[str]       =     {v: k for k, v in idalabel.items()}
  else:
    _lowercase:			int       =     125
    _lowercase:			Union[str, Any]       =     6
    _lowercase:			List[str]       =     {
        0: '''table''',
        1: '''table column''',
        2: '''table row''',
        3: '''table column header''',
        4: '''table projected row header''',
        5: '''table spanning cell''',
    }
    _lowercase:			Optional[int]       =     idalabel
    _lowercase:			Tuple       =     {v: k for k, v in idalabel.items()}

  _lowercase:			str       =     DetrImageProcessor(
      format='''coco_detection''' ,				max_size=800 if '''detection''' in checkpoint_url else 1_000						)
  _lowercase:			Dict       =     TableTransformerForObjectDetection(_UpperCamelCase						)
  model.load_state_dict(_UpperCamelCase						)
  model.eval()

  # verify our conversion
  _lowercase:			Union[str, Any]       =     '''example_pdf.png''' if '''detection''' in checkpoint_url else '''example_table.png'''
  _lowercase:			Optional[Any]       =     hf_hub_download(repo_id='''nielsr/example-pdf''' ,				repo_type='''dataset''' ,				filename=_UpperCamelCase						)
  _lowercase:			List[str]       =     Image.open(_UpperCamelCase						).convert('''RGB'''						)
  _lowercase:			int       =     normalize(resize(_UpperCamelCase ,				_UpperCamelCase						)						).unsqueeze(0						)

  _lowercase:			Union[str, Any]       =     model(_UpperCamelCase						)

  if "detection" in checkpoint_url:
    _lowercase:			int       =     (1, 15, 3)
    _lowercase:			str       =     torch.tensor(
        [[-6.7_897, -16.9_985, 6.7_937], [-8.0_186, -22.2_192, 6.9_677], [-7.3_117, -21.0_708, 7.4_055]]						)
    _lowercase:			Dict       =     torch.tensor([[0.4_867, 0.1_767, 0.6_732], [0.6_718, 0.4_479, 0.3_830], [0.4_716, 0.1_760, 0.6_364]]						)

  else:
    _lowercase:			Union[str, Any]       =     (1, 125, 7)
    _lowercase:			str       =     torch.tensor(
        [[-18.1_430, -8.3_214, 4.8_274], [-18.4_685, -7.1_361, -4.2_667], [-26.3_693, -9.3_429, -4.9_962]]						)
    _lowercase:			Tuple       =     torch.tensor([[0.4_983, 0.5_595, 0.9_440], [0.4_916, 0.6_315, 0.5_954], [0.6_108, 0.8_637, 0.1_135]]						)

  assert outputs.logits.shape == expected_shape
  assert torch.allclose(outputs.logits[0, :3, :3] ,				_UpperCamelCase ,				atol=1e-4						)
  assert torch.allclose(outputs.pred_boxes[0, :3, :3] ,				_UpperCamelCase ,				atol=1e-4						)
  print('''Looks ok!'''						)

  if pytorch_dump_folder_path is not None:
    # Save model and image processor
    logger.info(f'''Saving PyTorch model and image processor to {pytorch_dump_folder_path}...'''						)
    Path(_UpperCamelCase						).mkdir(exist_ok=_UpperCamelCase						)
    model.save_pretrained(_UpperCamelCase						)
    image_processor.save_pretrained(_UpperCamelCase						)

  if push_to_hub:
    # Push model to HF hub
    logger.info('''Pushing model to the hub...'''						)
    _lowercase:			int       =     (
        '''microsoft/table-transformer-detection'''
        if '''detection''' in checkpoint_url
        else '''microsoft/table-transformer-structure-recognition'''
    )
    model.push_to_hub(_UpperCamelCase						)
    image_processor.push_to_hub(_UpperCamelCase						)


if __name__ == "__main__":
   A__   :					Union[str, Any]							=   argparse.ArgumentParser()

   parser.add_argument(
       '--checkpoint_url',
       default='https://pubtables1m.blob.core.windows.net/model/pubtables1m_detection_detr_r18.pth',
       type=str,
       choices=[
           'https://pubtables1m.blob.core.windows.net/model/pubtables1m_detection_detr_r18.pth',
           'https://pubtables1m.blob.core.windows.net/model/pubtables1m_structure_detr_r18.pth',
       ],
       help='URL of the Table Transformer checkpoint you\'d like to convert.',
   )
   parser.add_argument(
       '--pytorch_dump_folder_path', default=None, type=str, help='Path to the folder to output PyTorch model.'
   )
   parser.add_argument(
       '--push_to_hub', action='store_true', help='Whether or not to push the converted model to the 🤗 hub.'
   )
   A__   :					List[str]							=   parser.parse_args()
   convert_table_transformer_checkpoint(args.checkpoint_url, args.pytorch_dump_folder_path, args.push_to_hub)


"""simple docstring"""




import os
import re
import shutil
from argparse import ArgumentParser, Namespace

from datasets.commands import BaseDatasetsCLICommand
from datasets.utils.logging import get_logger


A__   :					Optional[Any]							=   '<<<<<<< This should probably be modified because it mentions: '

A__   :					Any							=   '=======\n>>>>>>>\n'

A__   :					int							=   [
    'TextEncoderConfig',
    'ByteTextEncoder',
    'SubwordTextEncoder',
    'encoder_config',
    'maybe_build_from_corpus',
    'manual_dir',
]

A__   :					Union[str, Any]							=   [
    # (pattern, replacement)
    # Order is important here for some replacements
    (r'tfds\.core', r'datasets'),
    (r'tf\.io\.gfile\.GFile', r'open'),
    (r'tf\.([\w\d]+)', r'datasets.Value(\'\1\')'),
    (r'tfds\.features\.Text\(\)', r'datasets.Value(\'string\')'),
    (r'tfds\.features\.Text\(', r'datasets.Value(\'string\'),'),
    (r'features\s*=\s*tfds.features.FeaturesDict\(', r'features=datasets.Features('),
    (r'tfds\.features\.FeaturesDict\(', r'dict('),
    (r'The TensorFlow Datasets Authors', r'The TensorFlow Datasets Authors and the HuggingFace Datasets Authors'),
    (r'tfds\.', r'datasets.'),
    (r'dl_manager\.manual_dir', r'self.config.data_dir'),
    (r'self\.builder_config', r'self.config'),
]




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  return ConvertCommand(args.tfds_path ,				args.datasets_directory						)







class 			__magic_name__       (       SCREAMING_SNAKE_CASE__ ):
       @staticmethod
       def 							lowercase_							(     A_       )     ->	Union[str, Any]:





         """simple docstring"""




         _lowercase:			int       =     parser.add_parser(
             '''convert''' ,				help='''Convert a TensorFlow Datasets dataset to a HuggingFace Datasets dataset.''' ,				)
         train_parser.add_argument(
             '''--tfds_path''' ,				type=A_ ,				required=A_ ,				help='''Path to a TensorFlow Datasets folder to convert or a single tfds file to convert.''' ,				)
         train_parser.add_argument(
             '''--datasets_directory''' ,				type=A_ ,				required=A_ ,				help='''Path to the HuggingFace Datasets folder.'''       )
         train_parser.set_defaults(func=A_       )
       def __init__(     self ,				A_ ,				A_ ,				*A_       )     ->	Tuple:





         """simple docstring"""




         _lowercase:			Optional[Any]       =     get_logger('''datasets-cli/converting'''       )

         _lowercase:			Optional[Any]       =     tfds_path
         _lowercase:			Dict       =     datasets_directory



       def 							lowercase_							(     self       )     ->	Any:





         """simple docstring"""




         if os.path.isdir(self._tfds_path       ):
           _lowercase:			Optional[Any]       =     os.path.abspath(self._tfds_path       )
         elif os.path.isfile(self._tfds_path       ):
           _lowercase:			Any       =     os.path.dirname(self._tfds_path       )
         else:
           raise ValueError('''--tfds_path is neither a directory nor a file. Please check path.'''       )

         _lowercase:			Dict       =     os.path.abspath(self._datasets_directory       )

         self._logger.info(f'''Converting datasets from {abs_tfds_path} to {abs_datasets_path}'''       )

         _lowercase:			Tuple       =     []
         _lowercase:			List[str]       =     []
         _lowercase:			int       =     {}

         if os.path.isdir(self._tfds_path       ):
           _lowercase:			str       =     os.listdir(A_       )
         else:
           _lowercase:			Tuple       =     [os.path.basename(self._tfds_path       )]

         for f_name in file_names:
           self._logger.info(f'''Looking at file {f_name}'''       )
           _lowercase:			Optional[int]       =     os.path.join(A_ ,				A_       )
           _lowercase:			Optional[Any]       =     os.path.join(A_ ,				A_       )

           if not os.path.isfile(A_       ) or "__init__" in f_name or "_test" in f_name or ".py" not in f_name:
             self._logger.info('''Skipping file'''       )
             continue

           with open(A_ ,				encoding='''utf-8'''       ) as f:
             _lowercase:			Any       =     f.readlines()

           _lowercase:			str       =     []
           _lowercase:			Dict       =     False
           _lowercase:			Any       =     False
           _lowercase:			Tuple       =     []
           for line in lines:
             _lowercase:			str       =     line

             # Convert imports
             if "import tensorflow.compat.v2 as tf" in out_line:
               continue
             elif "@tfds.core" in out_line:
               continue
             elif "builder=self" in out_line:
               continue
             elif "import tensorflow_datasets.public_api as tfds" in out_line:
               _lowercase:			Optional[Any]       =     '''import datasets\n'''
             elif "import tensorflow" in out_line:
               # order is important here
               _lowercase:			Any       =     ''''''
               continue
             elif "from absl import logging" in out_line:
               _lowercase:			Dict       =     '''from datasets import logging\n'''
             elif "getLogger" in out_line:
               _lowercase:			Optional[Any]       =     out_line.replace('''getLogger''' ,				'''get_logger'''       )
             elif any(expression in out_line for expression in TO_HIGHLIGHT       ):
               _lowercase:			int       =     True
               _lowercase:			List[str]       =     list(filter(lambda A_       : e in out_line ,				A_       )       )
               out_lines.append(HIGHLIGHT_MESSAGE_PRE + str(A_       ) + '''\n'''       )
               out_lines.append(A_       )
               out_lines.append(A_       )
               continue
             else:
               for pattern, replacement in TO_CONVERT:
                 _lowercase:			Tuple       =     re.sub(A_ ,				A_ ,				A_       )

                # Take care of saving utilities (to later move them together with main script)
             if "tensorflow_datasets" in out_line:
               _lowercase:			Optional[int]       =     re.match(R'''from\stensorflow_datasets.*import\s([^\.\r\n]+)''' ,				A_       )
               tfds_imports.extend(imp.strip() for imp in match.group(1       ).split(''','''       )       )
               _lowercase:			Dict       =     '''from . import ''' + match.group(1       )

             # Check we have not forget anything
             if "tf." in out_line or "tfds." in out_line or "tensorflow_datasets" in out_line:
               raise ValueError(f'''Error converting {out_line.strip()}'''       )

             if "GeneratorBasedBuilder" in out_line or "BeamBasedBuilder" in out_line:
               _lowercase:			Tuple       =     True
             out_lines.append(A_       )

           if is_builder or "wmt" in f_name:
             # We create a new directory for each dataset
             _lowercase:			List[str]       =     f_name.replace('''.py''' ,				''''''       )
             _lowercase:			Dict       =     os.path.join(A_ ,				A_       )
             _lowercase:			Dict       =     os.path.join(A_ ,				A_       )
             os.makedirs(A_ ,				exist_ok=A_       )
             self._logger.info(f'''Adding directory {output_dir}'''       )
             imports_to_builder_map.update({imp: output_dir for imp in tfds_imports}       )
           else:
             # Utilities will be moved at the end
             utils_files.append(A_       )

           if needs_manual_update:
             with_manual_update.append(A_       )

           with open(A_ ,				'''w''' ,				encoding='''utf-8'''       ) as f:
             f.writelines(A_       )
           self._logger.info(f'''Converted in {output_file}'''       )

         for utils_file in utils_files:
           try:
             _lowercase:			Optional[int]       =     os.path.basename(A_       )
             _lowercase:			List[Any]       =     imports_to_builder_map[f_name.replace('''.py''' ,				''''''       )]
             self._logger.info(f'''Moving {dest_folder} to {utils_file}'''       )
             shutil.copy(A_ ,				A_       )
           except KeyError:
             self._logger.error(f'''Cannot find destination folder for {utils_file}. Please copy manually.'''       )

         if with_manual_update:
           for file_path in with_manual_update:
             self._logger.warning(
                 f'''You need to manually update file {file_path} to remove configurations using \'TextEncoderConfig\'.'''       )
