class_docstr: Tool for running many experiments given hyperparameter ranges.
class_docstr_tok: ["Tool","for","running","many","experiments","given","hyperparameter","ranges","."]
docstr: Makes a list of dicts, where each dict is a valid config in the grid.
  
  There is special handling for variant parameters whose names take
  the form
  
      ``'full:param:name'``.
  
  The colons are taken to indicate that these parameters should
  have a nested dict structure. eg, if there are two params,
  
      ====================  ===
      Key                   Val
      ====================  ===
      ``'base:param:a'``    1
      ``'base:param:b'``    2
      ====================  ===
  
  the variant dict will have the structure
  
  .. parsed-literal::
  
      variant = {
          base: {
              param : {
                  a : 1,
                  b : 2
                  }
              }    
          }
docstr_tok: ["Makes","a","list","of","dicts",",","where","each","dict","is","a","valid","config","in","the","grid",".","There","is","special","handling","for","variant","parameters","whose","names","take","the","form","``","'full",":","param",":","name","'","``",".","The","colons","are","taken","to","indicate","that","these","parameters","should","have","a","nested","dict","structure",".","eg",",","if","there","are","two","params",",","====================","===","Key","Val","====================","===","``","'base",":","param",":","a","'","``","1","``","'base",":","param",":","b","'","``","2","====================","===","the","variant","dict","will","have","the","structure","..","parsed-literal",":",":","variant","=","{","base",":","{","param",":","{","a",":","1",",","b",":","2","}","}","}"]
code: def variants(self):
      """
      Makes a list of dicts, where each dict is a valid config in the grid.
  
      There is special handling for variant parameters whose names take
      the form
  
          ``'full:param:name'``.
  
      The colons are taken to indicate that these parameters should
      have a nested dict structure. eg, if there are two params,
  
          ====================  ===
          Key                   Val
          ====================  ===
          ``'base:param:a'``    1
          ``'base:param:b'``    2
          ====================  ===
  
      the variant dict will have the structure
  
      .. parsed-literal::
  
          variant = {
              base: {
                  param : {
                      a : 1,
                      b : 2
                      }
                  }
              }
      """
      flat_variants = self._variants(self.keys, self.vals)
  
      def unflatten_var(var):
          """
          Build the full nested dict version of var, based on key names.
          """
          new_var = dict()
          unflatten_set = set()
  
          for k, v in var.items():
              if ":" in k:
                  splits = k.split(":")
                  k0 = splits[0]
                  assert k0 not in new_var or isinstance(
                      new_var[k0], dict
                  ), "You can't assign multiple values to the same key."
  
                  if not (k0 in new_var):
                      new_var[k0] = dict()
  
                  sub_k = ":".join(splits[1:])
                  new_var[k0][sub_k] = v
                  unflatten_set.add(k0)
              else:
                  assert not (
                      k in new_var
                  ), "You can't assign multiple values to the same key."
                  new_var[k] = v
  
          # Make sure to fill out the nested dicts.
          for k in unflatten_set:
              new_var[k] = unflatten_var(new_var[k])
  
          return new_var
  
      new_variants = [unflatten_var(var) for var in flat_variants]
      return new_variants
  
imports: from spinup.user_config import DEFAULT_DATA_DIR, FORCE_DATESTAMP, DEFAULT_SHORTHAND, WAIT_BEFORE_LAUNCH
  from spinup.utils.logx import colorize
  from spinup.utils.mpi_tools import mpi_fork, msg
  from spinup.utils.serialization_utils import convert_json
  import base64
  from copy import deepcopy
  import cloudpickle
  import json
  import numpy
  import os
  import os.path
  import psutil
  import string
  import subprocess
  from subprocess import CalledProcessError
  import sys
  from textwrap import dedent
  import time
  from tqdm import trange
  import zlib
label_desc: Use image node_id 8 for calling the ExperimentGrid obj's underlying member method code with example usage: obj.variants() and returns: new_variants, new_var