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

Commit

Permalink
Update GradientDescentTrainer to automatically create directory for…
Browse files Browse the repository at this point in the history
… `serialization_dir` (#4940)

* Automatically create serialization_dir when GradientDescent is instantiated

* Update CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Evan Pete Walsh <[email protected]>

* Move to unreleased

* Update CHANGELOG.md

* Update trainer.py

* Fix

* Update CHANGELOG.md

* Fix whitespace

Co-authored-by: Evan Pete Walsh <[email protected]>
  • Loading branch information
Makoto Hiramatsu and epwalsh authored Jan 29, 2021
1 parent cd96d95 commit caa497f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added `tokenizer_kwargs` and `transformer_kwargs` arguments to `PretrainedTransformerBackbone`

### Changed

- GradientDescentTrainer makes `serialization_dir` when it's instantiated, if it doesn't exist.

### Fixed

- `common.util.sanitize` now handles sets.
Expand Down
3 changes: 3 additions & 0 deletions allennlp/training/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def __init__(
self._rank = local_rank
self._primary = self._rank == 0
self._world_size = world_size
# Ensure serialization directory exists.
if serialization_dir is not None:
os.makedirs(serialization_dir, exist_ok=True)

def train(self) -> Dict[str, Any]:
"""
Expand Down

0 comments on commit caa497f

Please sign in to comment.