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

Commit caa497f

Browse files
Makoto Hiramatsuepwalsh
Makoto Hiramatsu
andauthored
Update GradientDescentTrainer to automatically create directory for 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]>
1 parent cd96d95 commit caa497f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

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

14+
### Changed
15+
16+
- GradientDescentTrainer makes `serialization_dir` when it's instantiated, if it doesn't exist.
17+
1418
### Fixed
1519

1620
- `common.util.sanitize` now handles sets.

allennlp/training/trainer.py

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def __init__(
8181
self._rank = local_rank
8282
self._primary = self._rank == 0
8383
self._world_size = world_size
84+
# Ensure serialization directory exists.
85+
if serialization_dir is not None:
86+
os.makedirs(serialization_dir, exist_ok=True)
8487

8588
def train(self) -> Dict[str, Any]:
8689
"""

0 commit comments

Comments
 (0)