Skip to content

Commit bf6a4eb

Browse files
lhoestqalbertvillanova
authored andcommitted
Fix check_library_imports (#7026)
fix check_library_imports
1 parent e3b33eb commit bf6a4eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/datasets/load.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ def _download_additional_modules(
336336
local_import_path = os.path.join(local_import_path, sub_directory)
337337
local_imports.append((import_name, local_import_path))
338338

339+
return local_imports
340+
341+
342+
def _check_library_imports(name: str, library_imports: List[Tuple[str, str]]) -> None:
339343
# Check library imports
340344
needs_to_be_installed = {}
341345
for library_import_name, library_import_path in library_imports:
@@ -356,7 +360,6 @@ def _download_additional_modules(
356360
f"{', '.join(needs_to_be_installed)}.\nPlease install {_them_str} using 'pip install "
357361
f"{' '.join(needs_to_be_installed.values())}' for instance."
358362
)
359-
return local_imports
360363

361364

362365
def _copy_script_and_other_resources_in_importable_dir(
@@ -977,6 +980,7 @@ def get_module(self) -> DatasetModule:
977980
" repo on your local machine. Make sure you have read the code there to avoid malicious use, then"
978981
" set the option `trust_remote_code=True` to remove this error."
979982
)
983+
_check_library_imports(name=self.name, local_imports=local_imports)
980984
module_path, hash = _load_importable_file(
981985
dynamic_modules_path=dynamic_modules_path,
982986
module_namespace="datasets",

0 commit comments

Comments
 (0)