





'''simple docstring'''

import argparse
import collections
import json
from pathlib import Path

import requests
import torch
import yaml
from huggingface_hub import hf_hub_download
from PIL import Image

from transformers import (
    MobileViTImageProcessor,
    MobileViTVaConfig,
    MobileViTVaForImageClassification,
    MobileViTVaForSemanticSegmentation,
)
from transformers.utils import logging


logging.set_verbosity_info()
lowercase_					= logging.get_logger(__name__)





def lowerCamelCase						(     __lowerCamelCase :    Dict    )						->Tuple:
    print("""Loading config file..."""    )

    def flatten_yaml_as_dict(__lowerCamelCase :    Optional[int]					,       __lowerCamelCase :    Optional[Any]=""					,       __lowerCamelCase :    List[Any]="."    ):
        _SCREAMING_SNAKE_CASE									=			[]
        for k, v in d.items():
            _SCREAMING_SNAKE_CASE									=			parent_key + sep + k if parent_key else k
            if isinstance(__lowerCamelCase					,       collections.abc.MutableMapping    ):
                items.extend(flatten_yaml_as_dict(__lowerCamelCase					,       __lowerCamelCase					,       sep=__lowerCamelCase    ).items()    )
            else:
                items.append((new_key, v)    )
        return dict(__lowerCamelCase    )

    _SCREAMING_SNAKE_CASE									=			argparse.Namespace()
    with open(__lowerCamelCase					,       """r"""    ) as yaml_file:
        try:
            _SCREAMING_SNAKE_CASE									=			yaml.load(__lowerCamelCase					,       Loader=yaml.FullLoader    )

            _SCREAMING_SNAKE_CASE									=			flatten_yaml_as_dict(__lowerCamelCase    )
            for k, v in flat_cfg.items():
                setattr(__lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase    )
        except yaml.YAMLError as exc:
            logger.error("""Error while loading config file: {}. Error message: {}""".format(__lowerCamelCase					,       str(__lowerCamelCase    )    )    )
    return config





def lowerCamelCase						(     __lowerCamelCase :    Tuple					,       __lowerCamelCase :    Union[str, Any]    )						->List[str]:
    _SCREAMING_SNAKE_CASE									=			MobileViTVaConfig()

    _SCREAMING_SNAKE_CASE									=			False

    # dataset
    if task_name.startswith("""imagenet1k_"""    ):
        _SCREAMING_SNAKE_CASE									=			1000
        if int(task_name.strip().split("""_"""    )[-1]    ) == 384:
            _SCREAMING_SNAKE_CASE									=			384
        else:
            _SCREAMING_SNAKE_CASE									=			256
        _SCREAMING_SNAKE_CASE									=			'imagenet-1k-id2label.json'
    elif task_name.startswith("""imagenet21k_to_1k_"""    ):
        _SCREAMING_SNAKE_CASE									=			2_1000
        if int(task_name.strip().split("""_"""    )[-1]    ) == 384:
            _SCREAMING_SNAKE_CASE									=			384
        else:
            _SCREAMING_SNAKE_CASE									=			256
        _SCREAMING_SNAKE_CASE									=			'imagenet-22k-id2label.json'
    elif task_name.startswith("""ade20k_"""    ):
        _SCREAMING_SNAKE_CASE									=			151
        _SCREAMING_SNAKE_CASE									=			512
        _SCREAMING_SNAKE_CASE									=			'ade20k-id2label.json'
        _SCREAMING_SNAKE_CASE									=			True
    elif task_name.startswith("""voc_"""    ):
        _SCREAMING_SNAKE_CASE									=			21
        _SCREAMING_SNAKE_CASE									=			512
        _SCREAMING_SNAKE_CASE									=			'pascal-voc-id2label.json'
        _SCREAMING_SNAKE_CASE									=			True

    # orig_config
    _SCREAMING_SNAKE_CASE									=			load_orig_config_file(__lowerCamelCase    )
    assert getattr(__lowerCamelCase					,       """model.classification.name"""					,       -1    ) == "mobilevit_v2", "Invalid model"
    _SCREAMING_SNAKE_CASE									=			getattr(__lowerCamelCase					,       """model.classification.mitv2.width_multiplier"""					,       1.0    )
    assert (
        getattr(__lowerCamelCase					,       """model.classification.mitv2.attn_norm_layer"""					,       -1    ) == "layer_norm_2d"
    ), "Norm layers other than layer_norm_2d is not supported"
    _SCREAMING_SNAKE_CASE									=			getattr(__lowerCamelCase					,       """model.classification.activation.name"""					,       """swish"""    )
    # config.image_size == getattr(orig_config,  'sampler.bs.crop_size_width', 256)

    if is_segmentation_model:
        _SCREAMING_SNAKE_CASE									=			getattr(__lowerCamelCase					,       """model.segmentation.output_stride"""					,       16    )
        if "_deeplabv3" in task_name:
            _SCREAMING_SNAKE_CASE									=			getattr(__lowerCamelCase					,       """model.segmentation.deeplabv3.aspp_rates"""					,       [12, 24, 36]    )
            _SCREAMING_SNAKE_CASE									=			getattr(__lowerCamelCase					,       """model.segmentation.deeplabv3.aspp_out_channels"""					,       512    )
            _SCREAMING_SNAKE_CASE									=			getattr(__lowerCamelCase					,       """model.segmentation.deeplabv3.aspp_dropout"""					,       0.1    )

    # id2label
    _SCREAMING_SNAKE_CASE									=			'huggingface/label-files'
    _SCREAMING_SNAKE_CASE									=			json.load(open(hf_hub_download(__lowerCamelCase					,       __lowerCamelCase					,       repo_type="""dataset"""    )					,       """r"""    )    )
    _SCREAMING_SNAKE_CASE									=			{int(__lowerCamelCase    ): v for k, v in idalabel.items()}
    _SCREAMING_SNAKE_CASE									=			idalabel
    _SCREAMING_SNAKE_CASE									=			{v: k for k, v in idalabel.items()}

    return config





