Skip to content

Commit

Permalink
init trackers on class init
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Epstein authored Oct 3, 2023
1 parent a90af1f commit d66cf59
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/accelerate/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def __init__(
kwargs_handlers: list[KwargsHandler] | None = None,
dynamo_backend: DynamoBackend | str | None = None,
):
self.trackers = []
if project_config is not None:
self.project_configuration = project_config
else:
Expand Down Expand Up @@ -2399,7 +2400,6 @@ def init_trackers(self, project_name: str, config: dict | None = None, init_kwar
... )
```
"""
self.trackers = []
for tracker in self.log_with:
if issubclass(type(tracker), GeneralTracker):
# Custom trackers are already initialized
Expand Down Expand Up @@ -2496,8 +2496,6 @@ def end_training(self):
>>> accelerator.end_training()
```
"""
if not hasattr(self, "trackers"):
return
for tracker in self.trackers:
tracker.finish()

Expand Down

0 comments on commit d66cf59

Please sign in to comment.