class_docstr: Serializable data structure for holding data for blocks --
  embeddings and necessary metadata for Retriever
class_docstr_tok: ["Serializable","data","structure","for","holding","data","for","blocks","--","embeddings","and","necessary","metadata","for","Retriever"]
code: def merge_shards_and_save(self):
      # Combine all the shards made using save_shard
      shard_names = os.listdir(self.temp_dir_name)
      seen_own_shard = False
  
      for fname in os.listdir(self.temp_dir_name):
          shard_rank = int(os.path.splitext(fname)[0])
          if shard_rank == self.rank:
              seen_own_shard = True
              continue
  
          with open(
              "{}/{}".format(self.temp_dir_name, fname), "rb"
          ) as f:
              data = pickle.load(f)
              old_size = len(self.embed_data)
              shard_size = len(data["embed_data"])
  
              # add the shard's data and check to make sure there
              # is no overlap
              self.embed_data.update(data["embed_data"])
              assert len(self.embed_data) == old_size + shard_size
  
      assert seen_own_shard
  
      # save the consolidated shards and remove temporary directory
      with open(self.embedding_path, "wb") as final_file:
          pickle.dump(self.state(), final_file)
      shutil.rmtree(self.temp_dir_name, ignore_errors=True)
  
      print(
          "Finished merging {} shards for a total of {} embeds".format(
              len(shard_names), len(self.embed_data)
          ),
          flush=True,
      )
  
imports: import itertools
  import os
  import pickle
  import shutil
  import numpy
  import torch
  from megatron import get_args
  from megatron.core import mpu
label_desc: Use image node_id 7 for calling the OpenRetreivalDataStore obj's underlying member method code with example usage: obj.merge_shards_and_save() without return types