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
0a6b9048
Unverified
Commit
0a6b9048
authored
Jul 08, 2021
by
Sylvain Gugger
Committed by
GitHub
Jul 08, 2021
Browse files
Init pickle (#12567)
* Try to pickle transformers * Deal with special objs better * Make picklable
parent
b29c3945
Changes
72
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
46 additions
and
308 deletions
+46
-308
src/transformers/models/longformer/__init__.py
src/transformers/models/longformer/__init__.py
+2
-15
src/transformers/models/luke/__init__.py
src/transformers/models/luke/__init__.py
+2
-15
src/transformers/models/lxmert/__init__.py
src/transformers/models/lxmert/__init__.py
+2
-15
src/transformers/models/m2m_100/__init__.py
src/transformers/models/m2m_100/__init__.py
+2
-15
src/transformers/models/marian/__init__.py
src/transformers/models/marian/__init__.py
+2
-15
src/transformers/models/mbart/__init__.py
src/transformers/models/mbart/__init__.py
+2
-15
src/transformers/models/megatron_bert/__init__.py
src/transformers/models/megatron_bert/__init__.py
+2
-15
src/transformers/models/mmbt/__init__.py
src/transformers/models/mmbt/__init__.py
+2
-15
src/transformers/models/mobilebert/__init__.py
src/transformers/models/mobilebert/__init__.py
+2
-15
src/transformers/models/mpnet/__init__.py
src/transformers/models/mpnet/__init__.py
+2
-21
src/transformers/models/mt5/__init__.py
src/transformers/models/mt5/__init__.py
+8
-11
src/transformers/models/openai/__init__.py
src/transformers/models/openai/__init__.py
+2
-15
src/transformers/models/pegasus/__init__.py
src/transformers/models/pegasus/__init__.py
+2
-15
src/transformers/models/phobert/__init__.py
src/transformers/models/phobert/__init__.py
+2
-15
src/transformers/models/prophetnet/__init__.py
src/transformers/models/prophetnet/__init__.py
+2
-15
src/transformers/models/rag/__init__.py
src/transformers/models/rag/__init__.py
+2
-15
src/transformers/models/reformer/__init__.py
src/transformers/models/reformer/__init__.py
+2
-15
src/transformers/models/retribert/__init__.py
src/transformers/models/retribert/__init__.py
+2
-15
src/transformers/models/roberta/__init__.py
src/transformers/models/roberta/__init__.py
+2
-21
src/transformers/models/roformer/__init__.py
src/transformers/models/roformer/__init__.py
+2
-15
No files found.
src/transformers/models/longformer/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -90,19 +90,6 @@ if TYPE_CHECKING:
...
@@ -90,19 +90,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/luke/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -52,19 +52,6 @@ if TYPE_CHECKING:
...
@@ -52,19 +52,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/lxmert/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -80,19 +80,6 @@ if TYPE_CHECKING:
...
@@ -80,19 +80,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/m2m_100/__init__.py
View file @
0a6b9048
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
# limitations under the License.
# limitations under the License.
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -49,19 +49,6 @@ if TYPE_CHECKING:
...
@@ -49,19 +49,6 @@ if TYPE_CHECKING:
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/marian/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
(
from
...file_utils
import
(
_
Base
LazyModule
,
_LazyModule
,
is_sentencepiece_available
,
is_sentencepiece_available
,
is_tf_available
,
is_tf_available
,
is_tokenizers_available
,
is_tokenizers_available
,
...
@@ -65,19 +65,6 @@ if TYPE_CHECKING:
...
@@ -65,19 +65,6 @@ if TYPE_CHECKING:
from
.modeling_tf_marian
import
TFMarianModel
,
TFMarianMTModel
,
TFMarianPreTrainedModel
from
.modeling_tf_marian
import
TFMarianModel
,
TFMarianMTModel
,
TFMarianPreTrainedModel
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/mbart/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
(
from
...file_utils
import
(
_
Base
LazyModule
,
_LazyModule
,
is_flax_available
,
is_flax_available
,
is_sentencepiece_available
,
is_sentencepiece_available
,
is_tf_available
,
is_tf_available
,
...
@@ -102,19 +102,6 @@ if TYPE_CHECKING:
...
@@ -102,19 +102,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/megatron_bert/__init__.py
View file @
0a6b9048
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
# limitations under the License.
# limitations under the License.
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -58,19 +58,6 @@ if TYPE_CHECKING:
...
@@ -58,19 +58,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/mmbt/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -36,19 +36,6 @@ if TYPE_CHECKING:
...
@@ -36,19 +36,6 @@ if TYPE_CHECKING:
from
.modeling_mmbt
import
MMBTForClassification
,
MMBTModel
,
ModalEmbeddings
from
.modeling_mmbt
import
MMBTForClassification
,
MMBTModel
,
ModalEmbeddings
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/mobilebert/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -100,19 +100,6 @@ if TYPE_CHECKING:
...
@@ -100,19 +100,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/mpnet/__init__.py
View file @
0a6b9048
...
@@ -18,13 +18,7 @@
...
@@ -18,13 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
(
from
...file_utils
import
_LazyModule
,
is_flax_available
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
_BaseLazyModule
,
is_flax_available
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
,
)
_import_structure
=
{
_import_structure
=
{
...
@@ -98,19 +92,6 @@ if TYPE_CHECKING:
...
@@ -98,19 +92,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/mt5/__init__.py
View file @
0a6b9048
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
(
from
...file_utils
import
(
_
Base
LazyModule
,
_LazyModule
,
is_sentencepiece_available
,
is_sentencepiece_available
,
is_tf_available
,
is_tf_available
,
is_tokenizers_available
,
is_tokenizers_available
,
...
@@ -74,21 +74,13 @@ if TYPE_CHECKING:
...
@@ -74,21 +74,13 @@ if TYPE_CHECKING:
from
.modeling_tf_mt5
import
TFMT5EncoderModel
,
TFMT5ForConditionalGeneration
,
TFMT5Model
from
.modeling_tf_mt5
import
TFMT5EncoderModel
,
TFMT5ForConditionalGeneration
,
TFMT5Model
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_
Base
LazyModule
):
class
_
MT5
LazyModule
(
_LazyModule
):
"""
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
if
name
==
"MT5Tokenizer"
:
if
name
==
"MT5Tokenizer"
:
return
MT5Tokenizer
return
MT5Tokenizer
...
@@ -97,4 +89,9 @@ else:
...
@@ -97,4 +89,9 @@ else:
else
:
else
:
return
super
().
__getattr__
(
name
)
return
super
().
__getattr__
(
name
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
sys
.
modules
[
__name__
]
=
_MT5LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
,
extra_objects
=
{
"MT5Tokenizer"
:
MT5Tokenizer
,
"MT5TokenizerFast"
:
MT5TokenizerFast
},
)
src/transformers/models/openai/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -82,19 +82,6 @@ if TYPE_CHECKING:
...
@@ -82,19 +82,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/pegasus/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
(
from
...file_utils
import
(
_
Base
LazyModule
,
_LazyModule
,
is_sentencepiece_available
,
is_sentencepiece_available
,
is_tf_available
,
is_tf_available
,
is_tokenizers_available
,
is_tokenizers_available
,
...
@@ -75,19 +75,6 @@ if TYPE_CHECKING:
...
@@ -75,19 +75,6 @@ if TYPE_CHECKING:
from
.modeling_tf_pegasus
import
TFPegasusForConditionalGeneration
,
TFPegasusModel
,
TFPegasusPreTrainedModel
from
.modeling_tf_pegasus
import
TFPegasusForConditionalGeneration
,
TFPegasusModel
,
TFPegasusPreTrainedModel
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/phobert/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
from
...file_utils
import
_LazyModule
_import_structure
=
{
_import_structure
=
{
...
@@ -30,19 +30,6 @@ if TYPE_CHECKING:
...
@@ -30,19 +30,6 @@ if TYPE_CHECKING:
from
.tokenization_phobert
import
PhobertTokenizer
from
.tokenization_phobert
import
PhobertTokenizer
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/prophetnet/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -54,19 +54,6 @@ if TYPE_CHECKING:
...
@@ -54,19 +54,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/rag/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tf_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tf_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -61,19 +61,6 @@ if TYPE_CHECKING:
...
@@ -61,19 +61,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/reformer/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_sentencepiece_available
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_sentencepiece_available
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -68,19 +68,6 @@ if TYPE_CHECKING:
...
@@ -68,19 +68,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/retribert/__init__.py
View file @
0a6b9048
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -52,19 +52,6 @@ if TYPE_CHECKING:
...
@@ -52,19 +52,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/roberta/__init__.py
View file @
0a6b9048
...
@@ -18,13 +18,7 @@
...
@@ -18,13 +18,7 @@
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
(
from
...file_utils
import
_LazyModule
,
is_flax_available
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
_BaseLazyModule
,
is_flax_available
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
,
)
_import_structure
=
{
_import_structure
=
{
...
@@ -118,19 +112,6 @@ if TYPE_CHECKING:
...
@@ -118,19 +112,6 @@ if TYPE_CHECKING:
)
)
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
src/transformers/models/roformer/__init__.py
View file @
0a6b9048
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
# limitations under the License.
# limitations under the License.
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
...file_utils
import
_
Base
LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
from
...file_utils
import
_LazyModule
,
is_tf_available
,
is_tokenizers_available
,
is_torch_available
_import_structure
=
{
_import_structure
=
{
...
@@ -97,19 +97,6 @@ if TYPE_CHECKING:
...
@@ -97,19 +97,6 @@ if TYPE_CHECKING:
else
:
else
:
import
importlib
import
os
import
sys
import
sys
class
_LazyModule
(
_BaseLazyModule
):
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
globals
()[
"__file__"
],
_import_structure
)
"""
Module class that surfaces all objects but only performs associated imports when the objects are requested.
"""
__file__
=
globals
()[
"__file__"
]
__path__
=
[
os
.
path
.
dirname
(
__file__
)]
def
_get_module
(
self
,
module_name
:
str
):
return
importlib
.
import_module
(
"."
+
module_name
,
self
.
__name__
)
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
_import_structure
)
Prev
1
2
3
4
Next
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