Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
d0fd7154
Unverified
Commit
d0fd7154
authored
Sep 29, 2020
by
Sylvain Gugger
Committed by
GitHub
Sep 29, 2020
Browse files
Catch import datasets common errors (#7456)
parent
f1220c5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
src/transformers/file_utils.py
src/transformers/file_utils.py
+6
-2
No files found.
src/transformers/file_utils.py
View file @
d0fd7154
...
...
@@ -68,8 +68,12 @@ except (ImportError, AssertionError):
try
:
import
datasets
# noqa: F401
_datasets_available
=
True
logger
.
debug
(
f
"Succesfully imported datasets version
{
datasets
.
__version__
}
"
)
# Check we're not importing a "datasets" directory somewhere
_datasets_available
=
hasattr
(
datasets
,
"__version__"
)
and
hasattr
(
datasets
,
"load_dataset"
)
if
_datasets_available
:
logger
.
debug
(
f
"Succesfully imported datasets version
{
datasets
.
__version__
}
"
)
else
:
logger
.
debug
(
"Imported a datasets object but this doesn't seem to be the 🤗 datasets library."
)
except
ImportError
:
_datasets_available
=
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment