code: def model_dataset_from_store(s, overwrite_params={}, which="last"):
      """
      Given a store directory corresponding to a trained model, return the
      original model, dataset object, and args corresponding to the arguments.
      """
      # which options: {'best', 'last', integer}
      if type(s) is tuple:
          s, e = s
          s = cox.store.Store(s, e, mode="r")
  
      m = s["metadata"]
      df = s["metadata"].df
  
      args = df.to_dict()
      args = {k: v[0] for k, v in args.items()}
      fns = [lambda x: m.get_object(x), lambda x: m.get_pickle(x)]
      conds = [
          lambda x: m.schema[x] == s.OBJECT,
          lambda x: m.schema[x] == s.PICKLE,
      ]
      for fn, cond in zip(fns, conds):
          args = {k: (fn(v) if cond(k) else v) for k, v in args.items()}
  
      args.update(overwrite_params)
      args = Parameters(args)
  
      data_path = os.path.expandvars(args.data)
      if not data_path:
          data_path = "/tmp/"
  
      dataset = DATASETS[args.dataset](data_path)
  
      if which == "last":
          resume = os.path.join(s.path, constants.CKPT_NAME)
      elif which == "best":
          resume = os.path.join(s.path, constants.CKPT_NAME_BEST)
      else:
          assert isinstance(
              which, int
          ), "'which' must be one of {'best', 'last', int}"
          resume = os.path.join(s.path, ckpt_at_epoch(which))
  
      model, _ = make_and_restore_model(
          arch=args.arch,
          dataset=dataset,
          resume_path=resume,
          parallel=False,
      )
      return model, dataset, args
  
file_path: robustness/robustness/model_utils.py
imports: import torch
  from torch import nn
  import dill
  import os
  from .tools import helpers, constants
  from .attacker import AttackerModel
label_desc: Use image node_id 2 for calling a global function with example usage: model_dataset_from_store(s, overwrite_params, which) and returns: model,  dataset,  args