



'''simple docstring'''





import argparse
import json

import gdown
import numpy as np
import torch
from huggingface_hub import hf_hub_download

from transformers import (
    VideoMAEConfig,
    VideoMAEForPreTraining,
    VideoMAEForVideoClassification,
    VideoMAEImageProcessor,
)





def 						__snake_case(				_lowerCAmelCase		)		-> Optional[Any]:
      snake_case__  :    Union[str, Any]    						=      VideoMAEConfig()

      set_architecture_configs(_lowerCAmelCase     ,   _lowerCAmelCase		)

      if "finetuned" not in model_name:
            snake_case__  :    Tuple    						=      False

      if "finetuned" in model_name:
            snake_case__  :    Any    						=      """huggingface/label-files"""
            if "kinetics" in model_name:
                  snake_case__  :    Union[str, Any]    						=      400
                  snake_case__  :    Tuple    						=      """kinetics400-id2label.json"""
            elif "ssv2" in model_name:
                  snake_case__  :    Optional[Any]    						=      174
                  snake_case__  :    List[str]    						=      """something-something-v2-id2label.json"""
            else:
                  raise ValueError("""Model name should either contain 'kinetics' or 'ssv2' in case it's fine-tuned."""		)
            snake_case__  :    Any    						=      json.load(open(hf_hub_download(_lowerCAmelCase     ,   _lowerCAmelCase     ,   repo_type="""dataset"""		)     ,   """r"""		)		)
            snake_case__  :    Optional[Any]    						=      {int(_lowerCAmelCase		): v for k, v in idalabel.items()}
            snake_case__  :    str    						=      idalabel
            snake_case__  :    List[Any]    						=      {v: k for k, v in idalabel.items()}

      return config





def 						__snake_case(				_lowerCAmelCase     ,   _lowerCAmelCase		)		-> str:
      if "small" in model_name:
            snake_case__  :    Any    						=      384
            snake_case__  :    Optional[int]    						=      1_536
            snake_case__  :    Optional[int]    						=      12
            snake_case__  :    Dict    						=      16
            snake_case__  :    Optional[Any]    						=      12
            snake_case__  :    Union[str, Any]    						=      3
            snake_case__  :    str    						=      192
            snake_case__  :    List[str]    						=      768
      elif "large" in model_name:
            snake_case__  :    Optional[int]    						=      1_024
            snake_case__  :    Optional[Any]    						=      4_096
            snake_case__  :    str    						=      24
            snake_case__  :    Optional[Any]    						=      16
            snake_case__  :    int    						=      12
            snake_case__  :    Tuple    						=      8
            snake_case__  :    List[Any]    						=      512
            snake_case__  :    Union[str, Any]    						=      2_048
      elif "huge" in model_name:
            snake_case__  :    Optional[int]    						=      1_280
            snake_case__  :    Tuple    						=      5_120
            snake_case__  :    Dict    						=      32
            snake_case__  :    Tuple    						=      16
            snake_case__  :    Tuple    						=      12
            snake_case__  :    Tuple    						=      8
            snake_case__  :    Union[str, Any]    						=      640
            snake_case__  :    Optional[Any]    						=      2_560
      elif "base" not in model_name:
            raise ValueError("""Model name should include either \"small\", \"base\", \"large\", or \"huge\""""		)





