class_docstr: Transformer backend wih Huggingface transformer models
class_docstr_tok: ["Transformer","backend","wih","Huggingface","transformer","models"]
docstr: Generate the output from transformer layers. For huggingface models the
  output encoded layers is a Tuple(last layer output, all layers). So the
  order is reversed to match the output order of other backends.
docstr_tok: ["Generate","the","output","from","transformer","layers",".","For","huggingface","models","the","output","encoded","layers","is","a","Tuple","(","last","layer","output",",","all","layers",")",".","So","the","order","is","reversed","to","match","the","output","order","of","other","backends","."]
code: def generate_encoded_layers(
      self, embedding, attention_mask
  ) -> List[Tensor]:
      """Generate the output from transformer layers. For huggingface models the
      output encoded layers is a Tuple(last layer output, all layers). So the
      order is reversed to match the output order of other backends.
      """
      if torch.jit.is_scripting():
          encoded_layers = self.transformer.encoder(
              embedding, attention_mask
          )
      else:
          encoded_layers = self.transformer.encoder(
              embedding,
              attention_mask,
              [None] * len(self.transformer.encoder.layer),
          )
      return encoded_layers[-1], encoded_layers[0]
  
imports: from copy import deepcopy
  from typing import Any, Dict, List, Type
  import torch
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformer, BaseTransformerBackend
  from mmf.modules.hf_layers import BertModelJit, replace_with_jit
  from omegaconf import OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 8 for calling the HuggingfaceBackend obj's underlying member method code with example usage: obj.generate_encoded_layers(embedding, attention_mask) and returns: encoded_layers,  encoded_layers