code: 
  """simple docstring"""
  
  
  
  
  
  import argparse
  
  import torch
  
  from transformers import ChineseCLIPConfig, ChineseCLIPModel
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						):
     UpperCAmelCase_      :      List[Any]      =					pt_weights[f"""{prefix}.in_proj_weight"""].chunk(3,	dim=0						)
     UpperCAmelCase_      :      List[str]      =					pt_weights[f"""{prefix}.in_proj_bias"""].chunk(3,	dim=0						)
  
     UpperCAmelCase_      :      Union[str, Any]      =					pt_weights[f"""{prefix}.out_proj.weight"""]
     UpperCAmelCase_      :      Union[str, Any]      =					pt_weights[f"""{prefix}.out_proj.bias"""]
  
     UpperCAmelCase_      :      Optional[int]      =					q_proj
     UpperCAmelCase_      :      Dict      =					q_proj_bias
  
     UpperCAmelCase_      :      int      =					k_proj
     UpperCAmelCase_      :      List[str]      =					k_proj_bias
  
     UpperCAmelCase_      :      Tuple      =					v_proj
     UpperCAmelCase_      :      Any      =					v_proj_bias
  
     UpperCAmelCase_      :      Dict      =					out_proj_weights
     UpperCAmelCase_      :      List[Any]      =					out_proj_bias
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						):
     copy_linear(hf_mlp.fca,	__lowerCamelCase,	f"""{prefix}.c_fc"""						)
     copy_linear(hf_mlp.fca,	__lowerCamelCase,	f"""{prefix}.c_proj"""						)
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						):
     UpperCAmelCase_      :      Tuple      =					pt_weights[f"""{prefix}.weight"""].data
     UpperCAmelCase_      :      List[str]      =					pt_weights[f"""{prefix}.bias"""].data
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						):
     # copy layer norms
     copy_linear(hf_layer.layer_norma,	__lowerCamelCase,	f"""{prefix}.ln_1"""						)
     copy_linear(hf_layer.layer_norma,	__lowerCamelCase,	f"""{prefix}.ln_2"""						)
  
     # copy MLP
     copy_mlp(hf_layer.mlp,	__lowerCamelCase,	f"""{prefix}.mlp"""						)
  
     # copy attn
     copy_attn_layer(hf_layer.self_attn,	__lowerCamelCase,	f"""{prefix}.attn"""						)
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						):
     for layer_id, hf_layer in enumerate(__lowerCamelCase						):
        copy_layer(__lowerCamelCase,	__lowerCamelCase,	f"""{prefix}.{layer_id}"""						)
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase						):
     # copy projection
     UpperCAmelCase_      :      Tuple      =					pt_weights["text_projection"].data.T
  
     # copy text encoder
     for name, param in hf_model.text_model.named_parameters():
        UpperCAmelCase_      :      Optional[int]      =					pt_weights[f"""bert.{name}"""].data
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase						):
     # copy projection
     UpperCAmelCase_      :      Union[str, Any]      =					pt_weights["visual.proj"].data.T
  
     # copy layer norms
     copy_linear(hf_model.vision_model.pre_layrnorm,	__lowerCamelCase,	"visual.ln_pre"						)
     copy_linear(hf_model.vision_model.post_layernorm,	__lowerCamelCase,	"visual.ln_post"						)
  
     # copy embeddings
     UpperCAmelCase_      :      str      =					pt_weights["visual.conv1.weight"].data
     UpperCAmelCase_      :      List[Any]      =					pt_weights["visual.class_embedding"].data
     UpperCAmelCase_      :      Any      =					pt_weights["visual.positional_embedding"].data
  
     # copy encoder
     copy_layers(hf_model.vision_model.encoder.layers,	__lowerCamelCase,	"visual.transformer.resblocks"						)
  
  
  
  
  
  
  
  @torch.no_grad()
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase=None						):
     assert config_path is not None, "Please specify the ChineseCLIP model config of the corresponding model size."
     UpperCAmelCase_      :      Optional[int]      =					ChineseCLIPConfig.from_pretrained(__lowerCamelCase						)
  
     UpperCAmelCase_      :      Dict      =					ChineseCLIPModel(__lowerCamelCase						).eval()
  
     UpperCAmelCase_      :      Union[str, Any]      =					torch.load(__lowerCamelCase,	map_location="cpu"						)["state_dict"]
     UpperCAmelCase_      :      Union[str, Any]      =					{(name[7:] if name.startswith("module."						) else name): value for name, value in pt_weights.items()}
  
     copy_text_model_and_projection(__lowerCamelCase,	__lowerCamelCase						)
     copy_vision_model_and_projection(__lowerCamelCase,	__lowerCamelCase						)
     UpperCAmelCase_      :      Any      =					pt_weights["logit_scale"].data
  
     hf_model.save_pretrained(__lowerCamelCase						)
  
  
  if __name__ == "__main__":
      _a	 =							argparse.ArgumentParser()
      parser.add_argument(
          '--pytorch_dump_folder_path',
          default=None,
          type=str,
          help='Path to the output folder storing converted hf PyTorch model.',
      )
      parser.add_argument(
          '--checkpoint_path', default=None, type=str, help='Path to original github format ChineseCLIP checkpoint.'
      )
      parser.add_argument(
          '--config_path', default=None, required=True, type=str, help='Path to hf config.json of model to convert.'
      )
      _a	 =							parser.parse_args()
  
      convert_chinese_clip_checkpoint(args.checkpoint_path, args.pytorch_dump_folder_path, args.config_path)
      print('The conversion is finished!')
  
  
  
style_context: 
  """simple docstring"""
  
  
  
  
  
  from __future__ import annotations
  
  from statistics import mean
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase						):
     UpperCAmelCase_      :      Dict      =					2
     UpperCAmelCase_      :      Any      =					list(__lowerCamelCase						)
     UpperCAmelCase_      :      List[Any]      =					[0] * len(__lowerCamelCase						)
     UpperCAmelCase_      :      str      =					0
     while True:
        UpperCAmelCase_      :      int      =					True
        for i, burst_time in enumerate(__lowerCamelCase						):
           if rem_burst_times[i] > 0:
              UpperCAmelCase_      :      List[Any]      =					False
              if rem_burst_times[i] > quantum:
                 t += quantum
                 rem_burst_times[i] -= quantum
              else:
                 t += rem_burst_times[i]
                 UpperCAmelCase_      :      Optional[int]      =					t - burst_time
                 UpperCAmelCase_      :      Union[str, Any]      =					0
        if done is True:
           return waiting_times
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase						):
     return [burst + waiting for burst, waiting in zip(__lowerCamelCase,	__lowerCamelCase						)]
  
  
  if __name__ == "__main__":
      _a	 =							[3, 5, 7]
      _a	 =							calculate_waiting_times(burst_times)
      _a	 =							calculate_turn_around_times(burst_times, waiting_times)
      print('Process ID \tBurst Time \tWaiting Time \tTurnaround Time')
      for i, burst_time in enumerate(burst_times):
          print(
              f"""  {i + 1}\t\t  {burst_time}\t\t  {waiting_times[i]}\t\t  """
              f"""{turn_around_times[i]}"""
          )
      print(f"""\nAverage waiting time = {mean(waiting_times):.5f}""")
      print(f"""Average turn around time = {mean(turn_around_times):.5f}""")
  
  
  