class_docstr: Reads and writes checkpoint data to/from disk.
  
  Checkpoints are saved as HDF5 files. The embeddings for an entity partition
  are stored in the `embeddings_<entity>_<partition>.v<version>.h5` file.
  
      hf = h5py.File("embeddings_foo_0.v123.h5", "r")
      embedding_of_entity_42 = hf["embeddings"][42, :]
  
  The parameters that are not specific to a certain entity (i.e., all but the
  embeddings) are stored in a `model.v<version>.h5` file.
  
      hf = h5py.File("model.v123.h5", "r")
      keys = []
      hf["model"].visit(keys.append)
      print(keys)
  
  Both files also contain the state dictionary of their optimizer, and some
  metadata as attributes on the root node.
  
      print(list(hf.attrs))
  
  Swapped-out partitions are saved to disk with an incremented version number.
  Once a training iteration completes, the model parameters are stored too,
  and then the checkpoint is committed, which consists in updating the value
  of the checkpoint_version.txt file to contain the new version number. This
  scheme is chosen to work with shared filesystems (specifically, Gluster)
  which guarantee close/open data consistency but no metadata consistency (so
  os.rename is out).
class_docstr_tok: ["Reads","and","writes","checkpoint","data","to\/from","disk",".","Checkpoints","are","saved","as","HDF5","files",".","The","embeddings","for","an","entity","partition","are","stored","in","the","`","embeddings_","<","entity",">","_","<","partition",">",".v","<","version",">",".h5","`","file",".","hf","=","h5py.File","(","``","embeddings_foo_0.v123.h5","''",",","``","r","''",")","embedding_of_entity_42","=","hf","[","``","embeddings","''","]","[","42",",",":","]","The","parameters","that","are","not","specific","to","a","certain","entity","(","i.e.",",","all","but","the","embeddings",")","are","stored","in","a","`","model.v","<","version",">",".h5","`","file",".","hf","=","h5py.File","(","``","model.v123.h5","''",",","``","r","''",")","keys","=","[","]","hf","[","``","model","''","]",".visit","(","keys.append",")","print","(","keys",")","Both","files","also","contain","the","state","dictionary","of","their","optimizer",",","and","some","metadata","as","attributes","on","the","root","node",".","print","(","list","(","hf.attrs",")",")","Swapped-out","partitions","are","saved","to","disk","with","an","incremented","version","number",".","Once","a","training","iteration","completes",",","the","model","parameters","are","stored","too",",","and","then","the","checkpoint","is","committed",",","which","consists","in","updating","the","value","of","the","checkpoint_version.txt","file","to","contain","the","new","version","number",".","This","scheme","is","chosen","to","work","with","shared","filesystems","(","specifically",",","Gluster",")","which","guarantee","close\/open","data","consistency","but","no","metadata","consistency","(","so","os.rename","is","out",")","."]
code: def copy_model_to_snapshot(
      self, version: int, epoch_idx: int
  ) -> None:
      src_path = self.get_model_file(version)
      dst_path = self.get_model_file(
          version, path=self.get_snapshot_path(epoch_idx)
      )
      dst_path.symlink_to(src_path)
  
imports: import errno
  import logging
  import os
  from abc import ABC, abstractmethod
  from pathlib import Path
  from typing import Any, Dict, Generator, List, NamedTuple, Optional, Tuple
  import h5py
  import numpy
  import torch
  from torchbiggraph.plugin import URLPluginRegistry
  from torchbiggraph.types import EntityName, FloatTensorType, ModuleStateDict, Partition
  from torchbiggraph.util import allocate_shared_tensor, CouldNotLoadData
label_desc: Use image node_id 23 for calling the FileCheckpointStorage obj's underlying member method code with example usage: obj.copy_model_to_snapshot(version, epoch_idx) without return types