"""simple docstring"""






def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase       ,    __UpperCAmelCase )  ->  Tuple:
   # "extended trapezoidal rule"
   # int(f) = dx/2 * (f1 + 2f2 + ... + fn)
   lowercase__:   Union[str, Any]					=      (boundary[1] - boundary[0]) / steps
   lowercase__:   int					=      boundary[0]
   lowercase__:   Optional[int]					=      boundary[1]
   lowercase__:   str					=      make_points(__UpperCAmelCase       ,    __UpperCAmelCase       ,    __UpperCAmelCase )
   lowercase__:   Dict					=      0.0
   y += (h / 2.0) * f(__UpperCAmelCase )
   for i in x_i:
      # print(i)
      y += h * f(__UpperCAmelCase )
   y += (h / 2.0) * f(__UpperCAmelCase )
   return y



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase       ,    __UpperCAmelCase       ,    __UpperCAmelCase )  ->  List[Any]:
   lowercase__:   Dict					=      a + h
   while x < (b - h):
      yield x
      lowercase__:   List[str]					=      x + h



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase )  ->  Any:  # enter your function here
   lowercase__:   List[Any]					=      (x - 0) * (x - 0)
   return y



def SCREAMING_SNAKE_CASE__			(   )  ->  Tuple:
   lowercase__:   Tuple					=      0.0  # Lower bound of integration
   lowercase__:   Optional[Any]					=      1.0  # Upper bound of integration
   lowercase__:   Any					=      1_0.0  # define number of steps or resolution
   lowercase__:   Dict					=      [a, b]  # define boundary of integration
   lowercase__:   Dict					=      method_a(__UpperCAmelCase       ,    __UpperCAmelCase )
   print(F"""y = {y}""" )


if __name__ == "__main__":
       main()

"""simple docstring"""






import argparse

import torch

from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel
from transformers.utils import logging


logging.set_verbosity_info()



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase       ,    __UpperCAmelCase       ,    __UpperCAmelCase       ,    __UpperCAmelCase )  ->  List[Any]:
   # Initialise PyTorch model
   lowercase__:   Optional[Any]					=      FunnelConfig.from_json_file(__UpperCAmelCase )
   print(F"""Building PyTorch model from configuration: {config}""" )
   lowercase__:   List[Any]					=      FunnelBaseModel(__UpperCAmelCase ) if base_model else FunnelModel(__UpperCAmelCase )

   # Load weights from tf checkpoint
   load_tf_weights_in_funnel(__UpperCAmelCase       ,    __UpperCAmelCase       ,    __UpperCAmelCase )

   # Save pytorch-model
   print(F"""Save PyTorch model to {pytorch_dump_path}""" )
   torch.save(model.state_dict()       ,    __UpperCAmelCase )


if __name__ == "__main__":
       __A			   = argparse.ArgumentParser()
       # Required parameters
       parser.add_argument(
           "--tf_checkpoint_path", default=None, type=str, required=True, help="Path to the TensorFlow checkpoint path."
       )
       parser.add_argument(
           "--config_file",
           default=None,
           type=str,
           required=True,
           help="The config json file corresponding to the pre-trained model. \nThis specifies the model architecture.",
       )
       parser.add_argument(
           "--pytorch_dump_path", default=None, type=str, required=True, help="Path to the output PyTorch model."
       )
       parser.add_argument(
           "--base_model", action="store_true", help="Whether you want just the base model (no decoder) or not."
       )
       __A			   = parser.parse_args()
       convert_tf_checkpoint_to_pytorch(
           args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path, args.base_model
       )
