code: def _load_from_state_dict(
      # Union["ShardedQuantEmbeddingBagCollection", "ShardedQuantEmbeddingCollection"]
      self,
      state_dict: Mapping[str, Any],
      prefix: str,
      # pyre-ignore
      local_metadata,
      strict: bool,
      missing_keys: List[str],
      unexpected_keys: List[str],
      error_msgs: List[str],
  ) -> None:
      dst_state_dict = self.state_dict()
      _missing_keys: List[str] = []
      _unexpected_keys: List[str] = list(state_dict.keys())
      for name, dst_tensor in dst_state_dict.items():
          src_state_dict_name = prefix + name
          if src_state_dict_name not in state_dict:
              _missing_keys.append(src_state_dict_name)
              continue
  
          src_tensor = state_dict[src_state_dict_name]
          if isinstance(dst_tensor, ShardedTensorBase) and isinstance(
              src_tensor, ShardedTensorBase
          ):
              # sharded to sharded model, only identically sharded
              for dst_local_shard in dst_tensor.local_shards():
                  copied: bool = False
                  for src_local_shard in src_tensor.local_shards():
                      if (
                          dst_local_shard.metadata.shard_offsets
                          == src_local_shard.metadata.shard_offsets
                          and dst_local_shard.metadata.shard_sizes
                          == src_local_shard.metadata.shard_sizes
                      ):
                          dst_local_shard.tensor.copy_(
                              src_local_shard.tensor
                          )
                          copied = True
                          break
                  assert copied, "Incompatible state_dict"
          elif isinstance(dst_tensor, ShardedTensorBase) and isinstance(
              src_tensor, torch.Tensor
          ):
              # non_sharded to sharded model
              for dst_local_shard in dst_tensor.local_shards():
                  dst_tensor = dst_local_shard.tensor
                  assert src_tensor.ndim == dst_tensor.ndim
                  meta = dst_local_shard.metadata
                  t = src_tensor.detach()
                  rows_from = meta.shard_offsets[0]
                  rows_to = rows_from + meta.shard_sizes[0]
                  if t.ndim == 1:
                      dst_tensor.copy_(t[rows_from:rows_to])
                  elif t.ndim == 2:
                      cols_from = meta.shard_offsets[1]
                      cols_to = cols_from + meta.shard_sizes[1]
                      dst_tensor.copy_(
                          t[
                              rows_from:rows_to,
                              cols_from:cols_to,
                          ]
                      )
                  else:
                      raise RuntimeError(
                          "Tensors with ndim > 2 are not supported"
                      )
          elif isinstance(dst_tensor, list) and isinstance(
              src_tensor, torch.Tensor
          ):
              # non_sharded to CW columns qscale, qbias (one to many)
              for t in dst_tensor:
                  assert isinstance(t, torch.Tensor)
                  t.copy_(src_tensor)
          else:
              dst_tensor.copy_(src_tensor)
  
          _unexpected_keys.remove(src_state_dict_name)
      missing_keys.extend(_missing_keys)
      unexpected_keys.extend(_unexpected_keys)
  
imports: import copy
  from dataclasses import dataclass
  from typing import Any, Dict, List, Mapping, Optional, TypeVar, Union
  import torch
  from fbgemm_gpu.split_table_batched_embeddings_ops_inference import IntNBitTableBatchedEmbeddingBagsCodegen
  from torch.distributed import _remote_device
  from torch.distributed._shard.sharded_tensor import Shard, ShardedTensorBase, ShardedTensorMetadata, ShardMetadata
  from torchrec.distributed.embedding_sharding import EmbeddingShardingInfo
  from torchrec.distributed.embedding_types import GroupedEmbeddingConfig, ShardedEmbeddingModule
  from torchrec.distributed.types import ParameterSharding, ShardingType
  from torchrec.modules.embedding_configs import DataType
  from torchrec.streamable import Multistreamable
  from torchrec.tensor_types import UInt2Tensor, UInt4Tensor
label_desc: Use image node_id 2 for calling the ShardedQuantEmbeddingModuleState obj's underlying member method code with example usage: obj._load_from_state_dict(state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs) without return types