def 						__snake_case(				_lowerCAmelCase		)		-> List[str]:
      if "encoder." in name:
            snake_case__  :    int    						=      name.replace("""encoder."""     ,   """"""		)
      if "cls_token" in name:
            snake_case__  :    Any    						=      name.replace("""cls_token"""     ,   """videomae.embeddings.cls_token"""		)
      if "decoder_pos_embed" in name:
            snake_case__  :    Tuple    						=      name.replace("""decoder_pos_embed"""     ,   """decoder.decoder_pos_embed"""		)
      if "pos_embed" in name and "decoder" not in name:
            snake_case__  :    str    						=      name.replace("""pos_embed"""     ,   """videomae.embeddings.position_embeddings"""		)
      if "patch_embed.proj" in name:
            snake_case__  :    Optional[int]    						=      name.replace("""patch_embed.proj"""     ,   """videomae.embeddings.patch_embeddings.projection"""		)
      if "patch_embed.norm" in name:
            snake_case__  :    int    						=      name.replace("""patch_embed.norm"""     ,   """videomae.embeddings.norm"""		)
      if "decoder.blocks" in name:
            snake_case__  :    List[Any]    						=      name.replace("""decoder.blocks"""     ,   """decoder.decoder_layers"""		)
      if "blocks" in name:
            snake_case__  :    Optional[Any]    						=      name.replace("""blocks"""     ,   """videomae.encoder.layer"""		)
      if "attn.proj" in name:
            snake_case__  :    Any    						=      name.replace("""attn.proj"""     ,   """attention.output.dense"""		)
      if "attn" in name and "bias" not in name:
            snake_case__  :    List[Any]    						=      name.replace("""attn"""     ,   """attention.self"""		)
      if "attn" in name:
            snake_case__  :    List[str]    						=      name.replace("""attn"""     ,   """attention.attention"""		)
      if "norm1" in name:
            snake_case__  :    Dict    						=      name.replace("""norm1"""     ,   """layernorm_before"""		)
      if "norm2" in name:
            snake_case__  :    List[Any]    						=      name.replace("""norm2"""     ,   """layernorm_after"""		)
      if "mlp.fc1" in name:
            snake_case__  :    List[Any]    						=      name.replace("""mlp.fc1"""     ,   """intermediate.dense"""		)
      if "mlp.fc2" in name:
            snake_case__  :    Any    						=      name.replace("""mlp.fc2"""     ,   """output.dense"""		)
      if "decoder_embed" in name:
            snake_case__  :    str    						=      name.replace("""decoder_embed"""     ,   """decoder.decoder_embed"""		)
      if "decoder_norm" in name:
            snake_case__  :    Dict    						=      name.replace("""decoder_norm"""     ,   """decoder.decoder_norm"""		)
      if "decoder_pred" in name:
            snake_case__  :    Any    						=      name.replace("""decoder_pred"""     ,   """decoder.decoder_pred"""		)
      if "norm.weight" in name and "decoder" not in name and "fc" not in name:
            snake_case__  :    int    						=      name.replace("""norm.weight"""     ,   """videomae.layernorm.weight"""		)
      if "norm.bias" in name and "decoder" not in name and "fc" not in name:
            snake_case__  :    Tuple    						=      name.replace("""norm.bias"""     ,   """videomae.layernorm.bias"""		)
      if "head" in name and "decoder" not in name:
            snake_case__  :    Any    						=      name.replace("""head"""     ,   """classifier"""		)

      return name





def 						__snake_case(				_lowerCAmelCase     ,   _lowerCAmelCase		)		-> List[Any]:
      for key in orig_state_dict.copy().keys():
            snake_case__  :    str    						=      orig_state_dict.pop(_lowerCAmelCase		)

            if key.startswith("""encoder."""		):
                  snake_case__  :    Dict    						=      key.replace("""encoder."""     ,   """"""		)

            if "qkv" in key:
                  snake_case__  :    Tuple    						=      key.split("""."""		)
                  if key.startswith("""decoder.blocks"""		):
                        snake_case__  :    Optional[Any]    						=      config.decoder_hidden_size
                        snake_case__  :    Optional[int]    						=      int(key_split[2]		)
                        snake_case__  :    Any    						=      """decoder.decoder_layers."""
                        if "weight" in key:
                              snake_case__  :    str    						=      val[:dim, :]
                              snake_case__  :    Dict    						=      val[dim : dim * 2, :]
                              snake_case__  :    List[str]    						=      val[-dim:, :]
                  else:
                        snake_case__  :    List[str]    						=      config.hidden_size
                        snake_case__  :    List[str]    						=      int(key_split[1]		)
                        snake_case__  :    int    						=      """videomae.encoder.layer."""
                        if "weight" in key:
                              snake_case__  :    Optional[int]    						=      val[:dim, :]
                              snake_case__  :    Optional[int]    						=      val[dim : dim * 2, :]
                              snake_case__  :    Tuple    						=      val[-dim:, :]
            else:
                  snake_case__  :    List[Any]    						=      val

      return orig_state_dict





def 						__snake_case(				)		-> Any:
      snake_case__  :    List[Any]    						=      hf_hub_download(
          repo_id="""hf-internal-testing/spaghetti-video"""     ,   filename="""eating_spaghetti.npy"""     ,   repo_type="""dataset"""		)
      snake_case__  :    List[str]    						=      np.load(_lowerCAmelCase		)
      return list(_lowerCAmelCase		)





