code: 
  
  import copy
  from typing import Dict
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  from ..auto.configuration_auto import CONFIG_MAPPING
  from ..bit import BitConfig
  
  
  lowerCamelCase     =      logging.get_logger(__name__)
  
  lowerCamelCase     =      {
      '''google/vit-hybrid-base-bit-384''': '''https://huggingface.co/vit-hybrid-base-bit-384/resolve/main/config.json''',
      # See all ViT hybrid models at https://huggingface.co/models?filter=vit
  }
  
  
  
  
  
  
  
  class 		__magic_name__    (							lowerCamelCase__							):
  
     '''simple docstring'''
  
  
  
  
     lowerCamelCase__				:			Tuple												=     'vit-hybrid'
  
  
  
     def __init__(       self,					lowercase_=None,					lowercase_=768,					lowercase_=12,					lowercase_=12,					lowercase_=3072,					lowercase_="gelu",					lowercase_=0.0,					lowercase_=0.0,					lowercase_=0.02,					lowercase_=1E-12,					lowercase_=224,					lowercase_=1,					lowercase_=3,					lowercase_=[1, 1024, 24, 24],					lowercase_=True,					**lowercase_,					)							->					Tuple:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       super().__init__(**lowercase_ )
  
       if backbone_config is None:
         logger.info('''`backbone_config` is `None`. Initializing the config with a `BiT` backbone.''' )
         a__						={
             '''global_padding''': '''same''',
             '''layer_type''': '''bottleneck''',
             '''depths''': [3, 4, 9],
             '''out_features''': ['''stage3'''],
             '''embedding_dynamic_padding''': True,
         }
  
       if isinstance(lowercase_,					lowercase_ ):
         if "model_type" in backbone_config:
           a__						=CONFIG_MAPPING[backbone_config['''model_type''']]
         else:
           logger.info(
               '''`model_type` is not found in `backbone_config`. Use `Bit` as the backbone configuration class.''' )
           a__						=BitConfig
         a__						=backbone_config_class(**lowercase_ )
  
       a__						=backbone_featmap_shape
       a__						=backbone_config
       a__						=hidden_size
       a__						=num_hidden_layers
       a__						=num_attention_heads
       a__						=intermediate_size
       a__						=hidden_act
       a__						=hidden_dropout_prob
       a__						=attention_probs_dropout_prob
       a__						=initializer_range
       a__						=layer_norm_eps
       a__						=image_size
       a__						=patch_size
       a__						=num_channels
       a__						=qkv_bias
  
  
  
     def 				_UpperCAmelCase				(       self )							->					Dict[str, any]:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       a__						=copy.deepcopy(self.__dict__ )
       a__						=self.backbone_config.to_dict()
       a__						=self.__class__.model_type
       return output
  
style_context: 
  
  import torch
  from transformers import AutoModelForSequenceClassification, AutoTokenizer, Trainer, TrainingArguments
  
  import datasets
  
  
  lowerCamelCase     =      '''\
  @article{eddine2021frugalscore,
    title={FrugalScore: Learning Cheaper, Lighter and Faster Evaluation Metrics for Automatic Text Generation},
    author={Eddine, Moussa Kamal and Shang, Guokan and Tixier, Antoine J-P and Vazirgiannis, Michalis},
    journal={arXiv preprint arXiv:2110.08559},
    year={2021}
  }
  '''
  
  lowerCamelCase     =      '''\
  FrugalScore is a reference-based metric for NLG models evaluation. It is based on a distillation approach that allows to learn a fixed, low cost version of any expensive NLG metric, while retaining most of its original performance.
  '''
  
  
  lowerCamelCase     =      '''
  Calculates how good are predictions given some references, using certain scores.
  Args:
      predictions (list of str): list of predictions to score. Each predictions
          should be a string.
      references (list of str): list of reference for each prediction. Each
          reference should be a string.
      batch_size (int): the batch size for predictions.
      max_length (int): maximum sequence length.
      device (str): either gpu or cpu
  Returns:
      scores (list of int): list of scores.
  Examples:
      >>> frugalscore = datasets.load_metric("frugalscore")
      >>> results = frugalscore.compute(predictions=[\'hello there\', \'huggingface\'], references=[\'hello world\', \'hugging face\'])
      >>> print([round(s, 3) for s in results["scores"]])
      [0.631, 0.645]
  '''
  
  
  
  
  
  
  
  @datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION	, _KWARGS_DESCRIPTION							)
  class 		__magic_name__    (							datasets.Metric							):
  
     '''simple docstring'''
  
  
  
  
     def 				_UpperCAmelCase				(       self )							->					Optional[int]:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       return datasets.MetricInfo(
           description=_DESCRIPTION,					citation=_CITATION,					inputs_description=_KWARGS_DESCRIPTION,					features=datasets.Features(
               {
                   '''predictions''': datasets.Value('''string''' ),
                   '''references''': datasets.Value('''string''' ),
               } ),					homepage='''https://github.com/moussaKam/FrugalScore''',					)
  
  
  
     def 				_UpperCAmelCase				(       self,					lowercase_ )							->					Dict:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       if self.config_name == "default":
         a__						='''moussaKam/frugalscore_tiny_bert-base_bert-score'''
       else:
         a__						=self.config_name
       a__						=AutoModelForSequenceClassification.from_pretrained(lowercase_ )
       a__						=AutoTokenizer.from_pretrained(lowercase_ )
  
  
  
     def 				_UpperCAmelCase				(       self,					lowercase_,					lowercase_,					lowercase_=32,					lowercase_=128,					lowercase_=None,					)							->					Union[str, Any]:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       assert len(lowercase_ ) == len(
           lowercase_ ), "predictions and references should have the same number of sentences."
       if device is not None:
         assert device in ["gpu", "cpu"], "device should be either gpu or cpu."
       else:
         a__						='''gpu''' if torch.cuda.is_available() else '''cpu'''
       a__						=TrainingArguments(
           '''trainer''',					fpaa=(device == '''gpu'''),					per_device_eval_batch_size=lowercase_,					report_to='''all''',					no_cuda=(device == '''cpu'''),					log_level='''warning''',					)
       a__						={'''sentence1''': predictions, '''sentence2''': references}
       a__						=datasets.Dataset.from_dict(lowercase_ )
  
       def tokenize_function(lowercase_ ):
         return self.tokenizer(
             data['''sentence1'''],					data['''sentence2'''],					max_length=lowercase_,					truncation=lowercase_,					padding=lowercase_ )
  
       a__						=raw_datasets.map(lowercase_,					batched=lowercase_ )
       tokenized_datasets.remove_columns(['''sentence1''', '''sentence2'''] )
       a__						=Trainer(self.model,					lowercase_,					tokenizer=self.tokenizer )
       a__						=trainer.predict(lowercase_ )
       return {"scores": list(predictions.predictions.squeeze(-1 ) )}
  