trace
EvalEssential
¶
Bases: Trace
A trace to collect important information during evaluation.
Please don't add this trace into an estimator manually. FastEstimator will add it automatically.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
monitor_names |
Set[str]
|
Any keys which should be collected over the course of an eval epoch. |
required |
Source code in fastestimator\fastestimator\trace\trace.py
Logger
¶
Bases: Trace
A Trace that prints log messages.
Please don't add this trace into an estimator manually. FastEstimator will add it automatically.
Source code in fastestimator\fastestimator\trace\trace.py
Trace
¶
Trace controls the training loop. Users can use the Trace
base class to customize their own functionality.
Traces are invoked by the fe.Estimator periodically as it runs. In addition to the current data dictionary, they are
also given a pointer to the current System
instance which allows access to more information as well as giving the
ability to modify or even cancel training. The order of function invocations is as follows:
Training: Testing:
on_begin on_begin
| |
on_epoch_begin (train) <------< on_epoch_begin (test) <------<
| | | |
on_batch_begin (train) <----< | on_batch_begin (test) <----< |
| | | | | |
on_batch_end (train) >-----^ | on_batch_end (test) >------^ |
| ^ | |
on_epoch_end (train) | on_epoch_end (test) >---------^
| | |
on_epoch_begin (eval) | on_end
| ^
on_batch_begin (eval) <----< |
| | |
on_batch_end (eval) >-----^ |
| |
on_epoch_end (eval) >----------^
|
on_end
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[None, str, Iterable[str]]
|
A set of keys that this trace intends to read from the state dictionary as inputs. |
None
|
outputs |
Union[None, str, Iterable[str]]
|
A set of keys that this trace intends to write into the system buffer. |
None
|
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Trace in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
None
|
Source code in fastestimator\fastestimator\trace\trace.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
on_batch_begin
¶
Runs at the beginning of each batch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
A dictionary through which traces can communicate with each other or write values for logging. |
required |
on_batch_end
¶
Runs at the end of each batch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
The current batch and prediction data, as well as any information written by prior |
required |
on_begin
¶
Runs once at the beginning of training or testing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
A dictionary through which traces can communicate with each other or write values for logging. |
required |
on_end
¶
Runs once at the end training.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
A dictionary through which traces can communicate with each other or write values for logging. |
required |
on_epoch_begin
¶
Runs at the beginning of each epoch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
A dictionary through which traces can communicate with each other or write values for logging. |
required |
on_epoch_end
¶
Runs at the end of each epoch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
A dictionary through which traces can communicate with each other or write values for logging. |
required |
TrainEssential
¶
Bases: Trace
A trace to collect important information during training.
Please don't add this trace into an estimator manually. FastEstimator will add it automatically.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
monitor_names |
Set[str]
|
Which keys from the data dictionary to monitor during training. |
required |