Skip to content

Commit

Permalink
Fix check_library_imports (#7026)
Browse files Browse the repository at this point in the history
fix check_library_imports
  • Loading branch information
lhoestq authored and albertvillanova committed Aug 14, 2024
1 parent f857a20 commit d2afa80
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/datasets/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ def _download_additional_modules(
local_import_path = os.path.join(local_import_path, sub_directory)
local_imports.append((import_name, local_import_path))

return local_imports


def _check_library_imports(name: str, library_imports: List[Tuple[str, str]]) -> None:
# Check library imports
needs_to_be_installed = {}
for library_import_name, library_import_path in library_imports:
Expand All @@ -356,7 +360,6 @@ def _download_additional_modules(
f"{', '.join(needs_to_be_installed)}.\nPlease install {_them_str} using 'pip install "
f"{' '.join(needs_to_be_installed.values())}' for instance."
)
return local_imports


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

0 comments on commit d2afa80

Please sign in to comment.