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
| Name | Kind | Defined in |
|---|---|---|
dot_join | function | params_proto.v2.hyper |
key_items | function | params_proto.v2.hyper |
flatten_items | function | params_proto.v2.hyper |
Sweep | class | params_proto.v2.hyper |
params_proto.v2.hyper
dot_join
dot_join(*keys)remove Nones from the keys, but not '',
Parameters
| Parameter | Type / default | Description |
|---|---|---|
*keys | —variadic | — |
key_items
key_items(d, prefix = None)Takes in tuples of [key, value], or [None, [[key, value], ...]] returns wtf
Parameters
| Parameter | Type / default | Description |
|---|---|---|
d | —required | — |
prefix | —= None | — |
flatten_items
flatten_items(row) → Iterable[Item]Parameters
| Parameter | Type / default | Description |
|---|---|---|
row | —required | — |
Returns
Iterable[Item]
Sweep
Sweep(*protos: Meta)Parameters
| Parameter | Type / default | Description |
|---|---|---|
*protos | Metavariadic | — |
Attributes
| Name | Type / value | Description |
|---|---|---|
file | None | — |
Sweep.each
Sweep.each(fn)Parameters
| Parameter | Type / default | Description |
|---|---|---|
fn | —required | — |
Sweep.__init__
Sweep.__init__(*protos: Meta)Parameters
| Parameter | Type / default | Description |
|---|---|---|
*protos | Metavariadic | — |
Sweep.items
Sweep.items()Sweep.list
Sweep.listreturns self as a list. Currently not idempotent. Might become idempotent in the future.
Sweep.dataframe
Sweep.dataframeSweep.noot
Sweep.nootSweep.snack
Sweep.snackSweep.original
Sweep.originalSweep.set_param
Sweep.set_param(name, params, prefix = None)Parameters
| Parameter | Type / default | Description |
|---|---|---|
name | —required | — |
params | —required | — |
prefix | —= None | — |
Sweep.product
Sweep.product: ContextManager[None]Type
ContextManager[None]
Sweep.zip
Sweep.zip: ContextManager[T]Type
ContextManager[T]
Sweep.set
Sweep.set: ContextManager[T]Type
ContextManager[T]
Sweep.chain
Sweep.chain: ContextManager[T]Type
ContextManager[T]
Sweep.save
Sweep.save(filename = 'sweep.jsonl', overwrite = True, verbose = True)Parameters
| Parameter | Type / default | Description |
|---|---|---|
filename | —= 'sweep.jsonl' | — |
overwrite | —= True | — |
verbose | —= True | — |
Sweep.log
Sweep.log(deps, filename)append deps object to a JSONL log file, used as a helper function
Parameters
| Parameter | Type / default | Description |
|---|---|---|
deps | —required | — |
filename | —required | — |
Sweep.read
Sweep.read(filename)Read JSONL log files, used as a helper function
Parameters
| Parameter | Type / default | Description |
|---|---|---|
filename | —required | — |
Sweep.load
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::
Usage Pattern 2: Loading from a sweep list object or a pandas DataFrame::
Parameters
| Parameter | Type / default | Description |
|---|---|---|
file | —= 'sweep.jsonl' | — |
strict | —= True | — |
silent | —= False | — |
Public imports
These symbols are available from this module. Their definitions are documented in the linked modules.
Meta—params_proto.v2.proto.MetaParamsProto—params_proto.v2.proto.ParamsProtoProto—params_proto.v2.proto.Proto