params-proto

v2 · Sweeps

Legacy v2 Sweep composition, iteration, serialization, and loading.

These compatibility APIs ship with the selected source version. See the compatibility overview for other v1/v2 APIs, or migration when upgrading.

API index

NameKindDefined in
dot_joinfunctionparams_proto.v2.hyper
key_itemsfunctionparams_proto.v2.hyper
flatten_itemsfunctionparams_proto.v2.hyper
Sweepclassparams_proto.v2.hyper

params_proto.v2.hyper

dot_join

functionparams_proto.v2.hyper.dot_joinSource ↗
dot_join(*keys)

remove Nones from the keys, but not '',

ParameterType / defaultDescription
*keys
variadic

key_items

functionparams_proto.v2.hyper.key_itemsSource ↗
key_items(d, prefix = None)

Takes in tuples of [key, value], or [None, [[key, value], ...]] returns wtf

ParameterType / defaultDescription
d
required
prefix
= None

flatten_items

functionparams_proto.v2.hyper.flatten_itemsSource ↗
flatten_items(row) → Iterable[Item]
ParameterType / defaultDescription
row
required

Iterable[Item]

Sweep

classparams_proto.v2.hyper.SweepSource ↗
Sweep(*protos: Meta)
ParameterType / defaultDescription
*protosMeta
variadic
NameType / valueDescription
fileNone

Sweep.each

methodparams_proto.v2.hyper.Sweep.eachSource ↗
Sweep.each(fn)
ParameterType / defaultDescription
fn
required

Sweep.__init__

methodparams_proto.v2.hyper.Sweep.__init__Source ↗
Sweep.__init__(*protos: Meta)
ParameterType / defaultDescription
*protosMeta
variadic

Sweep.items

methodparams_proto.v2.hyper.Sweep.itemsSource ↗
Sweep.items()

Sweep.list

propertyparams_proto.v2.hyper.Sweep.listSource ↗
Sweep.list

returns self as a list. Currently not idempotent. Might become idempotent in the future.

Sweep.dataframe

propertyparams_proto.v2.hyper.Sweep.dataframeSource ↗
Sweep.dataframe

Sweep.noot

propertyparams_proto.v2.hyper.Sweep.nootSource ↗
Sweep.noot

Sweep.snack

propertyparams_proto.v2.hyper.Sweep.snackSource ↗
Sweep.snack

Sweep.original

propertyparams_proto.v2.hyper.Sweep.originalSource ↗
Sweep.original

Sweep.set_param

methodparams_proto.v2.hyper.Sweep.set_paramSource ↗
Sweep.set_param(name, params, prefix = None)
ParameterType / defaultDescription
name
required
params
required
prefix
= None

Sweep.product

propertyparams_proto.v2.hyper.Sweep.productSource ↗
Sweep.product: ContextManager[None]

ContextManager[None]

Sweep.zip

propertyparams_proto.v2.hyper.Sweep.zipSource ↗
Sweep.zip: ContextManager[T]

ContextManager[T]

Sweep.set

propertyparams_proto.v2.hyper.Sweep.setSource ↗
Sweep.set: ContextManager[T]

ContextManager[T]

Sweep.chain

propertyparams_proto.v2.hyper.Sweep.chainSource ↗
Sweep.chain: ContextManager[T]

ContextManager[T]

Sweep.save

methodparams_proto.v2.hyper.Sweep.saveSource ↗
Sweep.save(filename = 'sweep.jsonl', overwrite = True, verbose = True)
ParameterType / defaultDescription
filename
= 'sweep.jsonl'
overwrite
= True
verbose
= True

Sweep.log

static methodparams_proto.v2.hyper.Sweep.logSource ↗
Sweep.log(deps, filename)

append deps object to a JSONL log file, used as a helper function

ParameterType / defaultDescription
deps
required
filename
required

Sweep.read

static methodparams_proto.v2.hyper.Sweep.readSource ↗
Sweep.read(filename)

Read JSONL log files, used as a helper function

ParameterType / defaultDescription
filename
required

Sweep.load

methodparams_proto.v2.hyper.Sweep.loadSource ↗
Sweep.load(file = 'sweep.jsonl', strict = True, silent = False)

Loading sweep state from a jsonl file:

Note: Important Caveat When multiple prefix-free ParamsProto objects are present, We sweep through all of the proto objects and sets the attribute to the first proto with the correct key. This first-attr approach works because the ParamsProto object also generates argparse parameters, which means repetitive arguments are not possible.

However this would fail in cases where attributes are dynamically added to an argument object. The sweep.jsonl file loses this type of information, therefore there is no way to recover this type of attributes. So the user should try to either use PrefixProto, or explicitly define the attributes.

Usage Pattern 1: Loading from a file::

python
sweep = Sweep(Args, RUN).load('sweep.jsonl')
for i, deps in enumerate(sweep):
    assert RUN.job_id == i + 1, "the job_id in that sweep.json should be 1-based."

Usage Pattern 2: Loading from a sweep list object or a pandas DataFrame::

python
sweep_list = Sweep.read(sweep.jsonl)
sweep = Sweep(Args, RUN).load(sweep_list)
for i, deps in enumerate(sweep):
    assert RUN.job_id == i + 1, "the job_id in that sweep.json should be 1-based."
ParameterType / defaultDescription
file
= 'sweep.jsonl'
strict
= True
silent
= False

Public imports

These symbols are available from this module. Their definitions are documented in the linked modules.

  • Metaparams_proto.v2.proto.Meta
  • ParamsProtoparams_proto.v2.proto.ParamsProto
  • Protoparams_proto.v2.proto.Proto