def lowerCamelCase						(     __lowerCamelCase :    List[str]					,       __lowerCamelCase :    Optional[Any]					,       __lowerCamelCase :    Dict    )						->Any:
    _SCREAMING_SNAKE_CASE									=			dct.pop(__lowerCamelCase    )
    _SCREAMING_SNAKE_CASE									=			val





def lowerCamelCase						(     __lowerCamelCase :    int					,       __lowerCamelCase :    Dict=False    )						->Optional[int]:
    if base_model:
        _SCREAMING_SNAKE_CASE									=			''
    else:
        _SCREAMING_SNAKE_CASE									=			'mobilevitv2.'

    _SCREAMING_SNAKE_CASE									=			[]
    for k in state_dict.keys():
        if k[:8] == "encoder.":
            _SCREAMING_SNAKE_CASE									=			k[8:]
        else:
            _SCREAMING_SNAKE_CASE									=			k

        if ".block." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace(""".block."""					,       """."""    )
        if ".conv." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace(""".conv."""					,       """.convolution."""    )
        if ".norm." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace(""".norm."""					,       """.normalization."""    )

        if "conv_1." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""conv_1."""					,       F'{model_prefix}conv_stem.'    )
        for i in [1, 2]:
            if F'layer_{i}.' in k:
                _SCREAMING_SNAKE_CASE									=			k_new.replace(F'layer_{i}.'					,       F'{model_prefix}encoder.layer.{i-1}.layer.'    )
        if ".exp_1x1." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace(""".exp_1x1."""					,       """.expand_1x1."""    )
        if ".red_1x1." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace(""".red_1x1."""					,       """.reduce_1x1."""    )

        for i in [3, 4, 5]:
            if F'layer_{i}.0.' in k:
                _SCREAMING_SNAKE_CASE									=			k_new.replace(F'layer_{i}.0.'					,       F'{model_prefix}encoder.layer.{i-1}.downsampling_layer.'    )
            if F'layer_{i}.1.local_rep.0.' in k:
                _SCREAMING_SNAKE_CASE									=			k_new.replace(F'layer_{i}.1.local_rep.0.'					,       F'{model_prefix}encoder.layer.{i-1}.conv_kxk.'    )
            if F'layer_{i}.1.local_rep.1.' in k:
                _SCREAMING_SNAKE_CASE									=			k_new.replace(F'layer_{i}.1.local_rep.1.'					,       F'{model_prefix}encoder.layer.{i-1}.conv_1x1.'    )

        for i in [3, 4, 5]:
            if i == 3:
                _SCREAMING_SNAKE_CASE									=			[0, 1]
            elif i == 4:
                _SCREAMING_SNAKE_CASE									=			[0, 1, 2, 3]
            elif i == 5:
                _SCREAMING_SNAKE_CASE									=			[0, 1, 2]

            for j in j_in:
                if F'layer_{i}.1.global_rep.{j}.' in k:
                    _SCREAMING_SNAKE_CASE									=			k_new.replace(
                        F'layer_{i}.1.global_rep.{j}.'					,       F'{model_prefix}encoder.layer.{i-1}.transformer.layer.{j}.'    )
            if F'layer_{i}.1.global_rep.{j+1}.' in k:
                _SCREAMING_SNAKE_CASE									=			k_new.replace(
                    F'layer_{i}.1.global_rep.{j+1}.'					,       F'{model_prefix}encoder.layer.{i-1}.layernorm.'    )

            if F'layer_{i}.1.conv_proj.' in k:
                _SCREAMING_SNAKE_CASE									=			k_new.replace(F'layer_{i}.1.conv_proj.'					,       F'{model_prefix}encoder.layer.{i-1}.conv_projection.'    )

        if "pre_norm_attn.0." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""pre_norm_attn.0."""					,       """layernorm_before."""    )
        if "pre_norm_attn.1." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""pre_norm_attn.1."""					,       """attention."""    )
        if "pre_norm_ffn.0." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""pre_norm_ffn.0."""					,       """layernorm_after."""    )
        if "pre_norm_ffn.1." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""pre_norm_ffn.1."""					,       """ffn.conv1."""    )
        if "pre_norm_ffn.3." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""pre_norm_ffn.3."""					,       """ffn.conv2."""    )

        if "classifier.1." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""classifier.1."""					,       """classifier."""    )

        if "seg_head." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace("""seg_head."""					,       """segmentation_head."""    )
        if ".aspp_layer." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace(""".aspp_layer."""					,       """."""    )
        if ".aspp_pool." in k:
            _SCREAMING_SNAKE_CASE									=			k_new.replace(""".aspp_pool."""					,       """."""    )

        rename_keys.append((k, k_new)    )
    return rename_keys





def lowerCamelCase						(     __lowerCamelCase :    Any    )						->Optional[Any]:
    _SCREAMING_SNAKE_CASE									=			[]
    for k in state_dict.keys():
        if k.startswith("""seg_head.aux_head."""    ):
            keys_to_ignore.append(__lowerCamelCase    )
    for k in keys_to_ignore:
        state_dict.pop(__lowerCamelCase					,       __lowerCamelCase    )





def lowerCamelCase						(     )						->List[str]:
    _SCREAMING_SNAKE_CASE									=			'http://images.cocodataset.org/val2017/000000039769.jpg'
    # url = "https://cdn.britannica.com/86/141086-050-9D7C75EE/Gulfstream-G450-business-jet-passengers.jpg"
    _SCREAMING_SNAKE_CASE									=			Image.open(requests.get(__lowerCamelCase					,       stream=__lowerCamelCase    ).raw    )
    return im





@torch.no_grad()
def lowerCamelCase						(     __lowerCamelCase :    int					,       __lowerCamelCase :    Dict					,       __lowerCamelCase :    Union[str, Any]					,       __lowerCamelCase :    Union[str, Any]    )						->Union[str, Any]:
    _SCREAMING_SNAKE_CASE									=			get_mobilevitva_config(__lowerCamelCase					,       __lowerCamelCase    )

    # load original state_dict
    _SCREAMING_SNAKE_CASE									=			torch.load(__lowerCamelCase					,       map_location="""cpu"""    )

    # load huggingface model
    if task_name.startswith("""ade20k_"""    ) or task_name.startswith("""voc_"""    ):
        _SCREAMING_SNAKE_CASE									=			MobileViTVaForSemanticSegmentation(__lowerCamelCase    ).eval()
        _SCREAMING_SNAKE_CASE									=			False
    else:
        _SCREAMING_SNAKE_CASE									=			MobileViTVaForImageClassification(__lowerCamelCase    ).eval()
        _SCREAMING_SNAKE_CASE									=			False

    # remove and rename some keys of load the original model
    _SCREAMING_SNAKE_CASE									=			checkpoint
    remove_unused_keys(__lowerCamelCase    )
    _SCREAMING_SNAKE_CASE									=			create_rename_keys(__lowerCamelCase					,       base_model=__lowerCamelCase    )
    for rename_key_src, rename_key_dest in rename_keys:
        rename_key(__lowerCamelCase					,       __lowerCamelCase					,       __lowerCamelCase    )

    # load modified state_dict
    model.load_state_dict(__lowerCamelCase    )

    # Check outputs on an image, prepared by MobileViTImageProcessor
    _SCREAMING_SNAKE_CASE									=			MobileViTImageProcessor(crop_size=config.image_size					,       size=config.image_size + 32    )
    _SCREAMING_SNAKE_CASE									=			image_processor(images=prepare_img()					,       return_tensors="""pt"""    )
    _SCREAMING_SNAKE_CASE									=			model(**__lowerCamelCase    )

    # verify classification model
    if task_name.startswith("""imagenet"""    ):
        _SCREAMING_SNAKE_CASE									=			outputs.logits
        _SCREAMING_SNAKE_CASE									=			logits.argmax(-1    ).item()
        print("""Predicted class:"""					,       model.config.idalabel[predicted_class_idx]    )
        if task_name.startswith("""imagenet1k_256"""    ) and config.width_multiplier == 1.0:
            # expected_logits for base variant
            _SCREAMING_SNAKE_CASE									=			torch.tensor([-1.6_3_3_6e0_0, -7.3_2_0_4e-0_2, -5.1_8_8_3e-0_1]    )
            assert torch.allclose(logits[0, :3]					,       __lowerCamelCase					,       atol=1e-4    )

    Path(__lowerCamelCase    ).mkdir(exist_ok=__lowerCamelCase    )
    print(F'Saving model {task_name} to {pytorch_dump_folder_path}'    )
    model.save_pretrained(__lowerCamelCase    )
    print(F'Saving image processor to {pytorch_dump_folder_path}'    )
    image_processor.save_pretrained(__lowerCamelCase    )


if __name__ == "__main__":
      lowercase_					= argparse.ArgumentParser()
      # Required parameters
      parser.add_argument(
          """--task""",
          default="""imagenet1k_256""",
          type=str,
          help=(
              """Name of the task for which the MobileViTV2 model you\'d like to convert is trained on . """
              """
                Classification (ImageNet-1k)
                    - MobileViTV2 (256x256) : imagenet1k_256
                    - MobileViTV2 (Trained on 256x256 and Finetuned on 384x384) : imagenet1k_384
                    - MobileViTV2 (Trained on ImageNet-21k and Finetuned on ImageNet-1k 256x256) :
                      imagenet21k_to_1k_256
                    - MobileViTV2 (Trained on ImageNet-21k, Finetuned on ImageNet-1k 256x256, and Finetuned on
                      ImageNet-1k 384x384) : imagenet21k_to_1k_384
                Segmentation
                    - ADE20K Dataset : ade20k_deeplabv3
                    - Pascal VOC 2012 Dataset: voc_deeplabv3
            """
          ),
          choices=[
              """imagenet1k_256""",
              """imagenet1k_384""",
              """imagenet21k_to_1k_256""",
              """imagenet21k_to_1k_384""",
              """ade20k_deeplabv3""",
              """voc_deeplabv3""",
          ],
      )

      parser.add_argument(
          """--orig_checkpoint_path""", required=True, type=str, help="""Path to the original state dict (.pt file)."""
      )
      parser.add_argument("""--orig_config_path""", required=True, type=str, help="""Path to the original config file.""")
      parser.add_argument(
          """--pytorch_dump_folder_path""", required=True, type=str, help="""Path to the output PyTorch model directory."""
      )

      lowercase_					= parser.parse_args()
      convert_mobilevitva_checkpoint(
          args.task, args.orig_checkpoint_path, args.orig_config_path, args.pytorch_dump_folder_path
      )










