code: def from_config(
      cls, config: Config, tensorizers: Dict[str, Tensorizer]
  ):
      if config.use_shared_embedding:
          token_embedding = torch.nn.Embedding(
              config.vocab_size,
              config.hidden_dim,
              padding_idx=config.padding_idx,
          )
      else:
          token_embedding = None
  
      right_vocab = tensorizers["right_tokens"].vocab
      right_encoder = create_module(
          config.right_encoder,
          token_embedding=token_embedding,
          padding_idx=right_vocab.get_pad_index(),
          vocab_size=len(right_vocab),
      )
      left_vocab = tensorizers["left_tokens"].vocab
      left_encoder = create_module(
          config.left_encoder,
          token_embedding=token_embedding,
          padding_idx=left_vocab.get_pad_index(),
          vocab_size=len(left_vocab),
      )
  
      right_dense_dim = tensorizers["right_dense"].dim
      left_dense_dim = tensorizers["left_dense"].dim
  
      decoder = create_module(
          config.decoder,
          right_dim=right_encoder.representation_dim + right_dense_dim,
          left_dim=left_encoder.representation_dim + left_dense_dim,
          to_dim=1,
      )
  
      output_layer = RegressionOutputLayer.from_config(
          config.output_layer
      )
      return cls(
          right_encoder,
          left_encoder,
          decoder,
          output_layer,
          config.use_shared_encoder,
          config.use_shared_embedding,
          config.vocab_size,
          config.hidden_dim,
          config.padding_idx,
      )
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from pytext.common.constants import Stage, TORCH_VERSION
  from pytext.config import ConfigBase
  from pytext.data.roberta_tensorizer import RoBERTaTensorizer
  from pytext.data.tensorizers import FloatListTensorizer, NumericLabelTensorizer, Tensorizer
  from pytext.models.decoders.mlp_decoder_two_tower import MLPDecoderTwoTower
  from pytext.models.model import BaseModel
  from pytext.models.module import create_module
  from pytext.models.output_layers.doc_regression_output_layer import RegressionOutputLayer
  from pytext.models.roberta import RoBERTaEncoder, RoBERTaEncoderBase
  from pytext.torchscript.module import ScriptPyTextTwoTowerModuleWithDense
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 8 for calling the TwoTowerRegressionModel obj's underlying member method code with example usage: obj.from_config(cls, config, tensorizers) and returns: cls