Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Generic Callbacks #4917

Merged
merged 7 commits into from Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion CHANGELOG.md
Expand Up @@ -74,18 +74,35 @@ dataset at every epoch) and a `MultiTaskScheduler` (for ordering the instances w
This makes it possible to use the `FileLock` class on a read-only file system.
- Added a new learning rate scheduler: `CombinedLearningRateScheduler`. This can be used to combine different LR schedulers, using one after the other.
- Moving `ModelCard` and `TaskCard` abstractions into the main repository.
- The `TrainerCallback` constructor accepts `serialization_dir` provided by `Trainer`. This can be useeful for `Logger` callbacks those need to store files in the run directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, "useful"

- The `TrainerCallback.on_start()` is fired at the start of the training.
- The `TrainerCallback` event methods now accept `**kwargs`. This may be useful to maintain backwards-compability of callbacks easier in the future. E.g. we may decide to pass the exception/traceback object in case of failure to `on_end()` and this older callbacks may simply ignore the argument instead of raising a `TypeError`.

### Changed

- 'master' branch renamed to 'main'
- Torch version bumped to 1.7.1 in Docker images.
- The `TrainerCallack.on_epoch()` does not fire with `epoch=-1` at the start of the training.
Instead, `TrainerCallback.on_start()` should be used for these cases.
- `TensorBoardBatchMemoryUsage` is converted from `BatchCallback` into `TrainerCallback`.
- `TrackEpochCallback` is converted from `EpochCallback` into `TrainerCallback`.
- `Trainer` can accept callbacks simply with name `callbacks` instead of `trainer_callbacks`.

### Fixed

- Fixed typo with `LabelField` string representation: removed trailing apostrophe.
- `Vocabulary.from_files` and `cached_path` will issue a warning, instead of failing, when a lock on an existing resource
can't be acquired because the file system is read-only.
- `TrackEpochCallback` is now a `EpochCallback`.
- Now Trainer always fires `TrainerCallback.on_end()` so all the resources can be cleaned up properly.
- Fixed the misspelling, changed `TensoboardBatchMemoryUsage` to `TensorBoardBatchMemoryUsage`.
- We set a value to `epoch` so in case of firing `TrainerCallback.on_end()` the variable is bound.
This could have lead to an error in case of trying to recover a run after it was finished training.

### Removed

- Removed `EpochCallback`, `BatchCallback` in favour of `TrainerCallback`.
The metaclass-wrapping implementation is removed as well.


## [v1.3.0](https://github.com/allenai/allennlp/releases/tag/v1.3.0) - 2020-12-15
Expand Down Expand Up @@ -113,7 +130,7 @@ dataset at every epoch) and a `MultiTaskScheduler` (for ordering the instances w
were not passed to the constructor if the value of the parameter was equal to the default value.
This caused bugs in some edge cases where a subclass that takes `**kwargs` needs to inspect
`kwargs` before passing them to its superclass.
- Improved the band-aid solution for segmentation faults and the "ImportError: dlopen: cannot load any more object with static TLS"
- Improved the band-aid solution for segmentation faults and the "ImportError: dlopen: cannot load any more object with static TLS"
by adding a `transformers` import.
- Added safety checks for extracting tar files
- Turned superfluous warning to info when extending the vocab in the embedding matrix, if no pretrained file was provided
Expand Down
3 changes: 1 addition & 2 deletions allennlp/training/__init__.py
Expand Up @@ -4,8 +4,7 @@
from allennlp.training.trainer import (
Trainer,
GradientDescentTrainer,
BatchCallback,
EpochCallback,
TrainerCallback,
TrackEpochCallback,
TensorBoardBatchMemoryUsage,
)