def 						__snake_case(				_lowerCAmelCase     ,   _lowerCAmelCase     ,   _lowerCAmelCase     ,   _lowerCAmelCase		)		-> List[Any]:
      snake_case__  :    Optional[Any]    						=      get_videomae_config(_lowerCAmelCase		)

      if "finetuned" in model_name:
            snake_case__  :    Tuple    						=      VideoMAEForVideoClassification(_lowerCAmelCase		)
      else:
            snake_case__  :    str    						=      VideoMAEForPreTraining(_lowerCAmelCase		)

      # download original checkpoint, hosted on Google Drive
      snake_case__  :    Dict    						=      """pytorch_model.bin"""
      gdown.cached_download(_lowerCAmelCase     ,   _lowerCAmelCase     ,   quiet=_lowerCAmelCase		)
      snake_case__  :    Optional[Any]    						=      torch.load(_lowerCAmelCase     ,   map_location="""cpu"""		)
      if "model" in files:
            snake_case__  :    int    						=      files["""model"""]
      else:
            snake_case__  :    Tuple    						=      files["""module"""]
      snake_case__  :    Optional[int]    						=      convert_state_dict(_lowerCAmelCase     ,   _lowerCAmelCase		)

      model.load_state_dict(_lowerCAmelCase		)
      model.eval()

      # verify model on basic input
      snake_case__  :    str    						=      VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]     ,   image_std=[0.5, 0.5, 0.5]		)
      snake_case__  :    int    						=      prepare_video()
      snake_case__  :    int    						=      image_processor(_lowerCAmelCase     ,   return_tensors="""pt"""		)

      if "finetuned" not in model_name:
            snake_case__  :    Optional[int]    						=      hf_hub_download(repo_id="""hf-internal-testing/bool-masked-pos"""     ,   filename="""bool_masked_pos.pt"""		)
            snake_case__  :    Dict    						=      torch.load(_lowerCAmelCase		)

      snake_case__  :    int    						=      model(**_lowerCAmelCase		)
      snake_case__  :    str    						=      outputs.logits

      snake_case__  :    Union[str, Any]    						=      [
          """videomae-small-finetuned-kinetics""",
          """videomae-small-finetuned-ssv2""",
          # Kinetics-400 checkpoints (short = pretrained only for 800 epochs instead of 1600)
          """videomae-base-short""",
          """videomae-base-short-finetuned-kinetics""",
          """videomae-base""",
          """videomae-base-finetuned-kinetics""",
          """videomae-large""",
          """videomae-large-finetuned-kinetics""",
          """videomae-huge-finetuned-kinetics""",
          # Something-Something-v2 checkpoints (short = pretrained only for 800 epochs instead of 2400)
          """videomae-base-short-ssv2""",
          """videomae-base-short-finetuned-ssv2""",
          """videomae-base-ssv2""",
          """videomae-base-finetuned-ssv2""",
      ]

      # NOTE: logits were tested with image_mean and image_std equal to [0.5, 0.5, 0.5] and [0.5, 0.5, 0.5]
      if model_name == "videomae-small-finetuned-kinetics":
            snake_case__  :    str    						=      torch.Size([1, 400]		)
            snake_case__  :    Union[str, Any]    						=      torch.tensor([-0.9291, -0.4061, -0.9307]		)
      elif model_name == "videomae-small-finetuned-ssv2":
            snake_case__  :    List[str]    						=      torch.Size([1, 174]		)
            snake_case__  :    List[Any]    						=      torch.tensor([0.2671, -0.4689, -0.8235]		)
      elif model_name == "videomae-base":
            snake_case__  :    Union[str, Any]    						=      torch.Size([1, 1_408, 1_536]		)
            snake_case__  :    int    						=      torch.tensor([[0.7739, 0.7968, 0.7089], [0.6701, 0.7487, 0.6209], [0.4287, 0.5158, 0.4773]]		)
      elif model_name == "videomae-base-short":
            snake_case__  :    List[Any]    						=      torch.Size([1, 1_408, 1_536]		)
            snake_case__  :    List[Any]    						=      torch.tensor([[0.7994, 0.9612, 0.8508], [0.7401, 0.8958, 0.8302], [0.5862, 0.7468, 0.7325]]		)
            # we verified the loss both for normalized and unnormalized targets for this one
            snake_case__  :    List[Any]    						=      torch.tensor([0.5142]		) if config.norm_pix_loss else torch.tensor([0.6469]		)
      elif model_name == "videomae-large":
            snake_case__  :    Any    						=      torch.Size([1, 1_408, 1_536]		)
            snake_case__  :    Tuple    						=      torch.tensor([[0.7149, 0.7997, 0.6966], [0.6768, 0.7869, 0.6948], [0.5139, 0.6221, 0.5605]]		)
      elif model_name == "videomae-large-finetuned-kinetics":
            snake_case__  :    List[Any]    						=      torch.Size([1, 400]		)
            snake_case__  :    int    						=      torch.tensor([0.0771, 0.0011, -0.3625]		)
      elif model_name == "videomae-huge-finetuned-kinetics":
            snake_case__  :    List[Any]    						=      torch.Size([1, 400]		)
            snake_case__  :    str    						=      torch.tensor([0.2433, 0.1632, -0.4894]		)
      elif model_name == "videomae-base-short-finetuned-kinetics":
            snake_case__  :    Dict    						=      torch.Size([1, 400]		)
            snake_case__  :    List[Any]    						=      torch.tensor([0.6588, 0.0990, -0.2493]		)
      elif model_name == "videomae-base-finetuned-kinetics":
            snake_case__  :    Tuple    						=      torch.Size([1, 400]		)
            snake_case__  :    str    						=      torch.tensor([0.3669, -0.0688, -0.2421]		)
      elif model_name == "videomae-base-short-ssv2":
            snake_case__  :    Any    						=      torch.Size([1, 1_408, 1_536]		)
            snake_case__  :    Optional[Any]    						=      torch.tensor([[0.4712, 0.5296, 0.5786], [0.2278, 0.2729, 0.4026], [0.0352, 0.0730, 0.2506]]		)
      elif model_name == "videomae-base-short-finetuned-ssv2":
            snake_case__  :    Union[str, Any]    						=      torch.Size([1, 174]		)
            snake_case__  :    Optional[Any]    						=      torch.tensor([-0.0537, -0.1539, -0.3266]		)
      elif model_name == "videomae-base-ssv2":
            snake_case__  :    int    						=      torch.Size([1, 1_408, 1_536]		)
            snake_case__  :    Dict    						=      torch.tensor([[0.8131, 0.8727, 0.8546], [0.7366, 0.9377, 0.8870], [0.5935, 0.8874, 0.8564]]		)
      elif model_name == "videomae-base-finetuned-ssv2":
            snake_case__  :    Optional[Any]    						=      torch.Size([1, 174]		)
            snake_case__  :    Dict    						=      torch.tensor([0.1961, -0.8337, -0.6389]		)
      else:
            raise ValueError(f"Model name not supported. Should be one of {model_names}"		)

      # verify logits
      assert logits.shape == expected_shape
      if "finetuned" in model_name:
            assert torch.allclose(logits[0, :3]     ,   _lowerCAmelCase     ,   atol=1e-4		)
      else:
            print("""Logits:"""     ,   logits[0, :3, :3]		)
            assert torch.allclose(logits[0, :3, :3]     ,   _lowerCAmelCase     ,   atol=1e-4		)
      print("""Logits ok!"""		)

      # verify loss, if applicable
      if model_name == "videomae-base-short":
            snake_case__  :    Any    						=      outputs.loss
            assert torch.allclose(_lowerCAmelCase     ,   _lowerCAmelCase     ,   atol=1e-4		)
            print("""Loss ok!"""		)

      if pytorch_dump_folder_path is not None:
            print(f"Saving model and image processor to {pytorch_dump_folder_path}"		)
            image_processor.save_pretrained(_lowerCAmelCase		)
            model.save_pretrained(_lowerCAmelCase		)

      if push_to_hub:
            print("""Pushing to the hub..."""		)
            model.push_to_hub(_lowerCAmelCase     ,   organization="""nielsr"""		)


