stopping
stopping
¶
Patience-based stopping condition for the generation loop.
Classes:
| Name | Description |
|---|---|
GenerationStopCondition |
Stopping conditions for the generation process. |
GenerationStopCondition(invalid_fraction_threshold, patience)
¶
Stopping conditions for the generation process.
Empirically, the fraction of invalid records generated is a good indicator of the model's performance. This class implements a condition for stopping generation (and potentially training) based on the invalid fraction of records generated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invalid_fraction_threshold
|
float
|
Stop generation if the invalid
fraction exceeds this threshold for more than the number of
consecutive batches specified by the |
required |
patience
|
int
|
Number of consecutive batches to wait before stopping. |
required |
Methods:
| Name | Description |
|---|---|
has_been_reached |
Check whether the invalid-fraction threshold has been exceeded for |
Source code in src/nemo_safe_synthesizer/generation/stopping.py
has_been_reached(invalid_fraction)
¶
Check whether the invalid-fraction threshold has been exceeded for patience consecutive batches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invalid_fraction
|
float
|
Running average of the invalid-record fraction for the most recent batch. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
consecutive batches, |