class_docstr: This lobe enables the integration of use of weighted sum representations
  from different layers in a SSL encoder.
  
  The model can be used as a fixed feature extractor for SSL benchmarking. It
  will download automatically the model from HuggingFace or use a local path.
  
  More details in recipes/SSL_benchmark
  
  Arguments
  ---------
  hub : str
      HuggingFace hub name: e.g "facebook/wav2vec2-large-lv60"
  layernorm: bool, (default: False)
      Whether layer representations should be layernormed before sum
  
  Example
  -------
  >>> inputs = torch.rand([10, 600])
  >>> model_hub = "facebook/wav2vec2-base-960h"
  >>> model = WeightedSSLModel(model_hub)
  >>> outputs = model(inputs)
code: def __init__(self, hub, layernorm=False):
      super().__init__(source=hub)
      self.model.eval()
      self.num_layers = self.config.num_hidden_layers + 1
      # Initializing the learnable weights
      zero_init = torch.cat([torch.zeros(self.num_layers)])
      self.weights = torch.nn.Parameter(zero_init, requires_grad=True)
      self.layernorm = layernorm
  
file_path: speechbrain/speechbrain/lobes/models/huggingface_transformers/weighted_ssl.py
imports: import torch
  import logging
  import torch.nn.functional
  from speechbrain.lobes.models.huggingface_transformers.huggingface import HFTransformersInterface
label_desc: Use image node_id 1 to create a new WeightedSSLModel object from inherited base classes: HFTransformersInterface with example: obj = WeightedSSLModel(hub, layernorm)