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
921a6bf2
Unverified
Commit
921a6bf2
authored
Dec 11, 2023
by
NielsRogge
Committed by
GitHub
Dec 11, 2023
Browse files
Update import message (#27946)
* Update import message * Update message
parent
44127ec6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/transformers/utils/import_utils.py
src/transformers/utils/import_utils.py
+8
-4
No files found.
src/transformers/utils/import_utils.py
View file @
921a6bf2
...
...
@@ -67,6 +67,9 @@ FORCE_TF_AVAILABLE = os.environ.get("FORCE_TF_AVAILABLE", "AUTO").upper()
# This is the version of torch required to run torch.fx features and torch.onnx with dictionary inputs.
TORCH_FX_REQUIRED_VERSION
=
version
.
parse
(
"1.10"
)
ACCELERATE_MIN_VERSION
=
"0.21.0"
FSDP_MIN_VERSION
=
"1.12.0"
_accelerate_available
,
_accelerate_version
=
_is_package_available
(
"accelerate"
,
return_version
=
True
)
_apex_available
=
_is_package_available
(
"apex"
)
...
...
@@ -681,13 +684,13 @@ def is_protobuf_available():
return
importlib
.
util
.
find_spec
(
"google.protobuf"
)
is
not
None
def
is_accelerate_available
(
min_version
:
str
=
"0.21.0"
):
def
is_accelerate_available
(
min_version
:
str
=
ACCELERATE_MIN_VERSION
):
if
min_version
is
not
None
:
return
_accelerate_available
and
version
.
parse
(
_accelerate_version
)
>=
version
.
parse
(
min_version
)
return
_accelerate_available
def
is_fsdp_available
(
min_version
:
str
=
"1.12.0"
):
def
is_fsdp_available
(
min_version
:
str
=
FSDP_MIN_VERSION
):
return
is_torch_available
()
and
version
.
parse
(
_torch_version
)
>=
version
.
parse
(
min_version
)
...
...
@@ -1154,8 +1157,9 @@ PYCTCDECODE_IMPORT_ERROR = """
# docstyle-ignore
ACCELERATE_IMPORT_ERROR
=
"""
{0} requires the accelerate library but it was not found in your environment. You can install it with pip:
`pip install accelerate`. Please note that you may need to restart your runtime after installation.
{0} requires the accelerate library >= {ACCELERATE_MIN_VERSION} it was not found in your environment.
You can install or update it with pip: `pip install --upgrade accelerate`. Please note that you may need to restart your
runtime after installation.
"""
# docstyle-ignore
...
...
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