class_docstr: DocModel that includes a user embedding which learns user features to produce
  personalized prediction. In this class, user-embedding is fed directly to
  the decoder (i.e., does not go through the encoders).
class_docstr_tok: ["DocModel","that","includes","a","user","embedding","which","learns","user","features","to","produce","personalized","prediction",".","In","this","class",",","user-embedding","is","fed","directly","to","the","decoder","(","i.e.",",","does","not","go","through","the","encoders",")","."]
code: def from_config(cls, config, tensorizers: Dict[str, Tensorizer]):
      model = super().from_config(config, tensorizers)
  
      user_embedding = create_module(
          config.user_embedding,
          tensorizer=tensorizers["uid"],
          init_from_saved_state=config.init_from_saved_state,
      )
      # Init user embeddings to be a same vector because we assume user features
      # are not too different from each other.
      emb_shape = user_embedding.word_embedding.weight.data.shape
      with torch.no_grad():
          user_embedding.word_embedding.weight.copy_(
              torch.rand(emb_shape[1]).repeat(emb_shape[0], 1)
          )
  
      labels = tensorizers["labels"].vocab
      decoder = cls.create_decoder(
          config,
          model.representation.representation_dim
          + user_embedding.embedding_dim,
          len(labels),
      )
  
      return cls(
          model.embedding,
          model.representation,
          decoder,
          model.output_layer,
          user_embedding,
      )
  
imports: from typing import Dict, List, Optional, Union
  import torch
  from pytext.config.component import create_loss
  from pytext.data.tensorizers import ByteTokenTensorizer, FloatListTensorizer, LabelTensorizer, NumericLabelTensorizer, Tensorizer, TokenTensorizer, UidTensorizer, VocabConfig
  from pytext.data.tokenizers import DoNothingTokenizer
  from pytext.exporters.exporter import ModelExporter
  from pytext.loss import BinaryCrossEntropyLoss, BinaryCrossEntropyWithLogitsLoss, MultiLabelSoftMarginLoss
  from pytext.models.decoders.mlp_decoder import DecoderBase, MLPDecoder
  from pytext.models.embeddings import CharacterEmbedding, EmbeddingBase, EmbeddingList, WordEmbedding
  from pytext.models.model import Model
  from pytext.models.module import create_module
  from pytext.models.output_layers import ClassificationOutputLayer, OutputLayerBase, RegressionOutputLayer
  from pytext.models.output_layers.doc_classification_output_layer import BinaryClassificationOutputLayer, MulticlassOutputLayer, MultiLabelOutputLayer
  from pytext.models.representations.bilstm_doc_attention import BiLSTMDocAttention
  from pytext.models.representations.deepcnn import DeepCNNRepresentation
  from pytext.models.representations.docnn import DocNNRepresentation
  from pytext.models.representations.pure_doc_attention import PureDocAttention
  from pytext.models.representations.representation_base import RepresentationBase
  from pytext.torchscript.utils import make_byte_inputs, make_sequence_lengths, truncate_tokens
  from pytext.torchscript.vocab import ScriptVocabulary
  from pytext.utils.label import get_label_weights
  from pytext.utils.usage import log_class_usage
  from pytorch.text.fb.utils.transform_utils import pad_2d
  from torch import jit
label_desc: Use image node_id 1 for calling the PersonalizedDocModel obj's underlying member method code with example usage: obj.from_config(cls, config, tensorizers) and returns: cls