if __name__ == "__main__":
       __a          =		argparse.ArgumentParser()
       # Required parameters
       parser.add_argument(
           "--checkpoint_url",
           default="https://drive.google.com/u/1/uc?id=1tEhLyskjb755TJ65ptsrafUG2llSwQE1&amp;export=download&amp;confirm=t&amp;uuid=aa3276eb-fb7e-482a-adec-dc7171df14c4",
           type=str,
           help=(
               "URL of the original PyTorch checkpoint (on Google Drive) you'd like to convert. Should be a direct"
               " download link."
           ),
       )
       parser.add_argument(
           "--pytorch_dump_folder_path",
           default="/Users/nielsrogge/Documents/VideoMAE/Test",
           type=str,
           help="Path to the output PyTorch model directory.",
       )
       parser.add_argument("--model_name", default="videomae-base", type=str, help="Name of the model.")
       parser.add_argument(
           "--push_to_hub", action="store_true", help="Whether or not to push the converted model to the 🤗 hub."
       )

       __a          =		parser.parse_args()
       convert_videomae_checkpoint(args.checkpoint_url, args.pytorch_dump_folder_path, args.model_name, args.push_to_hub)




'''simple docstring'''


from pickle import UnpicklingError

import jax
import jax.numpy as jnp
import numpy as np
from flax.serialization import from_bytes
from flax.traverse_util import flatten_dict

