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
f6b87c5f
"docs/vscode:/vscode.git/clone" did not exist on "bf1f43fbd7dc3718aa37eb4e3adcf9bfcb1b5bc7"
Unverified
Commit
f6b87c5f
authored
Dec 08, 2021
by
Sylvain Gugger
Committed by
GitHub
Dec 08, 2021
Browse files
Fixes in init (#14681)
* Fixes in init * Style
parent
fe06f8dc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
7 deletions
+5
-7
src/transformers/__init__.py
src/transformers/__init__.py
+2
-0
src/transformers/models/wav2vec2_with_lm/__init__.py
src/transformers/models/wav2vec2_with_lm/__init__.py
+2
-2
utils/check_inits.py
utils/check_inits.py
+1
-5
No files found.
src/transformers/__init__.py
View file @
f6b87c5f
...
@@ -118,6 +118,7 @@ _import_structure = {
...
@@ -118,6 +118,7 @@ _import_structure = {
"is_flax_available"
,
"is_flax_available"
,
"is_psutil_available"
,
"is_psutil_available"
,
"is_py3nvml_available"
,
"is_py3nvml_available"
,
"is_pyctcdecode_available"
,
"is_scipy_available"
,
"is_scipy_available"
,
"is_sentencepiece_available"
,
"is_sentencepiece_available"
,
"is_sklearn_available"
,
"is_sklearn_available"
,
...
@@ -2149,6 +2150,7 @@ if TYPE_CHECKING:
...
@@ -2149,6 +2150,7 @@ if TYPE_CHECKING:
is_flax_available
,
is_flax_available
,
is_psutil_available
,
is_psutil_available
,
is_py3nvml_available
,
is_py3nvml_available
,
is_pyctcdecode_available
,
is_scipy_available
,
is_scipy_available
,
is_sentencepiece_available
,
is_sentencepiece_available
,
is_sklearn_available
,
is_sklearn_available
,
...
...
src/transformers/models/wav2vec2_with_lm/__init__.py
View file @
f6b87c5f
...
@@ -20,11 +20,11 @@ from typing import TYPE_CHECKING
...
@@ -20,11 +20,11 @@ from typing import TYPE_CHECKING
from
...file_utils
import
_LazyModule
,
is_pyctcdecode_available
from
...file_utils
import
_LazyModule
,
is_pyctcdecode_available
_import_structure
=
{}
_import_structure
=
{
"processing_wav2vec2_with_lm"
:
[]
}
if
is_pyctcdecode_available
():
if
is_pyctcdecode_available
():
_import_structure
[
"processing_wav2vec2_with_lm"
]
=
[
"Wav2Vec2ProcessorWithLM"
]
_import_structure
[
"processing_wav2vec2_with_lm"
]
.
append
(
"Wav2Vec2ProcessorWithLM"
)
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
...
...
utils/check_inits.py
View file @
f6b87c5f
...
@@ -27,8 +27,6 @@ _re_backend = re.compile(r"is\_([a-z_]*)_available()")
...
@@ -27,8 +27,6 @@ _re_backend = re.compile(r"is\_([a-z_]*)_available()")
_re_import_struct_key_value
=
re
.
compile
(
r
'\s+"\S*":\s+\[([^\]]*)\]'
)
_re_import_struct_key_value
=
re
.
compile
(
r
'\s+"\S*":\s+\[([^\]]*)\]'
)
# Catches a line if is_foo_available
# Catches a line if is_foo_available
_re_test_backend
=
re
.
compile
(
r
"^\s*if\s+is\_[a-z_]*\_available\(\)"
)
_re_test_backend
=
re
.
compile
(
r
"^\s*if\s+is\_[a-z_]*\_available\(\)"
)
# Catches a line _import_struct["bla"] = ["foo"]
_re_import_struct_equal_one
=
re
.
compile
(
r
'^\s*_import_structure\["\S*"\]\ = "\[(\S*)\]"'
)
# Catches a line _import_struct["bla"].append("foo")
# Catches a line _import_struct["bla"].append("foo")
_re_import_struct_add_one
=
re
.
compile
(
r
'^\s*_import_structure\["\S*"\]\.append\("(\S*)"\)'
)
_re_import_struct_add_one
=
re
.
compile
(
r
'^\s*_import_structure\["\S*"\]\.append\("(\S*)"\)'
)
# Catches a line _import_struct["bla"].extend(["foo", "bar"]) or _import_struct["bla"] = ["foo", "bar"]
# Catches a line _import_struct["bla"].extend(["foo", "bar"]) or _import_struct["bla"] = ["foo", "bar"]
...
@@ -90,9 +88,7 @@ def parse_init(init_file):
...
@@ -90,9 +88,7 @@ def parse_init(init_file):
# Until we unindent, add backend objects to the list
# Until we unindent, add backend objects to the list
while
len
(
lines
[
line_index
])
<=
1
or
lines
[
line_index
].
startswith
(
" "
*
4
):
while
len
(
lines
[
line_index
])
<=
1
or
lines
[
line_index
].
startswith
(
" "
*
4
):
line
=
lines
[
line_index
]
line
=
lines
[
line_index
]
if
_re_import_struct_equal_one
.
search
(
line
)
is
not
None
:
if
_re_import_struct_add_one
.
search
(
line
)
is
not
None
:
objects
.
append
(
_re_import_struct_equal_one
.
search
(
line
).
groups
()[
0
])
elif
_re_import_struct_add_one
.
search
(
line
)
is
not
None
:
objects
.
append
(
_re_import_struct_add_one
.
search
(
line
).
groups
()[
0
])
objects
.
append
(
_re_import_struct_add_one
.
search
(
line
).
groups
()[
0
])
elif
_re_import_struct_add_many
.
search
(
line
)
is
not
None
:
elif
_re_import_struct_add_many
.
search
(
line
)
is
not
None
:
imports
=
_re_import_struct_add_many
.
search
(
line
).
groups
()[
0
].
split
(
", "
)
imports
=
_re_import_struct_add_many
.
search
(
line
).
groups
()[
0
].
split
(
", "
)
...
...
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