import warnings
from pathlib import Path
from typing import List, Tuple, Union

import fire
from torch import nn

from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel
from transformers.utils import logging


UpperCAmelCase						:   Any			  =     logging.get_logger(__name__)







def  _SCREAMING_SNAKE_CASE				(   a					,						a					,						a  )      ->      None:
					__A	:						int       =				nn.ModuleList([src_layers[i] for i in layers_to_copy]  )
					assert len(a  ) == len(a  ), F"""{len(a  )} != {len(a  )}"""
					dest_layers.load_state_dict(layers_to_copy.state_dict()  )


UpperCAmelCase						:   List[Any]			  =     {
    # maps  num layers in teacher -> num_layers in student -> which teacher layers to copy.
    # 12: bart, 16: pegasus, 6: marian/Helsinki-NLP
    12: {
        1: [0],  # This says that if the teacher has 12 layers and the student has 1, copy layer 0 of the teacher
        2: [0, 6],
        3: [0, 6, 11],
        4: [0, 4, 8, 11],
        6: [0, 2, 4, 7, 9, 11],
        9: [0, 1, 2, 4, 5, 7, 9, 10, 11],
        12: list(range(12)),
    },
    16: {  # maps  num layers in student -> which teacher layers to copy
        1: [0],
        2: [0, 15],
        3: [0, 8, 15],
        4: [0, 5, 10, 15],
        6: [0, 3, 6, 9, 12, 15],
        8: [0, 2, 4, 6, 8, 10, 12, 15],
        9: [0, 1, 3, 5, 7, 9, 11, 13, 15],
        12: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 15],
        16: list(range(16)),
    },
    6: {1: [0], 2: [0, 5], 3: [0, 2, 5], 4: [0, 1, 3, 5], 6: list(range(6))},
}
UpperCAmelCase						:   Optional[int]			  =     {
    # maps  num layers in student -> which teacher layers to copy.
    6: {1: [5], 2: [3, 5], 3: [1, 4, 5], 4: [1, 2, 4, 5]},
    12: {1: [11], 2: [5, 11], 3: [3, 7, 11], 6: [1, 3, 5, 8, 10, 11]},
    16: {1: [15], 4: [4, 9, 12, 15], 8: [1, 3, 5, 7, 9, 11, 13, 15]},
}







