-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
print
to logger
#448
Closed
Closed
print
to logger
#448
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
dd2414b
Adding in `logger` commands instead of `print`
kallewesterling 31eb638
Adding in clarifying comments
kallewesterling 042c969
Adding in more clarifying comments
kallewesterling cc5a1ca
One last comment
kallewesterling 75b810c
Dropping `cprint`
kallewesterling acc1a49
Replacing remaining relevant print statements with logger.info/logger…
kallewesterling 8b4bfca
Fixing more print statements and testing side of things
kallewesterling 2fbe079
merge rw changes
rwood-97 9642558
one extra fix
rwood-97 6a938cb
Merge branch 'main' into kallewesterling/issue27
kallewesterling 4409edb
Adding a logger to base class Runner
kallewesterling 638892a
Adding the correct URLs (see also #465)
kallewesterling a557f3f
Merge branch 'kallewesterling/issue27' of https://github.com/Living-w…
rwood-97 6722623
Merge branch 'main' into kallewesterling/issue27
rwood-97 181eebb
Merge branch 'main' into kallewesterling/issue27
rwood-97 bf79cff
delete test files
rwood-97 3a7d959
Resolving conflicts and fixing test errors
kallewesterling 9a7e36a
adding temp checkpoints for tests to gitignore
kallewesterling 7c6d1e6
Merge branch 'kallewesterling/issue27' into rw/issue27
kallewesterling b392189
fix missing "type" arguments
rwood-97 64c59ef
Update test_sheet_downloader.py
rwood-97 4f01220
Update test_sheet_downloader.py
rwood-97 bdb55d5
Update test_sheet_downloader.py
rwood-97 15e664c
Merge pull request #473 from Living-with-machines/rw/issue27
rwood-97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
from __future__ import annotations | ||
|
||
import copy | ||
import logging | ||
import os | ||
import random | ||
import socket | ||
|
@@ -29,6 +30,9 @@ | |
# from tqdm.autonotebook import tqdm | ||
# from torch.nn.modules.module import _addindent | ||
|
||
# Set up logging | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class ClassifierContainer: | ||
def __init__( | ||
|
@@ -147,7 +151,7 @@ | |
self.labels_map = labels_map | ||
|
||
# set up model and move to device | ||
print("[INFO] Initializing model.") | ||
logger.info("Initializing model.") | ||
if isinstance(model, nn.Module): | ||
self.model = model.to(self.device) | ||
self.input_size = input_size | ||
|
@@ -733,12 +737,12 @@ | |
print_info_batch_freq=print_info_batch_freq, | ||
) | ||
except KeyboardInterrupt: | ||
print("[INFO] Exiting...") | ||
logger.info("Exiting...") | ||
if os.path.isfile(self.tmp_save_filename): | ||
print(f'[INFO] Loading "{self.tmp_save_filename}" as model.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. e.g. here |
||
self.load(self.tmp_save_filename, remove_after_load=remove_after_load) | ||
else: | ||
print("[INFO] No checkpoint file found - model has not been updated.") | ||
logger.info("No checkpoint file found - model has not been updated.") | ||
|
||
def train_core( | ||
self, | ||
|
@@ -834,7 +838,7 @@ | |
print( | ||
"[WARNING] Could not import ``SummaryWriter`` from torch.utils.tensorboard" # noqa | ||
) | ||
print("[WARNING] Continuing without tensorboard.") | ||
logger.warning("Continuing without tensorboard.") | ||
tensorboard_path = None | ||
|
||
start_epoch = self.last_epoch + 1 | ||
|
@@ -1812,7 +1816,7 @@ | |
The number of worker threads to use for loading data, by default 0. | ||
""" | ||
if sampler and shuffle: | ||
print("[INFO] ``sampler`` is defined so train dataset will be unshuffled.") | ||
logger.info("``sampler`` is defined so train dataset will be unshuffled.") | ||
|
||
dataloader = DataLoader( | ||
dataset, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should these methods be deleted or is this a merge thing? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. here, should we replace all prints?