class_docstr: Adds adapters to the BertModel module.
class_docstr_tok: ["Adds","adapters","to","the","BertModel","module","."]
docstr: Freeze the embeddings and language adapters of the model. Usually, this is applied before the model is
  fine-tuned on a downstream task.
docstr_tok: ["Freeze","the","embeddings","and","language","adapters","of","the","model",".","Usually",",","this","is","applied","before","the","model","is","fine-tuned","on","a","downstream","task","."]
code: 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.
      """
      # TODO: Replace this by a general method for `adapters`.
      logger.info("Freezing embeddings")
      for parameter in self.base_model.embeddings.parameters():
          parameter.requires_grad = False
      logger.info("Freezing adapters")
      for adapter_name in self.adapters_config:
          self.apply_to_adapter_layers(
              lambda i, layer: layer.freeze_adapter(adapter_name)
          )
  
file_path: adapters/src/adapters/models/xmod/mixin_xmod.py
imports: from typing import Iterable, Tuple
  import torch.nn
  from transformers.utils import logging
  from ...composition import adjust_tensors_for_parallel_
  from ...model_mixin import EmbeddingAdaptersMixin, InvertibleAdaptersMixin, ModelBaseAdaptersMixin
label_desc: Use image node_id 6 for calling the XmodModelAdaptersMixin obj's underlying member method code with example usage: obj.freeze_embeddings_and_language_adapters() without return types