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

Commit

Permalink
Better Callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
mahnerak committed Jan 19, 2021
1 parent 4183a49 commit ff8c7a6
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 198 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Expand Up @@ -16,18 +16,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
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.
- 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 @@ -55,7 +72,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
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
)

0 comments on commit ff8c7a6

Please sign in to comment.