def freeze_embeddings_and_language_adapters(self):
        """
        Freeze the embeddings and language adapters of the model. Usually, this is applied before the model is
        fine-tuned on a downstream task.
        """
        logger.info("Freezing embeddings")
        for parameter in self.roberta.embeddings.parameters():
            parameter.requires_grad = False
        logger.info("Freezing adapters")
        for layer in self.roberta.encoder.layer:
            if layer.output.adapter_layer_norm is not None:
                for parameter in layer.output.adapter_layer_norm.parameters():
                    parameter.requires_grad = False
            for parameter in layer.output.adapter_modules.parameters():
                parameter.requires_grad = False

        Freeze the embeddings and language adapters of the model. Usually, this is applied before the model is
        fine-tuned on a downstream task.
        
dpkd/transformers/src/transformers/models/xmod/modeling_xmod.py