Wandb
Wandb plugin.
Todo
This plugin is experimental and out of date.
class WandbParams
dataclass
#
Parameters for initializing a wandb run.
This class is a dataclass that contains all the parameters that are used
to initialize a wandb run. It is used by the
WandbPlugin
to initialize a run.
It can be modified using the
modify()
method.
Please refer to the documentation of the
wandb.init()
method for more information
on the parameters.
def modify(**kwargs)
#
Modify the parameters of this instance.
This method returns a new instance of this class with the parameters modified. This is useful for example when you want to modify the parameters of a run to add tags or notes.
Source code in src/amltk/scheduling/plugins/wandb.py
def run(name, config=None)
#
Initialize a wandb run.
This method initializes a wandb run using the parameters of this instance. It returns the wandb run object.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the run.
TYPE:
|
config |
The configuration of the run. |
RETURNS | DESCRIPTION |
---|---|
WRun
|
The wandb run object. |
Source code in src/amltk/scheduling/plugins/wandb.py
class WandbLiveRunWrap(params, fn, *, modify=None)
#
Bases: Generic[P]
Wrap a function to log the results to a wandb run.
This class is used to wrap a function that returns a report to log the
results to a wandb run. It is used by the
WandbTrialTracker
to wrap
the target function.
PARAMETER | DESCRIPTION |
---|---|
params |
The parameters to initialize the wandb run.
TYPE:
|
fn |
The function to wrap.
TYPE:
|
modify |
A function that modifies the parameters of the wandb run before each trial.
TYPE:
|
Source code in src/amltk/scheduling/plugins/wandb.py
def __call__(trial, *args, **kwargs)
#
Call the wrapped function and log the results to a wandb run.
Source code in src/amltk/scheduling/plugins/wandb.py
class WandbTrialTracker(params, *, modify=None)
#
Bases: Plugin
Track trials using wandb.
This class is a task plugin that tracks trials using wandb.
PARAMETER | DESCRIPTION |
---|---|
params |
The parameters to initialize the wandb run.
TYPE:
|
modify |
A function that modifies the parameters of the wandb run before each trial.
TYPE:
|
Source code in src/amltk/scheduling/plugins/wandb.py
name: str
classvar
#
The name of the plugin.
def attach_task(task)
#
def pre_submit(fn, *args, **kwargs)
#
Wrap the target function to log the results to a wandb run.
This method wraps the target function to log the results to a wandb run and returns the wrapped function.
PARAMETER | DESCRIPTION |
---|---|
fn |
The target function.
TYPE:
|
args |
The positional arguments of the target function.
TYPE:
|
kwargs |
The keyword arguments of the target function.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[Callable[P, R], tuple, dict] | None
|
The wrapped function, the positional arguments and the keyword |
tuple[Callable[P, R], tuple, dict] | None
|
arguments. |
Source code in src/amltk/scheduling/plugins/wandb.py
class WandbPlugin(*, project, group=None, entity=None, dir=None, mode='online')
#
Log trials using wandb.
This class is the entry point to log trials using wandb. It
can be used to create a
trial_tracker()
to pass into a Task(plugins=...)
or to
create wandb.Run
's for custom purposes with
run()
.
PARAMETER | DESCRIPTION |
---|---|
project |
The name of the project.
TYPE:
|
group |
The name of the group.
TYPE:
|
entity |
The name of the entity.
TYPE:
|
dir |
The directory to store the runs in. |
mode |
The mode to use for the runs.
TYPE:
|
Source code in src/amltk/scheduling/plugins/wandb.py
def trial_tracker(job_type='trial', *, modify=None)
#
Create a live tracker.
PARAMETER | DESCRIPTION |
---|---|
job_type |
The job type to use for the runs.
TYPE:
|
modify |
A function that modifies the parameters of the wandb run before each trial.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
WandbTrialTracker
|
A live tracker. |
Source code in src/amltk/scheduling/plugins/wandb.py
def run(*, name, job_type=None, group=None, config=None, tags=None, resume=None, notes=None)
#
Create a wandb run.
See wandb.init()
for more.