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
Added save_dir argument to save_detector #351
Conversation
Looking back on your comment I realize I misread it and thought your suggestion was to change the behaviour of |
f42c7fe
to
107c054
Compare
@@ -470,7 +470,7 @@ def fetch_detector(filepath: Union[str, os.PathLike], | |||
Initialised pre-trained detector. | |||
""" | |||
# create path (if needed) | |||
filepath = Path(filepath).joinpath(detector_name) | |||
filepath = Path(filepath) |
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.
@jklaise perhaps this is the most straightforward fix? There is no confusing logic for the user to contend with.
We would have to modify all the notebooks though e.g. delete the filepath = os.path.join(filepath, detector_name)
line in cd_distillation_cifar10.ipynb
.
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.
This is probably what the user would expect to happen so I agree.
Wrt notebooks, should we modify the saved paths to be ./models/detector_name
so the current behaviour is unchanged (i.e. running multiple notebooks saves all detectors in their own subdirectory so they can be retrieved 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.
That's a much nicer solution with the notebooks, I'll do that 👍🏻
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.
I've had a go at moving the os.path.join(filepath,detector_name)
outside the if load_pretrained:
block, so filepath
should be consistent for fetch and save routes.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@jklaise I'm just going to check the docs examples one more time to check for any more issues like the two you found. |
Might still have missed something, but have gone through all the notebooks with changes and didn't spot any other issues like the above. |
Fix for #348.
An optional
save_dir
argument is used, instead ofdetector_name
used infetch_detector, so as to not confuse the
detector_namevariable already used in
save_detector. This also matches the syntax used in
save_tf_model` etc.If
save_dir=None
then thedetector_name
(from metadata) is used forsave_dir
instead.