mltk.core.WeightsAndBiasesMixin¶
- class WeightsAndBiasesMixin[source]¶
Provides various properties to the base
MltkModel
used by Weights & Biases 3rd-party cloud backend.Properties
Keras callback to automatically log info to wandb
Additional configuration values
Additional arguments to provide to
wandb.init()
Manually disable the wandb backend
Return if the wandb backend is initialized
Callback to periodically save the Keras model or model weights
The wandb project session or run ID
Methods
__init__
Logs a dictionary of data to the current wandb run's history
Save files to wandb cloud
- property wandb_is_initialized¶
Return if the wandb backend is initialized
- property wandb_is_disabled¶
Manually disable the wandb backend
- property wandb_init_kwargs¶
Additional arguments to provide to
wandb.init()
The following argument are automatically populated by this mixin:
project - The name of the
name
job_type -
train
,evaluation
,quantize
, orprofile
dir - The
log_dir
id - The timestamp when the training was invoked. See
wandb_session_id
This id is re-used by theevaluate
,profile
, andquantize
commandsresume - Set to
never
for thetrain
command, andmust
otherwise
See wandb.init() for the other available arguments
- property wandb_config¶
Additional configuration values
This sets the wandb.config object in your script to save your training configuration: hyperparameters, input settings like dataset name or model type, and any other independent variables for your experiments. This is useful for analyzing your experiments and reproducing your work in the future. You’ll be able to group by config values in the web interface, comparing the settings of different runs and seeing how these affect the output.
- property wandb_callback¶
Keras callback to automatically log info to wandb
This allows for specifying a custom wandb.keras.WandbCallback. If not set, then the mixin will automatically populate this callback.
- property wandb_model_checkpoint_callback¶
Callback to periodically save the Keras model or model weights
This allows for specifying a custom wandb.keras.WandbModelCheckpoint.
- property wandb_session_id¶
The wandb project session or run ID
This is the timestamp of when the last train command was invoked for the model. This ID is re-used for evaluate, profile, and quantize commands.
This value is used at the
id
argument to wandb.init()
- wandb_save(glob_str=None, base_path=None, policy='live', logger=None)[source]¶
Save files to wandb cloud
Internally, this invokes wandb.save()
- Parameters:
glob_str (
Optional
[str
]) – a relative or absolute path to a unix glob or regular path. If this isn’t specified the method is a noop.base_path (
Optional
[str
]) – the base path to run the glob relative topolicy –
one of
live
,now
, orend
live
: upload the file as it changes, overwriting the previous versionnow
: upload the file once nowend
: only upload file when the run ends
logger (Logger) –
- wandb_log(data, step=None, commit=True, logger=None)[source]¶
Logs a dictionary of data to the current wandb run’s history
Internally, this invokes wandb.log()
- Parameters:
data (
Dict
[str
,Any
]) – A dict of serializable python objects i.e str, ints, floats, Tensors, dicts, or any of the wandb.data_typescommit (
Optional
[bool
]) – Save the metrics dict to the wandb server and increment the step. If false wandb.log just updates the current metrics dict with the data argument and metrics won’t be saved until wandb.log is called with commit=True.step (
Optional
[int
]) – The global step in processing. This persists any non-committed earlier steps but defaults to not committing the specified step.logger (Logger) –