Skip to content
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

[FIX] 'OfflineModeIsEnabled' is no longer provided in 'datasets.utils.file_utils' #630

Open
jiawei2912 opened this issue Dec 12, 2024 · 2 comments

Comments

@jiawei2912
Copy link

I'm not sure in which version of datasets the 'OfflineModeIsEnabled' Class was removed, but datasets was refactored to import 'OfflineModeIsEnabled' from huggingface instead.

Link to older version of datasets: link).
Link to current (as of this post) version of datasets: link

This was causing the issue below, with modelscope==1.21.0 and datasets==3.2.0:
from modelscope.msdatasets.utils.hf_datasets_util import load_dataset_with_ctx File "A:\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\modelscope\msdatasets\utils\hf_datasets_util.py", line 44, in <module>
from datasets.utils.file_utils import (OfflineModeIsEnabled, ImportError: cannot import name 'OfflineModeIsEnabled' from 'datasets.utils.file_utils' (A:\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\datasets\utils\file_utils.py)

This can be fixed by either specifying an older compatible version of datasets or by updating modelscope\msdatasets\utils\hf_datasets_util.py by removing the old import for 'OfflineModeIsEnabled' at 44 and by adding in a new line to import it from huggingface_hub.errors.

Example modelscope\msdatasets\utils\hf_datasets_util.py:

from datasets.utils.file_utils import (_raise_if_offline_mode_is_enabled, cached_path, is_local_path, is_relative_path, relative_to_absolute_path)
(existing imports)
from huggingface_hub.errors import OfflineModeIsEnabled

@sunbaigui
Copy link
Collaborator

Thank a lot

@park-jay
Copy link

I am currently having a same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants