-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat/remove ood dataset #97
base: master
Are you sure you want to change the base?
Conversation
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
fa39bea
to
45c0dc4
Compare
…ir, modified the imports to still allow their utilisation
…ending on the backend
…r constructors, with backend-specific info
…value and out_value
…m TFDataHandler and TorchDataHandler, transfered OODDataset-specific methods to DataHandler
45c0dc4
to
eb19601
Compare
…ill fix coverage test, maybe not, but has to be done anyway)
…, more explicit arguments, dataset is now dict based per default)
…True) to allow for returning a dict (mostly useful for pytorch)
…_handler to avoid confusion with feature extractor
…" terminology in tests
65cb388
to
a075c63
Compare
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.
2 remarks, regarding:
- Data handler loading => Check the comments below
- Deprecated code: Should we retain the deprecated code? We could release a new major version (with an appropriate tag) when merging this PR, allowing users who depend on the old API to continue using an earlier version of oodeel. Moreover, since the path to the deprecated code has been changed, any updates using the old code would fail anyway.
Otherwise, LGTM !
@@ -20,6 +20,7 @@ | |||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
# SOFTWARE. | |||
import importlib |
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.
With Python 3.12, when I do:
import importlib
print(importlib.util.find_spec("torch"))
I get the error:
AttributeError: module 'importlib' has no attribute 'util'
Here is a Python issue disscussing this error for versions of python > 3.11: https://discuss.python.org/t/python3-11-importlib-no-longer-exposes-util/25641. The solution seem to do the explicit import import importlib.util
. By the way, get_backend
function is never tested in oodeel!
import importlib | |
import importlib.util |
|
||
def test_get_feature_shape(): | ||
def test_instanciate_tf_datahandler(): | ||
handler = load_data_handler(backend="torch") | ||
assert isinstance(handler, TorchDataHandler) | ||
|
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.
It should be renamed test_instanciate_torch_datahandler
.
And the case where the backend is not specified (equal to None) is not tested. It should be tested in the case where only torch is installed.
This pull request includes significant changes to the
oodeel
library, focusing on refactoring and improving the data handling and dataset management functionalities. The major changes include the introduction of a new data handler loader, backend detection, and the deprecation of older dataset handling classes (OODDataset).Before:
Problems
After:
Refactoring and new functionalities:
oodeel/datasets/__init__.py
: Replaced the import ofOODDataset
withload_data_handler
and movedOODDataset
to a deprecated module.oodeel/datasets/data_handler.py
: Added functions for backend detection (get_backend
) and dynamic data handler loading (load_data_handler
). Introduced several new methods for dataset preparation and handling, such assplit_by_class
,prepare
,load_dataset_from_arrays
, andload_custom_dataset
. [1] [2] [3] [4]Deprecation and reorganization:
oodeel/datasets/deprecated/DEPRECATED_data_handler.py
: Added a deprecated version of theDataHandler
class with the original methods.oodeel/datasets/deprecated/DEPRECATED_ooddataset.py
: Renamed and movedooddataset.py
to a deprecated module, updating internal imports to reflect the new location. [1] [2] [3]oodeel/datasets/deprecated/__init__.py
: Added a deprecation warning for theOODDataset
object.Initialization and imports:
oodeel/datasets/data_handler.py
: Added import statements forimportlib
andTensorType
. [1] [2]oodeel/datasets/tf_data_handler.py
: Added__init__
method toTFDataHandler
class for initialization. [1] [2]