code: def create_quant_and_sharded_ebc_models(
      num_embedding: int,
      emb_dim: int,
      world_size: int,
      batch_size: int,
      sharding_type: ShardingType,
      device: torch.device,
  ) -> Tuple[torch.nn.Module, torch.nn.Module]:
      mi = create_test_model_ebc_only_no_quantize(
          num_embedding,
          emb_dim,
          world_size,
          batch_size,
          num_features=1,
          num_weighted_features=0,
          dense_device=device,
          sparse_device=device,
      )
      mi.model.to(device)
  
      pruning_ebc_dict = get_even_indices_pruning_ebc_dict(
          "table_0", num_embedding
      )
      quant_model = prune_and_quantize_model(
          mi.model, pruning_ebc_dict, SEQUENTIAL_NN_EBC_MODULE
      )
  
      quant_model = quant_model[0]
      mi.quant_model = quant_model
  
      sharded_model = shard_qebc(
          mi,
          sharding_type=sharding_type,
          device=device,
          expected_shards=None,
      )
  
      sharded_model.load_state_dict(quant_model.state_dict())
  
      return quant_model, sharded_model
  
file_path: torchrec/torchrec/distributed/tests/test_quant_pruning.py
imports: import io
  import unittest
  from typing import Dict, List, Tuple
  import torch
  from torchrec.distributed.embedding_types import ShardingType
  from torchrec.distributed.quant_state import sharded_tbes_weights_spec, WeightSpec
  from torchrec.distributed.test_utils.infer_utils import assert_close, assert_weight_spec, create_test_model, create_test_model_ebc_only_no_quantize, model_input_to_forward_args, prep_inputs, quantize, shard_qebc
  from torchrec.fx import symbolic_trace
  from torchrec.quant.embedding_modules import MODULE_ATTR_EMB_CONFIG_NAME_TO_PRUNING_INDICES_REMAPPING_DICT
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
label_desc: Use image node_id 3 for calling a global function with example usage: create_quant_and_sharded_ebc_models(num_embedding, emb_dim, world_size, batch_size, sharding_type, device) and returns: quant_model,  sharded_model