class_docstr: Wrapper for character aware CNN embeddings for tokens.
  Attributes:
      embedding (CNNCharacterEmbedding): Character embedding
class_docstr_tok: ["Wrapper","for","character","aware","CNN","embeddings","for","tokens",".","Attributes",":","embedding","(","CNNCharacterEmbedding",")",":","Character","embedding"]
docstr: Add backward compatibility to load CharEmbedding from older versions
  In older versions, state dict keys are like "char_embed.weight", "convs.0.weight", etc
  In newer versions, state dict keys are like "embedding.char_embed.weight", "embedding.convs.0.weight"
docstr_tok: ["Add","backward","compatibility","to","load","CharEmbedding","from","older","versions","In","older","versions",",","state","dict","keys","are","like","``","char_embed.weight","''",",","``","convs.0.weight","''",",","etc","In","newer","versions",",","state","dict","keys","are","like","``","embedding.char_embed.weight","''",",","``","embedding.convs.0.weight","''"]
code: def load_state_dict(self, loaded_module: nn.Module) -> None:
      """Add backward compatibility to load CharEmbedding from older versions
      In older versions, state dict keys are like "char_embed.weight", "convs.0.weight", etc
      In newer versions, state dict keys are like "embedding.char_embed.weight", "embedding.convs.0.weight"
      """
      try:
          # assume loaded_module was new version, with weights like embedding.convs.0.weight
          super().load_state_dict(loaded_module)
      except RuntimeError:
          # if failed, perhaps loaded_module was old version, with weights like convs.0.weight
          self.embedding.load_state_dict(loaded_module)
  
file_path: pytext/pytext/models/embeddings/char_embedding.py
imports: import warnings
  from typing import List, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from pytext.config.field_config import CharFeatConfig
  from pytext.fields import FieldMeta
  from pytext.utils.usage import log_class_usage
  from pytorch.text.fb.nn.modules.cnn_char_embedding import CNNCharacterEmbedding
  from .embedding_base import EmbeddingBase
label_desc: Use image node_id 4 for calling the CharacterEmbedding obj's underlying member method code with example usage: obj.load_state_dict(loaded_module) without return types