from ..utils import logging


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







def 			snake_case_   (  SCREAMING_SNAKE_CASE__							,      SCREAMING_SNAKE_CASE__     ):







				"""simple docstring"""





				try:
								with open(SCREAMING_SNAKE_CASE__							,      """rb"""     ) as flax_state_f:
												_SCREAMING_SNAKE_CASE :       Dict     		=      from_bytes(SCREAMING_SNAKE_CASE__							,      flax_state_f.read()     )
				except UnpicklingError as e:
								try:
												with open(SCREAMING_SNAKE_CASE__     ) as f:
																if f.read().startswith("""version"""     ):
																				raise OSError(
																				    """You seem to have cloned a repository without having git-lfs installed. Please"""
																				    """ install git-lfs and run `git lfs install` followed by `git lfs pull` in the"""
																				    """ folder you cloned."""     )
																else:
																				raise ValueError from e
								except (UnicodeDecodeError, ValueError):
												raise EnvironmentError(f"""Unable to convert {model_file} to Flax deserializable object. """     )

				return load_flax_weights_in_pytorch_model(SCREAMING_SNAKE_CASE__							,      SCREAMING_SNAKE_CASE__     )







def 			snake_case_   (  SCREAMING_SNAKE_CASE__							,      SCREAMING_SNAKE_CASE__     ):







				"""simple docstring"""





				try:
								import torch  # noqa: F401
				except ImportError:
								logger.error(
								    """Loading Flax weights in PyTorch requires both PyTorch and Flax to be installed. Please see"""
								    """ https://pytorch.org/ and https://flax.readthedocs.io/en/latest/installation.html for installation"""
								    """ instructions."""     )
								raise

				# check if we have bf16 weights
				_SCREAMING_SNAKE_CASE :       List[Any]     		=      flatten_dict(jax.tree_util.tree_map(lambda SCREAMING_SNAKE_CASE__     : x.dtype == jnp.bfloataa							,      SCREAMING_SNAKE_CASE__     )     ).values()
				if any(SCREAMING_SNAKE_CASE__     ):
								# convert all weights to fp32 if they are bf16 since torch.from_numpy can-not handle bf16

								# and bf16 is not fully supported in PT yet.
								logger.warning(
								    """Found ``bfloat16`` weights in Flax model. Casting all ``bfloat16`` weights to ``float32`` """
								    """before loading those in PyTorch model."""     )
								_SCREAMING_SNAKE_CASE :       Dict     		=      jax.tree_util.tree_map(
								    lambda SCREAMING_SNAKE_CASE__     : params.astype(np.floataa     ) if params.dtype == jnp.bfloataa else params							,      SCREAMING_SNAKE_CASE__     )

				_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      """"""

				_SCREAMING_SNAKE_CASE :       str     		=      flatten_dict(SCREAMING_SNAKE_CASE__							,      sep="""."""     )
				_SCREAMING_SNAKE_CASE :       str     		=      pt_model.state_dict()

				# keep track of unexpected & missing keys
				_SCREAMING_SNAKE_CASE :       Tuple     		=      []
				_SCREAMING_SNAKE_CASE :       int     		=      set(pt_model_dict.keys()     )

				for flax_key_tuple, flax_tensor in flax_state_dict.items():
								_SCREAMING_SNAKE_CASE :       Any     		=      flax_key_tuple.split("""."""     )

								if flax_key_tuple_array[-1] == "kernel" and flax_tensor.ndim == 4:
												_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      flax_key_tuple_array[:-1] + ["""weight"""]
												_SCREAMING_SNAKE_CASE :       List[str]     		=      jnp.transpose(SCREAMING_SNAKE_CASE__							,      (3, 2, 0, 1)     )
								elif flax_key_tuple_array[-1] == "kernel":
												_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      flax_key_tuple_array[:-1] + ["""weight"""]
												_SCREAMING_SNAKE_CASE :       Any     		=      flax_tensor.T
								elif flax_key_tuple_array[-1] == "scale":
												_SCREAMING_SNAKE_CASE :       Optional[int]     		=      flax_key_tuple_array[:-1] + ["""weight"""]

								if "time_embedding" not in flax_key_tuple_array:
												for i, flax_key_tuple_string in enumerate(SCREAMING_SNAKE_CASE__     ):
																_SCREAMING_SNAKE_CASE :       Optional[int]     		=      (
																    flax_key_tuple_string.replace("""_0"""							,      """.0"""     )
																    .replace("""_1"""							,      """.1"""     )
																    .replace("""_2"""							,      """.2"""     )
																    .replace("""_3"""							,      """.3"""     )
																    .replace("""_4"""							,      """.4"""     )
																    .replace("""_5"""							,      """.5"""     )
																    .replace("""_6"""							,      """.6"""     )
																    .replace("""_7"""							,      """.7"""     )
																    .replace("""_8"""							,      """.8"""     )
																    .replace("""_9"""							,      """.9"""     )
																)

								_SCREAMING_SNAKE_CASE :       Tuple     		=      """.""".join(SCREAMING_SNAKE_CASE__     )

								if flax_key in pt_model_dict:
												if flax_tensor.shape != pt_model_dict[flax_key].shape:
																raise ValueError(
																    f"""Flax checkpoint seems to be incorrect. Weight {flax_key_tuple} was expected """
																    f"""to be of shape {pt_model_dict[flax_key].shape}, but is {flax_tensor.shape}."""     )
												else:
																# add weight to pytorch dict
																_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      np.asarray(SCREAMING_SNAKE_CASE__     ) if not isinstance(SCREAMING_SNAKE_CASE__							,      np.ndarray     ) else flax_tensor
																_SCREAMING_SNAKE_CASE :       int     		=      torch.from_numpy(SCREAMING_SNAKE_CASE__     )
																# remove from missing keys
																missing_keys.remove(SCREAMING_SNAKE_CASE__     )
								else:
												# weight is not expected by PyTorch model
												unexpected_keys.append(SCREAMING_SNAKE_CASE__     )

				pt_model.load_state_dict(SCREAMING_SNAKE_CASE__     )

				# re-transform missing_keys to list
				_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      list(SCREAMING_SNAKE_CASE__     )

				if len(SCREAMING_SNAKE_CASE__     ) > 0:
								logger.warning(
								    """Some weights of the Flax model were not used when initializing the PyTorch model"""
								    f""" {pt_model.__class__.__name__}: {unexpected_keys}\n- This IS expected if you are initializing"""
								    f""" {pt_model.__class__.__name__} from a Flax model trained on another task or with another architecture"""
								    """ (e.g. initializing a BertForSequenceClassification model from a FlaxBertForPreTraining model).\n- This"""
								    f""" IS NOT expected if you are initializing {pt_model.__class__.__name__} from a Flax model that you expect"""
								    """ to be exactly identical (e.g. initializing a BertForSequenceClassification model from a"""
								    """ FlaxBertForSequenceClassification model)."""     )
				if len(SCREAMING_SNAKE_CASE__     ) > 0:
								logger.warning(
								    f"""Some weights of {pt_model.__class__.__name__} were not initialized from the Flax model and are newly"""
								    f""" initialized: {missing_keys}\nYou should probably TRAIN this model on a down-stream task to be able to"""
								    """ use it for predictions and inference."""     )

				return pt_model




