class_docstr: This lobe enables the integration of HuggingFace and SpeechBrain
  pretrained LaBSE models.
  
  Source paper LaBSE: https://arxiv.org/abs/2007.01852
  Transformer from HuggingFace needs to be installed:
  https://huggingface.co/transformers/installation.html
  
  The model can be used as a fixed text-based sentence-level embeddings generator or can be finetuned.
  It will download automatically the model from HuggingFace or use a local path.
  
  Arguments
  ---------
  source : str
      HuggingFace hub name: e.g "setu4993/LaBSE"
  save_path : str
      Path (dir) of the downloaded model.
  freeze : bool (default: True)
      If True, the model is frozen. If False, the model will be trained
      alongside with the rest of the pipeline.
  output_norm : bool (default: True)
      If True, normalize the output.
  Example
  -------
  >>> inputs = ["La vie est belle"]
  >>> model_hub = "setu4993/smaller-LaBSE"
  >>> save_path = "savedir"
  >>> model = LaBSE(model_hub, save_path)
  >>> outputs = model(inputs)
docstr: This method implements a forward of the labse model,
  which generates sentence-level embeddings from input text.
  
  Arguments
  ----------
  input_texts (translation): list
      The list of texts (required).
docstr_tok: ["This","method","implements","a","forward","of","the","labse","model",",","which","generates","sentence-level","embeddings","from","input","text",".","Arguments","--","--","--","--","--","input_texts","(","translation",")",":","list","The","list","of","texts","(","required",")","."]
code: def forward(self, input_texts):
      """This method implements a forward of the labse model,
      which generates sentence-level embeddings from input text.
  
      Arguments
      ----------
      input_texts (translation): list
          The list of texts (required).
      """
  
      # Transform input to the right format of the LaBSE model.
      if self.freeze:
          with torch.no_grad():
              # Tokenize the input text before feeding to LaBSE model.
              input_texts = self.tokenizer(
                  input_texts, return_tensors="pt", padding=True
              )
              # Set the right device for the input.
              for key in input_texts.keys():
                  input_texts[key] = input_texts[key].to(
                      device=self.model.device
                  )
                  input_texts[key].requires_grad = False
  
              embeddings = self.model(**input_texts).pooler_output
  
              if self.output_norm:
                  # Output normalizing if needed.
                  embeddings = F.normalize(embeddings, p=2)
  
              return embeddings
  
      # Tokenize the input text before feeding to LaBSE model.
      input_texts = self.tokenizer(
          input_texts, return_tensors="pt", padding=True
      )
      # Set the right device for the input.
      for key in input_texts.keys():
          input_texts[key] = input_texts[key].to(
              device=self.model.device
          )
  
      embeddings = self.model(**input_texts).pooler_output
  
      if self.output_norm:
          # Output normalizing if needed.
          embeddings = F.normalize(embeddings, p=2)
  
      return embeddings
  
file_path: speechbrain/speechbrain/lobes/models/huggingface_transformers/labse.py
imports: import torch
  import logging
  import torch.nn.functional
  import os
  from speechbrain.lobes.models.huggingface_transformers.huggingface import HFTransformersInterface
label_desc: Use image node_id 2 for calling the LaBSE obj's underlying member method code with example usage: obj.forward(input_texts) and returns: embeddings, embeddings