def save_model_config(self, save_dir):
        """
        Saves model configuration to a file named "model_config.json" under `save_dir`.

        Args:
            save_dir (str): Directory to save model_config file into.
        """
        # Save model config
        model_config_file = os.path.join(save_dir, self.model_config_file)
        model_config = self.init_config
        # If init_config contains a Layer, use the layer's init_config to save
        for key, value in model_config.items():
            if key == "init_args":
                args = []
                for arg in value:
                    args.append(
                        arg.init_config
                        if isinstance(arg, PretrainedModel) else arg)
                model_config[key] = tuple(args)
            elif isinstance(value, PretrainedModel):
                model_config[key] = value.init_config
        with io.open(model_config_file, "w", encoding="utf-8") as f:
            f.write(json.dumps(model_config, ensure_ascii=False))

        Saves model configuration to a file named "model_config.json" under `save_dir`.

        Args:
            save_dir (str): Directory to save model_config file into.
        
ptstructure/vqa/pytorchnlp/transformers/model_utils.py