class_docstr: DocModel that's compatible with the new Model abstraction, which is responsible
  for describing which inputs it expects and arranging its input tensors.
class_docstr_tok: ["DocModel","that","'s","compatible","with","the","new","Model","abstraction",",","which","is","responsible","for","describing","which","inputs","it","expects","and","arranging","its","input","tensors","."]
code: def from_config(
      cls, config: Config, tensorizers: Dict[str, Tensorizer]
  ):
      labels = tensorizers["labels"].vocab
      if not labels:
          raise ValueError(
              "Labels were not created, see preceding errors"
          )
  
      embedding = cls.create_embedding(config, tensorizers)
      representation = create_module(
          config.representation, embed_dim=embedding.embedding_dim
      )
      decoder = cls.create_decoder(
          config, representation.representation_dim, len(labels)
      )
  
      output_layer = cls.create_output_layer(config, labels=labels)
      return cls(embedding, representation, decoder, output_layer)
  
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 12 for calling the DocModel obj's underlying member method code with example usage: obj.from_config(cls, config, tensorizers) and returns: cls