def as_vanilla_model(self):
        """
        Return a vanilla Whisper model instance with current weights.

        The new instance is only loaded once. Most weights share the same memory as this Hugging Face model instance.
        """
        if self._vanilla_model is not None:
            return self._vanilla_model

        from ..whisper_compatibility import ModelDimensions, Whisper, ln_to_fp32
        from .original_whisper import modify_model
        try:
            from transformers.models.whisper.convert_openai_to_hf import WHISPER_MAPPING
            whisper2hf_mapping = WHISPER_MAPPING
        except (ImportError, ModuleNotFoundError):
            whisper2hf_mapping = WHISPER_TO_HF_MAPPING

        hf_mapping = {v: k for k, v in whisper2hf_mapping.items()}
        assert len(whisper2hf_mapping) == len(hf_mapping)

        state_dict = self._pipe.model.model.state_dict()
        config = self._pipe.model.config

        if 'encoder.layer_norm.' in hf_mapping:
            hf_mapping['encoder.layer_norm.'] = 'encoder.ln_post.'
        for key in list(state_dict.keys()):
            new_key = key
            for k, v in hf_mapping.items():
                if k in key:
                    new_key = new_key.replace(k, v)
            if new_key != key:
                state_dict[new_key] = state_dict.pop(key)

        dims = ModelDimensions(
            n_mels=config.num_mel_bins,
            n_audio_ctx=config.max_source_positions,
            n_audio_state=config.d_model,
            n_audio_head=config.encoder_attention_heads,
            n_audio_layer=config.encoder_layers,
            n_vocab=config.vocab_size,
            n_text_ctx=config.max_target_positions,
            n_text_state=self._pipe.model.model.decoder.embed_positions.embedding_dim,
            n_text_head=config.decoder_attention_heads,
            n_text_layer=config.decoder_layers
        )
        new_model = Whisper(dims)
        if alignment_heads := getattr(self._pipe.model.generation_config, 'alignment_heads', None):
            alignment_heads = torch.as_tensor(alignment_heads).T
            final_heads = torch.zeros(new_model.dims.n_text_layer, new_model.dims.n_text_head, dtype=torch.bool)
            final_heads[alignment_heads[0], alignment_heads[1]] = True
            new_model.register_buffer("alignment_heads", final_heads.to_sparse(), persistent=False)
        else:
            setattr(new_model, 'missing_alignment_heads', True)
        try:
            new_model.load_state_dict(state_dict, strict=True, assign=True)
        except TypeError:
            new_model.load_state_dict(state_dict, strict=True)
        new_model.to(device=self._pipe.model.device)
        ln_to_fp32(new_model)
        modify_model(new_model)
        self._vanilla_model = new_model
        return self._vanilla_model

        Return a vanilla Whisper model instance with current weights.

        The new instance is only loaded once. Most weights share the same memory as this Hugging Face model instance.
        
stable_whisper/whisper_word_level/hf_whisper.py