-
Notifications
You must be signed in to change notification settings - Fork 369
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
[Refactor] Refactor fileio but without breaking bc #533
Conversation
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.
Basically good.
Will xxxBackend
codes in file_client.py
be removed in the future, since they are moved to backends
directory?
They had been moved in the newest commit. |
Codecov ReportBase: 77.68% // Head: 77.95% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #533 +/- ##
==========================================
+ Coverage 77.68% 77.95% +0.27%
==========================================
Files 116 125 +9
Lines 8612 8983 +371
Branches 1778 1840 +62
==========================================
+ Hits 6690 7003 +313
- Misses 1623 1664 +41
- Partials 299 316 +17
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
## Motivation Use the new fileio from mmengine open-mmlab/mmengine#533 ## Modification 1. Use `mmengine.fileio` to repalce FileClient in mmseg/datasets 2. Use `mmengine.fileio` to repalce FileClient in mmseg/datasets/transforms 3. Use `mmengine.fileio` to repalce FileClient in mmseg/visualization ## BC-breaking (Optional) we modify all the dataset configurations, so please use the latest config file.
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
In this PR, we refactor the fileio module to make it more user-friendly and provide more frequently used functions. Note that this PR will not cause backward compatibility breaking which means the previous case works fine until the release of MMEngine v1.0.
Modification
Move the file backends in
mmengine/fileio/file_client.py
tommengine/fileio/backends
but import them in former to avoide BC-breaking. Besides, renameHardDiskBackend
toLocalBackend
because the former class name is not enough accuracy. To avoid bc-breaking, still defineHardDiskBackend
inmmengine/fileio/file_client.py
which inherits fromLocalBackend
and does not have any modifications. Each file contains aBackend
.Provide more interfaces for File Backends
Note: Only LocalBackend and PetrelBackend implement all of the above interfaces.
Functions or methods involving FileClient have also been modified
mmengine/hooks/checkpoint_hook.py
Add a new argument
backend_args
to the construct method ofCheckpointHook
. Thebackend_args
is a dictionary which probably contains abackend
key-value determining the backend that will be used , and the rest of it will be passed to the__init__
method of backends.The difference between the filelds of
file_client_args
andbackend_args
is thatfile_client_args
accepts the prefix field, whilebackend_args
does not.mmengine/hooks/logger_hook.py
same as above
mmengine/runner/checkpoint.py
mmengine/runner/runner.py
Add a new argument
backend_args
to thesave_checkpoint
method ofRunner
.BC-breaking
There is no bc-breaking util release of MMEngine v1.0.0 (current version is v0.1.0)
Use cases
There are two ways to call a method of a file backend:
get_file_backend
and call its methods.get_file_backend
first and then call the corresponding backend method.
Validate the modification in downstream repos
Validate whether the old version and current version works fine as expected in MMDetection.
Read training data from Petrel
This new version requires mmcv and mmdet support accepting
backend_args
argument so this new version will not be tested.Load or resume checkpoints from Petrel (Tested)
Save checkpoints to Petrel
Save logs to Petrel
Checklist