def  _SCREAMING_SNAKE_CASE				(   a					,						a  )      ->      Dict:
					try:
										__A	:						int       =				LAYERS_TO_COPY[n_teacher][n_student]
										return val
					except KeyError:
										if n_student != n_teacher:
															warnings.warn(
															    F"""no hardcoded layers to copy for teacher {n_teacher} -> student {n_student}, defaulting to first"""
															    F""" {n_student}"""  )
										return list(range(a  )  )







def  _SCREAMING_SNAKE_CASE				(   a					,						a  )      ->      List[int]:
					if n_student > n_teacher:
										raise ValueError(F"""Cannot perform intermediate supervision for student {n_student} > teacher {n_teacher}"""  )
					elif n_teacher == n_student:
										return list(range(a  )  )
					elif n_student == 1:
										return [n_teacher - 1]
					else:
										return LAYERS_TO_SUPERVISE[n_teacher][n_student]







def  _SCREAMING_SNAKE_CASE				(   a					,						a = "student"					,						a = None					,						a = None					,						a=False					,						a=None					,						a=None					,						**a					,						)      ->      Tuple[PreTrainedModel, List[int], List[int]]:
					__A	:						List[str]       =				'encoder_layers and decoder_layers cannot be both None-- you would just have an identical teacher.'
					assert (e is not None) or (d is not None), _msg
					if isinstance(a					,						a  ):
										AutoTokenizer.from_pretrained(a  ).save_pretrained(a  )  # purely for convenience
										__A	:						Optional[int]       =				AutoModelForSeqaSeqLM.from_pretrained(a  ).eval()
					else:
										assert isinstance(a					,						a  ), F"""teacher must be a model or string got type {type(a  )}"""
					__A	:						int       =				teacher.config.to_diff_dict()

					try:
										__A    ,				__A	:						List[Any]       =				teacher.config.encoder_layers, teacher.config.decoder_layers
										if e is None:
															__A	:						str       =				teacher_e
										if d is None:
															__A	:						List[Any]       =				teacher_d
										init_kwargs.update({'encoder_layers': e, 'decoder_layers': d}  )
					except AttributeError:  # T5
										if hasattr(teacher.config					,						'num_encoder_layers'  ):
															__A    ,				__A	:						List[Any]       =				teacher.config.num_encoder_layers, teacher.config.num_decoder_layers
										else:
															__A    ,				__A	:						Optional[int]       =				teacher.config.num_layers, teacher.config.num_decoder_layers
										if e is None:
															__A	:						int       =				teacher_e
										if d is None:
															__A	:						Optional[Any]       =				teacher_d
										if hasattr(teacher.config					,						'num_encoder_layers'  ):
															init_kwargs.update({'num_encoder_layers': e, 'num_decoder_layers': d}  )
										else:
															init_kwargs.update({'num_layers': e, 'num_decoder_layers': d}  )

    # Kwargs to instantiate student: teacher kwargs with updated layer numbers + **extra_config_kwargs
					init_kwargs.update(a  )

					# Copy weights
					__A	:						Dict       =				teacher.config_class(**a  )
					__A	:						int       =				AutoModelForSeqaSeqLM.from_config(a  )
					# Start by copying the full teacher state dict this will copy the first N teacher layers to the student.
					__A	:						Any       =				student.load_state_dict(teacher.state_dict()					,						strict=a  )
					assert info.missing_keys == [], info.missing_keys  # every student key should have a teacher keys.

					if copy_first_teacher_layers:  # Our copying is done. We just log and save
										__A    ,				__A	:						Optional[int]       =				list(range(a  )  ), list(range(a  )  )
										logger.info(
										    F"""Copied encoder layers {e_layers_to_copy} and decoder layers {d_layers_to_copy}. Saving them to"""
										    F""" {save_path}"""  )
										student.save_pretrained(a  )
										return student, e_layers_to_copy, d_layers_to_copy

					# Decide which layers of the teacher to copy. Not exactly alternating -- we try to keep first and last layer.
					if e_layers_to_copy is None:
										__A	:						List[int]       =				pick_layers_to_copy(a					,						a  )
					if d_layers_to_copy is None:
										__A	:						List[int]       =				pick_layers_to_copy(a					,						a  )

					try:
										if hasattr(
										    a					,						'prophetnet'  ):  # For ProphetNet, student.model.encoder.layers is called student.prophetnet.encoder.layers
															copy_layers(teacher.prophetnet.encoder.layers					,						student.prophetnet.encoder.layers					,						a  )
															copy_layers(teacher.prophetnet.decoder.layers					,						student.prophetnet.decoder.layers					,						a  )
										else:
															copy_layers(teacher.model.encoder.layers					,						student.model.encoder.layers					,						a  )
															copy_layers(teacher.model.decoder.layers					,						student.model.decoder.layers					,						a  )
					except AttributeError:  # For t5, student.model.encoder.layers is called student.encoder.block
										copy_layers(teacher.encoder.block					,						student.encoder.block					,						a  )
										copy_layers(teacher.decoder.block					,						student.decoder.block					,						a  )
					logger.info(
					    F"""Copied encoder layers {e_layers_to_copy} and decoder layers {d_layers_to_copy}. Saving them to {save_path}"""  )
					__A	:						Optional[int]       =				{
					    'teacher_type': teacher.config.model_type,
					    'copied_encoder_layers': e_layers_to_copy,
					    'copied_decoder_layers': d_layers_to_copy,
					}
					student.save_pretrained(a  )
					# Save information about copying for easier reproducibility

					return student, e_layers_to_copy, d_layers_to_copy


if __name__ == "__main__":
				fire.Fire(create_student_by_copying_alternating_layers)




