Fast imports part 3 (#9474)
* New intermediate inits * Update template * Avoid importing torch/tf/flax in tokenization unless necessary * Styling * Shutup flake8 * Better python version check
This commit is contained in:
@@ -51,7 +51,7 @@ from .utils import logging
|
|||||||
|
|
||||||
|
|
||||||
# The package importlib_metadata is in a different place, depending on the python version.
|
# The package importlib_metadata is in a different place, depending on the python version.
|
||||||
if version.parse(sys.version) < version.parse("3.8"):
|
if sys.version_info < (3, 8):
|
||||||
import importlib_metadata
|
import importlib_metadata
|
||||||
else:
|
else:
|
||||||
import importlib.metadata as importlib_metadata
|
import importlib.metadata as importlib_metadata
|
||||||
|
|||||||
@@ -16,9 +16,58 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_albert": ["ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "AlbertConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_albert"] = ["AlbertTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_albert_fast"] = ["AlbertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_albert"] = [
|
||||||
|
"ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"AlbertForMaskedLM",
|
||||||
|
"AlbertForMultipleChoice",
|
||||||
|
"AlbertForPreTraining",
|
||||||
|
"AlbertForQuestionAnswering",
|
||||||
|
"AlbertForSequenceClassification",
|
||||||
|
"AlbertForTokenClassification",
|
||||||
|
"AlbertModel",
|
||||||
|
"AlbertPreTrainedModel",
|
||||||
|
"load_tf_weights_in_albert",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_albert"] = [
|
||||||
|
"TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFAlbertForMaskedLM",
|
||||||
|
"TFAlbertForMultipleChoice",
|
||||||
|
"TFAlbertForPreTraining",
|
||||||
|
"TFAlbertForQuestionAnswering",
|
||||||
|
"TFAlbertForSequenceClassification",
|
||||||
|
"TFAlbertForTokenClassification",
|
||||||
|
"TFAlbertMainLayer",
|
||||||
|
"TFAlbertModel",
|
||||||
|
"TFAlbertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_albert import AlbertTokenizer
|
from .tokenization_albert import AlbertTokenizer
|
||||||
@@ -53,3 +102,21 @@ if is_tf_available():
|
|||||||
TFAlbertModel,
|
TFAlbertModel,
|
||||||
TFAlbertPreTrainedModel,
|
TFAlbertPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,77 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_flax_available, is_tf_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_flax_available, is_tf_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_auto": ["ALL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CONFIG_MAPPING", "MODEL_NAMES_MAPPING", "AutoConfig"],
|
||||||
|
"tokenization_auto": ["TOKENIZER_MAPPING", "AutoTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_auto"] = [
|
||||||
|
"MODEL_FOR_CAUSAL_LM_MAPPING",
|
||||||
|
"MODEL_FOR_MASKED_LM_MAPPING",
|
||||||
|
"MODEL_FOR_MULTIPLE_CHOICE_MAPPING",
|
||||||
|
"MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING",
|
||||||
|
"MODEL_FOR_PRETRAINING_MAPPING",
|
||||||
|
"MODEL_FOR_QUESTION_ANSWERING_MAPPING",
|
||||||
|
"MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING",
|
||||||
|
"MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING",
|
||||||
|
"MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING",
|
||||||
|
"MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING",
|
||||||
|
"MODEL_MAPPING",
|
||||||
|
"MODEL_WITH_LM_HEAD_MAPPING",
|
||||||
|
"AutoModel",
|
||||||
|
"AutoModelForCausalLM",
|
||||||
|
"AutoModelForMaskedLM",
|
||||||
|
"AutoModelForMultipleChoice",
|
||||||
|
"AutoModelForNextSentencePrediction",
|
||||||
|
"AutoModelForPreTraining",
|
||||||
|
"AutoModelForQuestionAnswering",
|
||||||
|
"AutoModelForSeq2SeqLM",
|
||||||
|
"AutoModelForSequenceClassification",
|
||||||
|
"AutoModelForTableQuestionAnswering",
|
||||||
|
"AutoModelForTokenClassification",
|
||||||
|
"AutoModelWithLMHead",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_auto"] = [
|
||||||
|
"TF_MODEL_FOR_CAUSAL_LM_MAPPING",
|
||||||
|
"TF_MODEL_FOR_MASKED_LM_MAPPING",
|
||||||
|
"TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING",
|
||||||
|
"TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING",
|
||||||
|
"TF_MODEL_FOR_PRETRAINING_MAPPING",
|
||||||
|
"TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING",
|
||||||
|
"TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING",
|
||||||
|
"TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING",
|
||||||
|
"TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING",
|
||||||
|
"TF_MODEL_MAPPING",
|
||||||
|
"TF_MODEL_WITH_LM_HEAD_MAPPING",
|
||||||
|
"TFAutoModel",
|
||||||
|
"TFAutoModelForCausalLM",
|
||||||
|
"TFAutoModelForMaskedLM",
|
||||||
|
"TFAutoModelForMultipleChoice",
|
||||||
|
"TFAutoModelForPreTraining",
|
||||||
|
"TFAutoModelForQuestionAnswering",
|
||||||
|
"TFAutoModelForSeq2SeqLM",
|
||||||
|
"TFAutoModelForSequenceClassification",
|
||||||
|
"TFAutoModelForTokenClassification",
|
||||||
|
"TFAutoModelWithLMHead",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_flax_available():
|
||||||
|
_import_structure["modeling_flax_auto"] = ["FLAX_MODEL_MAPPING", "FlaxAutoModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_auto import ALL_PRETRAINED_CONFIG_ARCHIVE_MAP, CONFIG_MAPPING, MODEL_NAMES_MAPPING, AutoConfig
|
from .configuration_auto import ALL_PRETRAINED_CONFIG_ARCHIVE_MAP, CONFIG_MAPPING, MODEL_NAMES_MAPPING, AutoConfig
|
||||||
from .tokenization_auto import TOKENIZER_MAPPING, AutoTokenizer
|
from .tokenization_auto import TOKENIZER_MAPPING, AutoTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_auto import (
|
from .modeling_auto import (
|
||||||
MODEL_FOR_CAUSAL_LM_MAPPING,
|
MODEL_FOR_CAUSAL_LM_MAPPING,
|
||||||
@@ -76,3 +142,21 @@ if is_tf_available():
|
|||||||
|
|
||||||
if is_flax_available():
|
if is_flax_available():
|
||||||
from .modeling_flax_auto import FLAX_MODEL_MAPPING, FlaxAutoModel
|
from .modeling_flax_auto import FLAX_MODEL_MAPPING, FlaxAutoModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -15,11 +15,38 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_bart": ["BART_PRETRAINED_CONFIG_ARCHIVE_MAP", "BartConfig"],
|
||||||
|
"tokenization_bart": ["BartTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_bart_fast"] = ["BartTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_bart"] = [
|
||||||
|
"BART_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"BartForConditionalGeneration",
|
||||||
|
"BartForQuestionAnswering",
|
||||||
|
"BartForSequenceClassification",
|
||||||
|
"BartModel",
|
||||||
|
"BartPretrainedModel",
|
||||||
|
"PretrainedBartModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_bart"] = ["TFBartForConditionalGeneration", "TFBartModel", "TFBartPretrainedModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_bart import BART_PRETRAINED_CONFIG_ARCHIVE_MAP, BartConfig
|
from .configuration_bart import BART_PRETRAINED_CONFIG_ARCHIVE_MAP, BartConfig
|
||||||
from .tokenization_bart import BartTokenizer
|
from .tokenization_bart import BartTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_bart_fast import BartTokenizerFast
|
from .tokenization_bart_fast import BartTokenizerFast
|
||||||
|
|
||||||
@@ -36,3 +63,21 @@ if is_torch_available():
|
|||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
from .modeling_tf_bart import TFBartForConditionalGeneration, TFBartModel, TFBartPretrainedModel
|
from .modeling_tf_bart import TFBartForConditionalGeneration, TFBartModel, TFBartPretrainedModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,42 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tokenizers_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_sentencepiece_available, is_tokenizers_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_barthez"] = ["BarthezTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_barthez_fast"] = ["BarthezTokenizerFast"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_barthez import BarthezTokenizer
|
from .tokenization_barthez import BarthezTokenizer
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_barthez_fast import BarthezTokenizerFast
|
from .tokenization_barthez_fast import BarthezTokenizerFast
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,67 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_flax_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_bert": ["BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BertConfig"],
|
||||||
|
"tokenization_bert": ["BasicTokenizer", "BertTokenizer", "WordpieceTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_bert_fast"] = ["BertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_bert"] = [
|
||||||
|
"BERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"BertForMaskedLM",
|
||||||
|
"BertForMultipleChoice",
|
||||||
|
"BertForNextSentencePrediction",
|
||||||
|
"BertForPreTraining",
|
||||||
|
"BertForQuestionAnswering",
|
||||||
|
"BertForSequenceClassification",
|
||||||
|
"BertForTokenClassification",
|
||||||
|
"BertLayer",
|
||||||
|
"BertLMHeadModel",
|
||||||
|
"BertModel",
|
||||||
|
"BertPreTrainedModel",
|
||||||
|
"load_tf_weights_in_bert",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_bert"] = [
|
||||||
|
"TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFBertEmbeddings",
|
||||||
|
"TFBertForMaskedLM",
|
||||||
|
"TFBertForMultipleChoice",
|
||||||
|
"TFBertForNextSentencePrediction",
|
||||||
|
"TFBertForPreTraining",
|
||||||
|
"TFBertForQuestionAnswering",
|
||||||
|
"TFBertForSequenceClassification",
|
||||||
|
"TFBertForTokenClassification",
|
||||||
|
"TFBertLMHeadModel",
|
||||||
|
"TFBertMainLayer",
|
||||||
|
"TFBertModel",
|
||||||
|
"TFBertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_flax_available():
|
||||||
|
_import_structure["modeling_flax_bert"] = ["FlaxBertForMaskedLM", "FlaxBertModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_bert import BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BertConfig
|
from .configuration_bert import BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BertConfig
|
||||||
from .tokenization_bert import BasicTokenizer, BertTokenizer, WordpieceTokenizer
|
from .tokenization_bert import BasicTokenizer, BertTokenizer, WordpieceTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_bert_fast import BertTokenizerFast
|
from .tokenization_bert_fast import BertTokenizerFast
|
||||||
|
|
||||||
@@ -60,3 +116,21 @@ if is_tf_available():
|
|||||||
|
|
||||||
if is_flax_available():
|
if is_flax_available():
|
||||||
from .modeling_flax_bert import FlaxBertForMaskedLM, FlaxBertModel
|
from .modeling_flax_bert import FlaxBertForMaskedLM, FlaxBertModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,28 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_bert_generation import BertGenerationConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_sentencepiece_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_bert_generation": ["BertGenerationConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_bert_generation"] = ["BertGenerationTokenizer"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_bert_generation"] = [
|
||||||
|
"BertGenerationDecoder",
|
||||||
|
"BertGenerationEncoder",
|
||||||
|
"load_tf_weights_in_bert_generation",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_bert_generation import BertGenerationConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_bert_generation import BertGenerationTokenizer
|
from .tokenization_bert_generation import BertGenerationTokenizer
|
||||||
@@ -29,3 +48,21 @@ if is_torch_available():
|
|||||||
BertGenerationEncoder,
|
BertGenerationEncoder,
|
||||||
load_tf_weights_in_bert_generation,
|
load_tf_weights_in_bert_generation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,4 +16,33 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"tokenization_bert_japanese": ["BertJapaneseTokenizer", "CharacterTokenizer", "MecabTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .tokenization_bert_japanese import BertJapaneseTokenizer, CharacterTokenizer, MecabTokenizer
|
from .tokenization_bert_japanese import BertJapaneseTokenizer, CharacterTokenizer, MecabTokenizer
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,4 +16,33 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"tokenization_bertweet": ["BertweetTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .tokenization_bertweet import BertweetTokenizer
|
from .tokenization_bertweet import BertweetTokenizer
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,33 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_blenderbot": ["BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BlenderbotConfig"],
|
||||||
|
"tokenization_blenderbot": ["BlenderbotTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_blenderbot"] = [
|
||||||
|
"BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"BlenderbotForConditionalGeneration",
|
||||||
|
"BlenderbotModel",
|
||||||
|
"BlenderbotPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_blenderbot"] = ["TFBlenderbotForConditionalGeneration"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_blenderbot import BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP, BlenderbotConfig
|
from .configuration_blenderbot import BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP, BlenderbotConfig
|
||||||
from .tokenization_blenderbot import BlenderbotTokenizer
|
from .tokenization_blenderbot import BlenderbotTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_blenderbot import (
|
from .modeling_blenderbot import (
|
||||||
BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST,
|
BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -29,6 +51,23 @@ if is_torch_available():
|
|||||||
BlenderbotPreTrainedModel,
|
BlenderbotPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
from .modeling_tf_blenderbot import TFBlenderbotForConditionalGeneration
|
from .modeling_tf_blenderbot import TFBlenderbotForConditionalGeneration
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -15,11 +15,29 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_blenderbot_small": ["BLENDERBOT_SMALL_PRETRAINED_CONFIG_ARCHIVE_MAP", "BlenderbotSmallConfig"],
|
||||||
|
"tokenization_blenderbot_small": ["BlenderbotSmallTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_blenderbot_small"] = [
|
||||||
|
"BLENDERBOT_SMALL_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"BlenderbotSmallForConditionalGeneration",
|
||||||
|
"BlenderbotSmallModel",
|
||||||
|
"BlenderbotSmallPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_blenderbot_small import BLENDERBOT_SMALL_PRETRAINED_CONFIG_ARCHIVE_MAP, BlenderbotSmallConfig
|
from .configuration_blenderbot_small import BLENDERBOT_SMALL_PRETRAINED_CONFIG_ARCHIVE_MAP, BlenderbotSmallConfig
|
||||||
from .tokenization_blenderbot_small import BlenderbotSmallTokenizer
|
from .tokenization_blenderbot_small import BlenderbotSmallTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_blenderbot_small import (
|
from .modeling_blenderbot_small import (
|
||||||
BLENDERBOT_SMALL_PRETRAINED_MODEL_ARCHIVE_LIST,
|
BLENDERBOT_SMALL_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -27,3 +45,21 @@ if is_torch_available():
|
|||||||
BlenderbotSmallModel,
|
BlenderbotSmallModel,
|
||||||
BlenderbotSmallPreTrainedModel,
|
BlenderbotSmallPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,53 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_camembert import CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CamembertConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_camembert": ["CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "CamembertConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_camembert"] = ["CamembertTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_camembert_fast"] = ["CamembertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_camembert"] = [
|
||||||
|
"CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"CamembertForCausalLM",
|
||||||
|
"CamembertForMaskedLM",
|
||||||
|
"CamembertForMultipleChoice",
|
||||||
|
"CamembertForQuestionAnswering",
|
||||||
|
"CamembertForSequenceClassification",
|
||||||
|
"CamembertForTokenClassification",
|
||||||
|
"CamembertModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_camembert"] = [
|
||||||
|
"TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFCamembertForMaskedLM",
|
||||||
|
"TFCamembertForMultipleChoice",
|
||||||
|
"TFCamembertForQuestionAnswering",
|
||||||
|
"TFCamembertForSequenceClassification",
|
||||||
|
"TFCamembertForTokenClassification",
|
||||||
|
"TFCamembertModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_camembert import CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CamembertConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_camembert import CamembertTokenizer
|
from .tokenization_camembert import CamembertTokenizer
|
||||||
@@ -48,3 +92,21 @@ if is_tf_available():
|
|||||||
TFCamembertForTokenClassification,
|
TFCamembertForTokenClassification,
|
||||||
TFCamembertModel,
|
TFCamembertModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,39 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_ctrl": ["CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CTRLConfig"],
|
||||||
|
"tokenization_ctrl": ["CTRLTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_ctrl"] = [
|
||||||
|
"CTRL_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"CTRLForSequenceClassification",
|
||||||
|
"CTRLLMHeadModel",
|
||||||
|
"CTRLModel",
|
||||||
|
"CTRLPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_ctrl"] = [
|
||||||
|
"TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFCTRLForSequenceClassification",
|
||||||
|
"TFCTRLLMHeadModel",
|
||||||
|
"TFCTRLModel",
|
||||||
|
"TFCTRLPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_ctrl import CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRLConfig
|
from .configuration_ctrl import CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRLConfig
|
||||||
from .tokenization_ctrl import CTRLTokenizer
|
from .tokenization_ctrl import CTRLTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_ctrl import (
|
from .modeling_ctrl import (
|
||||||
CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
|
CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -38,3 +66,21 @@ if is_tf_available():
|
|||||||
TFCTRLModel,
|
TFCTRLModel,
|
||||||
TFCTRLPreTrainedModel,
|
TFCTRLPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,29 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_deberta": ["DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "DebertaConfig"],
|
||||||
|
"tokenization_deberta": ["DebertaTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_deberta"] = [
|
||||||
|
"DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"DebertaForSequenceClassification",
|
||||||
|
"DebertaModel",
|
||||||
|
"DebertaPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_deberta import DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, DebertaConfig
|
from .configuration_deberta import DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, DebertaConfig
|
||||||
from .tokenization_deberta import DebertaTokenizer
|
from .tokenization_deberta import DebertaTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_deberta import (
|
from .modeling_deberta import (
|
||||||
DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
|
DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -28,3 +46,21 @@ if is_torch_available():
|
|||||||
DebertaModel,
|
DebertaModel,
|
||||||
DebertaPreTrainedModel,
|
DebertaPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,49 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_distilbert": ["DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DistilBertConfig"],
|
||||||
|
"tokenization_distilbert": ["DistilBertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_distilbert_fast"] = ["DistilBertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_distilbert"] = [
|
||||||
|
"DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"DistilBertForMaskedLM",
|
||||||
|
"DistilBertForMultipleChoice",
|
||||||
|
"DistilBertForQuestionAnswering",
|
||||||
|
"DistilBertForSequenceClassification",
|
||||||
|
"DistilBertForTokenClassification",
|
||||||
|
"DistilBertModel",
|
||||||
|
"DistilBertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_distilbert"] = [
|
||||||
|
"TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFDistilBertForMaskedLM",
|
||||||
|
"TFDistilBertForMultipleChoice",
|
||||||
|
"TFDistilBertForQuestionAnswering",
|
||||||
|
"TFDistilBertForSequenceClassification",
|
||||||
|
"TFDistilBertForTokenClassification",
|
||||||
|
"TFDistilBertMainLayer",
|
||||||
|
"TFDistilBertModel",
|
||||||
|
"TFDistilBertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_distilbert import DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, DistilBertConfig
|
from .configuration_distilbert import DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, DistilBertConfig
|
||||||
from .tokenization_distilbert import DistilBertTokenizer
|
from .tokenization_distilbert import DistilBertTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_distilbert_fast import DistilBertTokenizerFast
|
from .tokenization_distilbert_fast import DistilBertTokenizerFast
|
||||||
|
|
||||||
@@ -48,3 +86,21 @@ if is_tf_available():
|
|||||||
TFDistilBertModel,
|
TFDistilBertModel,
|
||||||
TFDistilBertPreTrainedModel,
|
TFDistilBertPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,7 +16,57 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_dpr": ["DPR_PRETRAINED_CONFIG_ARCHIVE_MAP", "DPRConfig"],
|
||||||
|
"tokenization_dpr": [
|
||||||
|
"DPRContextEncoderTokenizer",
|
||||||
|
"DPRQuestionEncoderTokenizer",
|
||||||
|
"DPRReaderOutput",
|
||||||
|
"DPRReaderTokenizer",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_dpr_fast"] = [
|
||||||
|
"DPRContextEncoderTokenizerFast",
|
||||||
|
"DPRQuestionEncoderTokenizerFast",
|
||||||
|
"DPRReaderTokenizerFast",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_dpr"] = [
|
||||||
|
"DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"DPRContextEncoder",
|
||||||
|
"DPRPretrainedContextEncoder",
|
||||||
|
"DPRPretrainedQuestionEncoder",
|
||||||
|
"DPRPretrainedReader",
|
||||||
|
"DPRQuestionEncoder",
|
||||||
|
"DPRReader",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_dpr"] = [
|
||||||
|
"TF_DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TF_DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TF_DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFDPRContextEncoder",
|
||||||
|
"TFDPRPretrainedContextEncoder",
|
||||||
|
"TFDPRPretrainedQuestionEncoder",
|
||||||
|
"TFDPRPretrainedReader",
|
||||||
|
"TFDPRQuestionEncoder",
|
||||||
|
"TFDPRReader",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_dpr import DPR_PRETRAINED_CONFIG_ARCHIVE_MAP, DPRConfig
|
from .configuration_dpr import DPR_PRETRAINED_CONFIG_ARCHIVE_MAP, DPRConfig
|
||||||
from .tokenization_dpr import (
|
from .tokenization_dpr import (
|
||||||
DPRContextEncoderTokenizer,
|
DPRContextEncoderTokenizer,
|
||||||
@@ -25,7 +75,6 @@ from .tokenization_dpr import (
|
|||||||
DPRReaderTokenizer,
|
DPRReaderTokenizer,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_dpr_fast import (
|
from .tokenization_dpr_fast import (
|
||||||
DPRContextEncoderTokenizerFast,
|
DPRContextEncoderTokenizerFast,
|
||||||
@@ -58,3 +107,21 @@ if is_tf_available():
|
|||||||
TFDPRQuestionEncoder,
|
TFDPRQuestionEncoder,
|
||||||
TFDPRReader,
|
TFDPRReader,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,51 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_electra": ["ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP", "ElectraConfig"],
|
||||||
|
"tokenization_electra": ["ElectraTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_electra_fast"] = ["ElectraTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_electra"] = [
|
||||||
|
"ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"ElectraForMaskedLM",
|
||||||
|
"ElectraForMultipleChoice",
|
||||||
|
"ElectraForPreTraining",
|
||||||
|
"ElectraForQuestionAnswering",
|
||||||
|
"ElectraForSequenceClassification",
|
||||||
|
"ElectraForTokenClassification",
|
||||||
|
"ElectraModel",
|
||||||
|
"ElectraPreTrainedModel",
|
||||||
|
"load_tf_weights_in_electra",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_electra"] = [
|
||||||
|
"TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFElectraForMaskedLM",
|
||||||
|
"TFElectraForMultipleChoice",
|
||||||
|
"TFElectraForPreTraining",
|
||||||
|
"TFElectraForQuestionAnswering",
|
||||||
|
"TFElectraForSequenceClassification",
|
||||||
|
"TFElectraForTokenClassification",
|
||||||
|
"TFElectraModel",
|
||||||
|
"TFElectraPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_electra import ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP, ElectraConfig
|
from .configuration_electra import ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP, ElectraConfig
|
||||||
from .tokenization_electra import ElectraTokenizer
|
from .tokenization_electra import ElectraTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_electra_fast import ElectraTokenizerFast
|
from .tokenization_electra_fast import ElectraTokenizerFast
|
||||||
|
|
||||||
@@ -50,3 +90,21 @@ if is_tf_available():
|
|||||||
TFElectraModel,
|
TFElectraModel,
|
||||||
TFElectraPreTrainedModel,
|
TFElectraPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,39 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_encoder_decoder import EncoderDecoderConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_encoder_decoder": ["EncoderDecoderConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_encoder_decoder"] = ["EncoderDecoderModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_encoder_decoder import EncoderDecoderConfig
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_encoder_decoder import EncoderDecoderModel
|
from .modeling_encoder_decoder import EncoderDecoderModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,44 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_flaubert": ["FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "FlaubertConfig"],
|
||||||
|
"tokenization_flaubert": ["FlaubertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_flaubert"] = [
|
||||||
|
"FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"FlaubertForMultipleChoice",
|
||||||
|
"FlaubertForQuestionAnswering",
|
||||||
|
"FlaubertForQuestionAnsweringSimple",
|
||||||
|
"FlaubertForSequenceClassification",
|
||||||
|
"FlaubertForTokenClassification",
|
||||||
|
"FlaubertModel",
|
||||||
|
"FlaubertWithLMHeadModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_flaubert"] = [
|
||||||
|
"TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFFlaubertForMultipleChoice",
|
||||||
|
"TFFlaubertForQuestionAnsweringSimple",
|
||||||
|
"TFFlaubertForSequenceClassification",
|
||||||
|
"TFFlaubertForTokenClassification",
|
||||||
|
"TFFlaubertModel",
|
||||||
|
"TFFlaubertWithLMHeadModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_flaubert import FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, FlaubertConfig
|
from .configuration_flaubert import FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, FlaubertConfig
|
||||||
from .tokenization_flaubert import FlaubertTokenizer
|
from .tokenization_flaubert import FlaubertTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_flaubert import (
|
from .modeling_flaubert import (
|
||||||
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
|
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -43,3 +76,21 @@ if is_tf_available():
|
|||||||
TFFlaubertModel,
|
TFFlaubertModel,
|
||||||
TFFlaubertWithLMHeadModel,
|
TFFlaubertWithLMHeadModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,10 +16,41 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_fsmt": ["FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP", "FSMTConfig"],
|
||||||
|
"tokenization_fsmt": ["FSMTTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_fsmt"] = ["FSMTForConditionalGeneration", "FSMTModel", "PretrainedFSMTModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_fsmt import FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP, FSMTConfig
|
from .configuration_fsmt import FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP, FSMTConfig
|
||||||
from .tokenization_fsmt import FSMTTokenizer
|
from .tokenization_fsmt import FSMTTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_fsmt import FSMTForConditionalGeneration, FSMTModel, PretrainedFSMTModel
|
from .modeling_fsmt import FSMTForConditionalGeneration, FSMTModel, PretrainedFSMTModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,51 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_funnel": ["FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP", "FunnelConfig"],
|
||||||
|
"tokenization_funnel": ["FunnelTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_funnel_fast"] = ["FunnelTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_funnel"] = [
|
||||||
|
"FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"FunnelBaseModel",
|
||||||
|
"FunnelForMaskedLM",
|
||||||
|
"FunnelForMultipleChoice",
|
||||||
|
"FunnelForPreTraining",
|
||||||
|
"FunnelForQuestionAnswering",
|
||||||
|
"FunnelForSequenceClassification",
|
||||||
|
"FunnelForTokenClassification",
|
||||||
|
"FunnelModel",
|
||||||
|
"load_tf_weights_in_funnel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_funnel"] = [
|
||||||
|
"TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFFunnelBaseModel",
|
||||||
|
"TFFunnelForMaskedLM",
|
||||||
|
"TFFunnelForMultipleChoice",
|
||||||
|
"TFFunnelForPreTraining",
|
||||||
|
"TFFunnelForQuestionAnswering",
|
||||||
|
"TFFunnelForSequenceClassification",
|
||||||
|
"TFFunnelForTokenClassification",
|
||||||
|
"TFFunnelModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_funnel import FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP, FunnelConfig
|
from .configuration_funnel import FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP, FunnelConfig
|
||||||
from .tokenization_funnel import FunnelTokenizer
|
from .tokenization_funnel import FunnelTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_funnel_fast import FunnelTokenizerFast
|
from .tokenization_funnel_fast import FunnelTokenizerFast
|
||||||
|
|
||||||
@@ -50,3 +90,21 @@ if is_tf_available():
|
|||||||
TFFunnelForTokenClassification,
|
TFFunnelForTokenClassification,
|
||||||
TFFunnelModel,
|
TFFunnelModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,46 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_gpt2": ["GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPT2Config"],
|
||||||
|
"tokenization_gpt2": ["GPT2Tokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_gpt2_fast"] = ["GPT2TokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_gpt2"] = [
|
||||||
|
"GPT2_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"GPT2DoubleHeadsModel",
|
||||||
|
"GPT2ForSequenceClassification",
|
||||||
|
"GPT2LMHeadModel",
|
||||||
|
"GPT2Model",
|
||||||
|
"GPT2PreTrainedModel",
|
||||||
|
"load_tf_weights_in_gpt2",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_gpt2"] = [
|
||||||
|
"TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFGPT2DoubleHeadsModel",
|
||||||
|
"TFGPT2ForSequenceClassification",
|
||||||
|
"TFGPT2LMHeadModel",
|
||||||
|
"TFGPT2MainLayer",
|
||||||
|
"TFGPT2Model",
|
||||||
|
"TFGPT2PreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_gpt2 import GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2Config
|
from .configuration_gpt2 import GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2Config
|
||||||
from .tokenization_gpt2 import GPT2Tokenizer
|
from .tokenization_gpt2 import GPT2Tokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_gpt2_fast import GPT2TokenizerFast
|
from .tokenization_gpt2_fast import GPT2TokenizerFast
|
||||||
|
|
||||||
@@ -45,3 +80,21 @@ if is_tf_available():
|
|||||||
TFGPT2Model,
|
TFGPT2Model,
|
||||||
TFGPT2PreTrainedModel,
|
TFGPT2PreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,39 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tokenizers_available
|
from typing import TYPE_CHECKING
|
||||||
from .tokenization_herbert import HerbertTokenizer
|
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tokenizers_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"tokenization_herbert": ["HerbertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_herbert_fast"] = ["HerbertTokenizerFast"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .tokenization_herbert import HerbertTokenizer
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_herbert_fast import HerbertTokenizerFast
|
from .tokenization_herbert_fast import HerbertTokenizerFast
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,32 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_layoutlm": ["LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "LayoutLMConfig"],
|
||||||
|
"tokenization_layoutlm": ["LayoutLMTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_layoutlm_fast"] = ["LayoutLMTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_layoutlm"] = [
|
||||||
|
"LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"LayoutLMForMaskedLM",
|
||||||
|
"LayoutLMForTokenClassification",
|
||||||
|
"LayoutLMModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_layoutlm import LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP, LayoutLMConfig
|
from .configuration_layoutlm import LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP, LayoutLMConfig
|
||||||
from .tokenization_layoutlm import LayoutLMTokenizer
|
from .tokenization_layoutlm import LayoutLMTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_layoutlm_fast import LayoutLMTokenizerFast
|
from .tokenization_layoutlm_fast import LayoutLMTokenizerFast
|
||||||
|
|
||||||
@@ -31,3 +52,21 @@ if is_torch_available():
|
|||||||
LayoutLMForTokenClassification,
|
LayoutLMForTokenClassification,
|
||||||
LayoutLMModel,
|
LayoutLMModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -15,11 +15,38 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_led": ["LED_PRETRAINED_CONFIG_ARCHIVE_MAP", "LEDConfig"],
|
||||||
|
"tokenization_led": ["LEDTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_led_fast"] = ["LEDTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_led"] = [
|
||||||
|
"LED_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"LEDForConditionalGeneration",
|
||||||
|
"LEDForQuestionAnswering",
|
||||||
|
"LEDForSequenceClassification",
|
||||||
|
"LEDModel",
|
||||||
|
"LEDPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_led"] = ["TFLEDForConditionalGeneration", "TFLEDModel", "TFLEDPreTrainedModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_led import LED_PRETRAINED_CONFIG_ARCHIVE_MAP, LEDConfig
|
from .configuration_led import LED_PRETRAINED_CONFIG_ARCHIVE_MAP, LEDConfig
|
||||||
from .tokenization_led import LEDTokenizer
|
from .tokenization_led import LEDTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_led_fast import LEDTokenizerFast
|
from .tokenization_led_fast import LEDTokenizerFast
|
||||||
|
|
||||||
@@ -33,6 +60,23 @@ if is_torch_available():
|
|||||||
LEDPreTrainedModel,
|
LEDPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
from .modeling_tf_led import TFLEDForConditionalGeneration, TFLEDModel, TFLEDPreTrainedModel
|
from .modeling_tf_led import TFLEDForConditionalGeneration, TFLEDModel, TFLEDPreTrainedModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,48 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_longformer": ["LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "LongformerConfig"],
|
||||||
|
"tokenization_longformer": ["LongformerTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_longformer_fast"] = ["LongformerTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_longformer"] = [
|
||||||
|
"LONGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"LongformerForMaskedLM",
|
||||||
|
"LongformerForMultipleChoice",
|
||||||
|
"LongformerForQuestionAnswering",
|
||||||
|
"LongformerForSequenceClassification",
|
||||||
|
"LongformerForTokenClassification",
|
||||||
|
"LongformerModel",
|
||||||
|
"LongformerSelfAttention",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_longformer"] = [
|
||||||
|
"TF_LONGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFLongformerForMaskedLM",
|
||||||
|
"TFLongformerForMultipleChoice",
|
||||||
|
"TFLongformerForQuestionAnswering",
|
||||||
|
"TFLongformerForSequenceClassification",
|
||||||
|
"TFLongformerForTokenClassification",
|
||||||
|
"TFLongformerModel",
|
||||||
|
"TFLongformerSelfAttention",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_longformer import LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, LongformerConfig
|
from .configuration_longformer import LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, LongformerConfig
|
||||||
from .tokenization_longformer import LongformerTokenizer
|
from .tokenization_longformer import LongformerTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_longformer_fast import LongformerTokenizerFast
|
from .tokenization_longformer_fast import LongformerTokenizerFast
|
||||||
|
|
||||||
@@ -47,3 +84,21 @@ if is_tf_available():
|
|||||||
TFLongformerModel,
|
TFLongformerModel,
|
||||||
TFLongformerSelfAttention,
|
TFLongformerSelfAttention,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,45 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LxmertConfig"],
|
||||||
|
"tokenization_lxmert": ["LxmertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_lxmert_fast"] = ["LxmertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_lxmert"] = [
|
||||||
|
"LxmertEncoder",
|
||||||
|
"LxmertForPreTraining",
|
||||||
|
"LxmertForQuestionAnswering",
|
||||||
|
"LxmertModel",
|
||||||
|
"LxmertPreTrainedModel",
|
||||||
|
"LxmertVisualFeatureEncoder",
|
||||||
|
"LxmertXLayer",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_lxmert"] = [
|
||||||
|
"TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFLxmertForPreTraining",
|
||||||
|
"TFLxmertMainLayer",
|
||||||
|
"TFLxmertModel",
|
||||||
|
"TFLxmertPreTrainedModel",
|
||||||
|
"TFLxmertVisualFeatureEncoder",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
|
from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
|
||||||
from .tokenization_lxmert import LxmertTokenizer
|
from .tokenization_lxmert import LxmertTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_lxmert_fast import LxmertTokenizerFast
|
from .tokenization_lxmert_fast import LxmertTokenizerFast
|
||||||
|
|
||||||
@@ -44,3 +78,21 @@ if is_tf_available():
|
|||||||
TFLxmertPreTrainedModel,
|
TFLxmertPreTrainedModel,
|
||||||
TFLxmertVisualFeatureEncoder,
|
TFLxmertVisualFeatureEncoder,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -15,9 +15,38 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_marian import MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP, MarianConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_marian": ["MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP", "MarianConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_marian"] = ["MarianTokenizer"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_marian"] = [
|
||||||
|
"MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"MarianModel",
|
||||||
|
"MarianMTModel",
|
||||||
|
"MarianPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_marian"] = ["TFMarianMTModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_marian import MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP, MarianConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_marian import MarianTokenizer
|
from .tokenization_marian import MarianTokenizer
|
||||||
@@ -32,3 +61,21 @@ if is_torch_available():
|
|||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
from .modeling_tf_marian import TFMarianMTModel
|
from .modeling_tf_marian import TFMarianMTModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -15,9 +15,43 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_mbart import MBART_PRETRAINED_CONFIG_ARCHIVE_MAP, MBartConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_mbart": ["MBART_PRETRAINED_CONFIG_ARCHIVE_MAP", "MBartConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_mbart"] = ["MBartTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_mbart_fast"] = ["MBartTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_mbart"] = [
|
||||||
|
"MBART_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"MBartForConditionalGeneration",
|
||||||
|
"MBartForQuestionAnswering",
|
||||||
|
"MBartForSequenceClassification",
|
||||||
|
"MBartModel",
|
||||||
|
"MBartPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_mbart"] = ["TFMBartForConditionalGeneration"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_mbart import MBART_PRETRAINED_CONFIG_ARCHIVE_MAP, MBartConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_mbart import MBartTokenizer
|
from .tokenization_mbart import MBartTokenizer
|
||||||
@@ -37,3 +71,21 @@ if is_torch_available():
|
|||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
from .modeling_tf_mbart import TFMBartForConditionalGeneration
|
from .modeling_tf_mbart import TFMBartForConditionalGeneration
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,39 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_mmbt import MMBTConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_mmbt": ["MMBTConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_mmbt"] = ["MMBTForClassification", "MMBTModel", "ModalEmbeddings"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_mmbt import MMBTConfig
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_mmbt import MMBTForClassification, MMBTModel, ModalEmbeddings
|
from .modeling_mmbt import MMBTForClassification, MMBTModel, ModalEmbeddings
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,55 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_mobilebert": ["MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MobileBertConfig"],
|
||||||
|
"tokenization_mobilebert": ["MobileBertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_mobilebert_fast"] = ["MobileBertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_mobilebert"] = [
|
||||||
|
"MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"MobileBertForMaskedLM",
|
||||||
|
"MobileBertForMultipleChoice",
|
||||||
|
"MobileBertForNextSentencePrediction",
|
||||||
|
"MobileBertForPreTraining",
|
||||||
|
"MobileBertForQuestionAnswering",
|
||||||
|
"MobileBertForSequenceClassification",
|
||||||
|
"MobileBertForTokenClassification",
|
||||||
|
"MobileBertLayer",
|
||||||
|
"MobileBertModel",
|
||||||
|
"MobileBertPreTrainedModel",
|
||||||
|
"load_tf_weights_in_mobilebert",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_mobilebert"] = [
|
||||||
|
"TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFMobileBertForMaskedLM",
|
||||||
|
"TFMobileBertForMultipleChoice",
|
||||||
|
"TFMobileBertForNextSentencePrediction",
|
||||||
|
"TFMobileBertForPreTraining",
|
||||||
|
"TFMobileBertForQuestionAnswering",
|
||||||
|
"TFMobileBertForSequenceClassification",
|
||||||
|
"TFMobileBertForTokenClassification",
|
||||||
|
"TFMobileBertMainLayer",
|
||||||
|
"TFMobileBertModel",
|
||||||
|
"TFMobileBertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_mobilebert import MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, MobileBertConfig
|
from .configuration_mobilebert import MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, MobileBertConfig
|
||||||
from .tokenization_mobilebert import MobileBertTokenizer
|
from .tokenization_mobilebert import MobileBertTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_mobilebert_fast import MobileBertTokenizerFast
|
from .tokenization_mobilebert_fast import MobileBertTokenizerFast
|
||||||
|
|
||||||
@@ -54,3 +98,21 @@ if is_tf_available():
|
|||||||
TFMobileBertModel,
|
TFMobileBertModel,
|
||||||
TFMobileBertPreTrainedModel,
|
TFMobileBertPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,57 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_flax_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_mpnet": ["MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "MPNetConfig"],
|
||||||
|
"tokenization_mpnet": ["MPNetTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_mpnet_fast"] = ["MPNetTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_mpnet"] = [
|
||||||
|
"MPNET_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"MPNetForMaskedLM",
|
||||||
|
"MPNetForMultipleChoice",
|
||||||
|
"MPNetForQuestionAnswering",
|
||||||
|
"MPNetForSequenceClassification",
|
||||||
|
"MPNetForTokenClassification",
|
||||||
|
"MPNetLayer",
|
||||||
|
"MPNetModel",
|
||||||
|
"MPNetPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_mpnet"] = [
|
||||||
|
"TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFMPNetEmbeddings",
|
||||||
|
"TFMPNetForMaskedLM",
|
||||||
|
"TFMPNetForMultipleChoice",
|
||||||
|
"TFMPNetForQuestionAnswering",
|
||||||
|
"TFMPNetForSequenceClassification",
|
||||||
|
"TFMPNetForTokenClassification",
|
||||||
|
"TFMPNetMainLayer",
|
||||||
|
"TFMPNetModel",
|
||||||
|
"TFMPNetPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_mpnet import MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP, MPNetConfig
|
from .configuration_mpnet import MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP, MPNetConfig
|
||||||
from .tokenization_mpnet import MPNetTokenizer
|
from .tokenization_mpnet import MPNetTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_mpnet_fast import MPNetTokenizerFast
|
from .tokenization_mpnet_fast import MPNetTokenizerFast
|
||||||
|
|
||||||
@@ -50,3 +96,21 @@ if is_tf_available():
|
|||||||
TFMPNetModel,
|
TFMPNetModel,
|
||||||
TFMPNetPreTrainedModel,
|
TFMPNetPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,40 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_mt5 import MT5Config
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
from ..t5.tokenization_t5 import T5Tokenizer
|
||||||
|
|
||||||
|
MT5Tokenizer = T5Tokenizer
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
from ..t5.tokenization_t5_fast import T5TokenizerFast
|
||||||
|
|
||||||
|
MT5TokenizerFast = T5TokenizerFast
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_mt5": ["MT5Config"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_mt5"] = ["MT5EncoderModel", "MT5ForConditionalGeneration", "MT5Model"]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_mt5"] = ["TFMT5EncoderModel", "TFMT5ForConditionalGeneration", "TFMT5Model"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_mt5 import MT5Config
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from ..t5.tokenization_t5 import T5Tokenizer
|
from ..t5.tokenization_t5 import T5Tokenizer
|
||||||
@@ -35,3 +66,29 @@ if is_torch_available():
|
|||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
from .modeling_tf_mt5 import TFMT5EncoderModel, TFMT5ForConditionalGeneration, TFMT5Model
|
from .modeling_tf_mt5 import TFMT5EncoderModel, TFMT5ForConditionalGeneration, TFMT5Model
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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):
|
||||||
|
if name == "MT5Tokenizer":
|
||||||
|
return MT5Tokenizer
|
||||||
|
elif name == name == "MT5TokenizerFast":
|
||||||
|
return MT5TokenizerFast
|
||||||
|
else:
|
||||||
|
return super().__getattr__(name)
|
||||||
|
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _import_structure)
|
||||||
|
|||||||
@@ -16,11 +16,46 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_openai": ["OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OpenAIGPTConfig"],
|
||||||
|
"tokenization_openai": ["OpenAIGPTTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_openai_fast"] = ["OpenAIGPTTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_openai"] = [
|
||||||
|
"OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"OpenAIGPTDoubleHeadsModel",
|
||||||
|
"OpenAIGPTForSequenceClassification",
|
||||||
|
"OpenAIGPTLMHeadModel",
|
||||||
|
"OpenAIGPTModel",
|
||||||
|
"OpenAIGPTPreTrainedModel",
|
||||||
|
"load_tf_weights_in_openai_gpt",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_openai"] = [
|
||||||
|
"TF_OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFOpenAIGPTDoubleHeadsModel",
|
||||||
|
"TFOpenAIGPTForSequenceClassification",
|
||||||
|
"TFOpenAIGPTLMHeadModel",
|
||||||
|
"TFOpenAIGPTMainLayer",
|
||||||
|
"TFOpenAIGPTModel",
|
||||||
|
"TFOpenAIGPTPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_openai import OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP, OpenAIGPTConfig
|
from .configuration_openai import OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP, OpenAIGPTConfig
|
||||||
from .tokenization_openai import OpenAIGPTTokenizer
|
from .tokenization_openai import OpenAIGPTTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_openai_fast import OpenAIGPTTokenizerFast
|
from .tokenization_openai_fast import OpenAIGPTTokenizerFast
|
||||||
|
|
||||||
@@ -45,3 +80,21 @@ if is_tf_available():
|
|||||||
TFOpenAIGPTModel,
|
TFOpenAIGPTModel,
|
||||||
TFOpenAIGPTPreTrainedModel,
|
TFOpenAIGPTPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -15,9 +15,41 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_pegasus": ["PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "PegasusConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_pegasus"] = ["PegasusTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_pegasus_fast"] = ["PegasusTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_pegasus"] = [
|
||||||
|
"PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"PegasusForConditionalGeneration",
|
||||||
|
"PegasusModel",
|
||||||
|
"PegasusPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_pegasus"] = ["TFPegasusForConditionalGeneration"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_pegasus import PegasusTokenizer
|
from .tokenization_pegasus import PegasusTokenizer
|
||||||
@@ -35,3 +67,21 @@ if is_torch_available():
|
|||||||
|
|
||||||
if is_tf_available():
|
if is_tf_available():
|
||||||
from .modeling_tf_pegasus import TFPegasusForConditionalGeneration
|
from .modeling_tf_pegasus import TFPegasusForConditionalGeneration
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,4 +16,33 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"tokenization_phobert": ["PhobertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .tokenization_phobert import PhobertTokenizer
|
from .tokenization_phobert import PhobertTokenizer
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,32 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_prophetnet": ["PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "ProphetNetConfig"],
|
||||||
|
"tokenization_prophetnet": ["ProphetNetTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_prophetnet"] = [
|
||||||
|
"PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"ProphetNetDecoder",
|
||||||
|
"ProphetNetEncoder",
|
||||||
|
"ProphetNetForCausalLM",
|
||||||
|
"ProphetNetForConditionalGeneration",
|
||||||
|
"ProphetNetModel",
|
||||||
|
"ProphetNetPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_prophetnet import PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, ProphetNetConfig
|
from .configuration_prophetnet import PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, ProphetNetConfig
|
||||||
from .tokenization_prophetnet import ProphetNetTokenizer
|
from .tokenization_prophetnet import ProphetNetTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_prophetnet import (
|
from .modeling_prophetnet import (
|
||||||
PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
|
PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -31,3 +52,21 @@ if is_torch_available():
|
|||||||
ProphetNetModel,
|
ProphetNetModel,
|
||||||
ProphetNetPreTrainedModel,
|
ProphetNetPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,43 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_rag": ["RagConfig"],
|
||||||
|
"retrieval_rag": ["RagRetriever"],
|
||||||
|
"tokenization_rag": ["RagTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_rag"] = ["RagModel", "RagSequenceForGeneration", "RagTokenForGeneration"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_rag import RagConfig
|
from .configuration_rag import RagConfig
|
||||||
from .retrieval_rag import RagRetriever
|
from .retrieval_rag import RagRetriever
|
||||||
from .tokenization_rag import RagTokenizer
|
from .tokenization_rag import RagTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_rag import RagModel, RagSequenceForGeneration, RagTokenForGeneration
|
from .modeling_rag import RagModel, RagSequenceForGeneration, RagTokenForGeneration
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,36 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_reformer import REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, ReformerConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_reformer"] = ["ReformerTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_reformer_fast"] = ["ReformerTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_reformer"] = [
|
||||||
|
"REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"ReformerAttention",
|
||||||
|
"ReformerForMaskedLM",
|
||||||
|
"ReformerForQuestionAnswering",
|
||||||
|
"ReformerForSequenceClassification",
|
||||||
|
"ReformerLayer",
|
||||||
|
"ReformerModel",
|
||||||
|
"ReformerModelWithLMHead",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_reformer import REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, ReformerConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_reformer import ReformerTokenizer
|
from .tokenization_reformer import ReformerTokenizer
|
||||||
@@ -37,3 +64,21 @@ if is_torch_available():
|
|||||||
ReformerModel,
|
ReformerModel,
|
||||||
ReformerModelWithLMHead,
|
ReformerModelWithLMHead,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,13 +16,55 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_retribert": ["RETRIBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RetriBertConfig"],
|
||||||
|
"tokenization_retribert": ["RetriBertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_retribert_fast"] = ["RetriBertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_retribert"] = [
|
||||||
|
"RETRIBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"RetriBertModel",
|
||||||
|
"RetriBertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_retribert import RETRIBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, RetriBertConfig
|
from .configuration_retribert import RETRIBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, RetriBertConfig
|
||||||
from .tokenization_retribert import RetriBertTokenizer
|
from .tokenization_retribert import RetriBertTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_retribert_fast import RetriBertTokenizerFast
|
from .tokenization_retribert_fast import RetriBertTokenizerFast
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_retribert import RETRIBERT_PRETRAINED_MODEL_ARCHIVE_LIST, RetriBertModel, RetriBertPreTrainedModel
|
from .modeling_retribert import (
|
||||||
|
RETRIBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
|
RetriBertModel,
|
||||||
|
RetriBertPreTrainedModel,
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,58 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_flax_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_roberta": ["ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "RobertaConfig"],
|
||||||
|
"tokenization_roberta": ["RobertaTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_roberta_fast"] = ["RobertaTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_roberta"] = [
|
||||||
|
"ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"RobertaForCausalLM",
|
||||||
|
"RobertaForMaskedLM",
|
||||||
|
"RobertaForMultipleChoice",
|
||||||
|
"RobertaForQuestionAnswering",
|
||||||
|
"RobertaForSequenceClassification",
|
||||||
|
"RobertaForTokenClassification",
|
||||||
|
"RobertaModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_roberta"] = [
|
||||||
|
"TF_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFRobertaForMaskedLM",
|
||||||
|
"TFRobertaForMultipleChoice",
|
||||||
|
"TFRobertaForQuestionAnswering",
|
||||||
|
"TFRobertaForSequenceClassification",
|
||||||
|
"TFRobertaForTokenClassification",
|
||||||
|
"TFRobertaMainLayer",
|
||||||
|
"TFRobertaModel",
|
||||||
|
"TFRobertaPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_flax_available():
|
||||||
|
_import_structure["modeling_flax_roberta"] = ["FlaxRobertaModel"]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_roberta import ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, RobertaConfig
|
from .configuration_roberta import ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, RobertaConfig
|
||||||
from .tokenization_roberta import RobertaTokenizer
|
from .tokenization_roberta import RobertaTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_roberta_fast import RobertaTokenizerFast
|
from .tokenization_roberta_fast import RobertaTokenizerFast
|
||||||
|
|
||||||
@@ -51,3 +98,21 @@ if is_tf_available():
|
|||||||
|
|
||||||
if is_flax_available():
|
if is_flax_available():
|
||||||
from .modeling_flax_roberta import FlaxRobertaModel
|
from .modeling_flax_roberta import FlaxRobertaModel
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,37 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tokenizers_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_squeezebert": ["SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "SqueezeBertConfig"],
|
||||||
|
"tokenization_squeezebert": ["SqueezeBertTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_squeezebert_fast"] = ["SqueezeBertTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_squeezebert"] = [
|
||||||
|
"SQUEEZEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"SqueezeBertForMaskedLM",
|
||||||
|
"SqueezeBertForMultipleChoice",
|
||||||
|
"SqueezeBertForQuestionAnswering",
|
||||||
|
"SqueezeBertForSequenceClassification",
|
||||||
|
"SqueezeBertForTokenClassification",
|
||||||
|
"SqueezeBertModel",
|
||||||
|
"SqueezeBertModule",
|
||||||
|
"SqueezeBertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_squeezebert import SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, SqueezeBertConfig
|
from .configuration_squeezebert import SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, SqueezeBertConfig
|
||||||
from .tokenization_squeezebert import SqueezeBertTokenizer
|
from .tokenization_squeezebert import SqueezeBertTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_tokenizers_available():
|
if is_tokenizers_available():
|
||||||
from .tokenization_squeezebert_fast import SqueezeBertTokenizerFast
|
from .tokenization_squeezebert_fast import SqueezeBertTokenizerFast
|
||||||
|
|
||||||
@@ -36,3 +62,21 @@ if is_torch_available():
|
|||||||
SqueezeBertModule,
|
SqueezeBertModule,
|
||||||
SqueezeBertPreTrainedModel,
|
SqueezeBertPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,49 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_t5 import T5_PRETRAINED_CONFIG_ARCHIVE_MAP, T5Config
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_t5": ["T5_PRETRAINED_CONFIG_ARCHIVE_MAP", "T5Config"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_t5"] = ["T5Tokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_t5_fast"] = ["T5TokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_t5"] = [
|
||||||
|
"T5_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"T5EncoderModel",
|
||||||
|
"T5ForConditionalGeneration",
|
||||||
|
"T5Model",
|
||||||
|
"T5PreTrainedModel",
|
||||||
|
"load_tf_weights_in_t5",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_t5"] = [
|
||||||
|
"TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFT5EncoderModel",
|
||||||
|
"TFT5ForConditionalGeneration",
|
||||||
|
"TFT5Model",
|
||||||
|
"TFT5PreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_t5 import T5_PRETRAINED_CONFIG_ARCHIVE_MAP, T5Config
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_t5 import T5Tokenizer
|
from .tokenization_t5 import T5Tokenizer
|
||||||
@@ -44,3 +84,21 @@ if is_tf_available():
|
|||||||
TFT5Model,
|
TFT5Model,
|
||||||
TFT5PreTrainedModel,
|
TFT5PreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,30 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_tapas": ["TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP", "TapasConfig"],
|
||||||
|
"tokenization_tapas": ["TapasTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_tapas"] = [
|
||||||
|
"TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TapasForMaskedLM",
|
||||||
|
"TapasForQuestionAnswering",
|
||||||
|
"TapasForSequenceClassification",
|
||||||
|
"TapasModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_tapas import TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP, TapasConfig
|
from .configuration_tapas import TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP, TapasConfig
|
||||||
from .tokenization_tapas import TapasTokenizer
|
from .tokenization_tapas import TapasTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_tapas import (
|
from .modeling_tapas import (
|
||||||
TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
|
TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -29,3 +48,21 @@ if is_torch_available():
|
|||||||
TapasForSequenceClassification,
|
TapasForSequenceClassification,
|
||||||
TapasModel,
|
TapasModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,43 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_transfo_xl": ["TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP", "TransfoXLConfig"],
|
||||||
|
"tokenization_transfo_xl": ["TransfoXLCorpus", "TransfoXLTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_transfo_xl"] = [
|
||||||
|
"TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"AdaptiveEmbedding",
|
||||||
|
"TransfoXLForSequenceClassification",
|
||||||
|
"TransfoXLLMHeadModel",
|
||||||
|
"TransfoXLModel",
|
||||||
|
"TransfoXLPreTrainedModel",
|
||||||
|
"load_tf_weights_in_transfo_xl",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_transfo_xl"] = [
|
||||||
|
"TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFAdaptiveEmbedding",
|
||||||
|
"TFTransfoXLForSequenceClassification",
|
||||||
|
"TFTransfoXLLMHeadModel",
|
||||||
|
"TFTransfoXLMainLayer",
|
||||||
|
"TFTransfoXLModel",
|
||||||
|
"TFTransfoXLPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_transfo_xl import TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP, TransfoXLConfig
|
from .configuration_transfo_xl import TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP, TransfoXLConfig
|
||||||
from .tokenization_transfo_xl import TransfoXLCorpus, TransfoXLTokenizer
|
from .tokenization_transfo_xl import TransfoXLCorpus, TransfoXLTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_transfo_xl import (
|
from .modeling_transfo_xl import (
|
||||||
TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
|
TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -42,3 +74,21 @@ if is_tf_available():
|
|||||||
TFTransfoXLModel,
|
TFTransfoXLModel,
|
||||||
TFTransfoXLPreTrainedModel,
|
TFTransfoXLPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,11 +16,47 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_tf_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig"],
|
||||||
|
"tokenization_xlm": ["XLMTokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_xlm"] = [
|
||||||
|
"XLM_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"XLMForMultipleChoice",
|
||||||
|
"XLMForQuestionAnswering",
|
||||||
|
"XLMForQuestionAnsweringSimple",
|
||||||
|
"XLMForSequenceClassification",
|
||||||
|
"XLMForTokenClassification",
|
||||||
|
"XLMModel",
|
||||||
|
"XLMPreTrainedModel",
|
||||||
|
"XLMWithLMHeadModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_xlm"] = [
|
||||||
|
"TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFXLMForMultipleChoice",
|
||||||
|
"TFXLMForQuestionAnsweringSimple",
|
||||||
|
"TFXLMForSequenceClassification",
|
||||||
|
"TFXLMForTokenClassification",
|
||||||
|
"TFXLMMainLayer",
|
||||||
|
"TFXLMModel",
|
||||||
|
"TFXLMPreTrainedModel",
|
||||||
|
"TFXLMWithLMHeadModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig
|
from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig
|
||||||
from .tokenization_xlm import XLMTokenizer
|
from .tokenization_xlm import XLMTokenizer
|
||||||
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
from .modeling_xlm import (
|
from .modeling_xlm import (
|
||||||
XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
|
XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||||
@@ -46,3 +82,21 @@ if is_tf_available():
|
|||||||
TFXLMPreTrainedModel,
|
TFXLMPreTrainedModel,
|
||||||
TFXLMWithLMHeadModel,
|
TFXLMWithLMHeadModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,53 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_xlm_roberta import XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMRobertaConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_xlm_roberta": ["XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMRobertaConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_xlm_roberta"] = ["XLMRobertaTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_xlm_roberta_fast"] = ["XLMRobertaTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_xlm_roberta"] = [
|
||||||
|
"XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"XLMRobertaForCausalLM",
|
||||||
|
"XLMRobertaForMaskedLM",
|
||||||
|
"XLMRobertaForMultipleChoice",
|
||||||
|
"XLMRobertaForQuestionAnswering",
|
||||||
|
"XLMRobertaForSequenceClassification",
|
||||||
|
"XLMRobertaForTokenClassification",
|
||||||
|
"XLMRobertaModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_xlm_roberta"] = [
|
||||||
|
"TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFXLMRobertaForMaskedLM",
|
||||||
|
"TFXLMRobertaForMultipleChoice",
|
||||||
|
"TFXLMRobertaForQuestionAnswering",
|
||||||
|
"TFXLMRobertaForSequenceClassification",
|
||||||
|
"TFXLMRobertaForTokenClassification",
|
||||||
|
"TFXLMRobertaModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_xlm_roberta import XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMRobertaConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_xlm_roberta import XLMRobertaTokenizer
|
from .tokenization_xlm_roberta import XLMRobertaTokenizer
|
||||||
@@ -48,3 +92,21 @@ if is_tf_available():
|
|||||||
TFXLMRobertaForTokenClassification,
|
TFXLMRobertaForTokenClassification,
|
||||||
TFXLMRobertaModel,
|
TFXLMRobertaModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -16,9 +16,57 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ...file_utils import is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available
|
from typing import TYPE_CHECKING
|
||||||
from .configuration_xlnet import XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLNetConfig
|
|
||||||
|
|
||||||
|
from ...file_utils import (
|
||||||
|
_BaseLazyModule,
|
||||||
|
is_sentencepiece_available,
|
||||||
|
is_tf_available,
|
||||||
|
is_tokenizers_available,
|
||||||
|
is_torch_available,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_xlnet": ["XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLNetConfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_sentencepiece_available():
|
||||||
|
_import_structure["tokenization_xlnet"] = ["XLNetTokenizer"]
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_xlnet_fast"] = ["XLNetTokenizerFast"]
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_xlnet"] = [
|
||||||
|
"XLNET_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"XLNetForMultipleChoice",
|
||||||
|
"XLNetForQuestionAnswering",
|
||||||
|
"XLNetForQuestionAnsweringSimple",
|
||||||
|
"XLNetForSequenceClassification",
|
||||||
|
"XLNetForTokenClassification",
|
||||||
|
"XLNetLMHeadModel",
|
||||||
|
"XLNetModel",
|
||||||
|
"XLNetPreTrainedModel",
|
||||||
|
"load_tf_weights_in_xlnet",
|
||||||
|
]
|
||||||
|
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_xlnet"] = [
|
||||||
|
"TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TFXLNetForMultipleChoice",
|
||||||
|
"TFXLNetForQuestionAnsweringSimple",
|
||||||
|
"TFXLNetForSequenceClassification",
|
||||||
|
"TFXLNetForTokenClassification",
|
||||||
|
"TFXLNetLMHeadModel",
|
||||||
|
"TFXLNetMainLayer",
|
||||||
|
"TFXLNetModel",
|
||||||
|
"TFXLNetPreTrainedModel",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .configuration_xlnet import XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLNetConfig
|
||||||
|
|
||||||
if is_sentencepiece_available():
|
if is_sentencepiece_available():
|
||||||
from .tokenization_xlnet import XLNetTokenizer
|
from .tokenization_xlnet import XLNetTokenizer
|
||||||
@@ -52,3 +100,21 @@ if is_tf_available():
|
|||||||
TFXLNetModel,
|
TFXLNetModel,
|
||||||
TFXLNetPreTrainedModel,
|
TFXLNetPreTrainedModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import warnings
|
|||||||
from collections import OrderedDict, UserDict
|
from collections import OrderedDict, UserDict
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, NamedTuple, Optional, Sequence, Tuple, Union
|
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Tuple, Union
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@@ -45,21 +45,34 @@ from .file_utils import (
|
|||||||
from .utils import logging
|
from .utils import logging
|
||||||
|
|
||||||
|
|
||||||
if is_tf_available():
|
if TYPE_CHECKING:
|
||||||
import tensorflow as tf
|
|
||||||
|
|
||||||
if is_torch_available():
|
if is_torch_available():
|
||||||
import torch
|
import torch
|
||||||
|
if is_tf_available():
|
||||||
|
import tensorflow as tf
|
||||||
if is_flax_available():
|
if is_flax_available():
|
||||||
import jax.numpy as jnp
|
import jax.numpy as jnp # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
def _is_numpy(x):
|
def _is_numpy(x):
|
||||||
return isinstance(x, np.ndarray)
|
return isinstance(x, np.ndarray)
|
||||||
|
|
||||||
|
|
||||||
|
def _is_torch(x):
|
||||||
|
import torch
|
||||||
|
|
||||||
|
return isinstance(x, torch.Tensor)
|
||||||
|
|
||||||
|
|
||||||
|
def _is_tensorflow(x):
|
||||||
|
import tensorflow as tf
|
||||||
|
|
||||||
|
return isinstance(x, tf.Tensor)
|
||||||
|
|
||||||
|
|
||||||
def _is_jax(x):
|
def _is_jax(x):
|
||||||
|
import jax.numpy as jnp # noqa: F811
|
||||||
|
|
||||||
return isinstance(x, jnp.ndarray)
|
return isinstance(x, jnp.ndarray)
|
||||||
|
|
||||||
|
|
||||||
@@ -196,9 +209,9 @@ def to_py_obj(obj):
|
|||||||
return {k: to_py_obj(v) for k, v in obj.items()}
|
return {k: to_py_obj(v) for k, v in obj.items()}
|
||||||
elif isinstance(obj, (list, tuple)):
|
elif isinstance(obj, (list, tuple)):
|
||||||
return [to_py_obj(o) for o in obj]
|
return [to_py_obj(o) for o in obj]
|
||||||
elif is_tf_available() and isinstance(obj, tf.Tensor):
|
elif is_tf_available() and _is_tensorflow(obj):
|
||||||
return obj.numpy().tolist()
|
return obj.numpy().tolist()
|
||||||
elif is_torch_available() and isinstance(obj, torch.Tensor):
|
elif is_torch_available() and _is_torch(obj):
|
||||||
return obj.detach().cpu().tolist()
|
return obj.detach().cpu().tolist()
|
||||||
elif isinstance(obj, np.ndarray):
|
elif isinstance(obj, np.ndarray):
|
||||||
return obj.tolist()
|
return obj.tolist()
|
||||||
@@ -714,16 +727,22 @@ class BatchEncoding(UserDict):
|
|||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Unable to convert output to TensorFlow tensors format, TensorFlow is not installed."
|
"Unable to convert output to TensorFlow tensors format, TensorFlow is not installed."
|
||||||
)
|
)
|
||||||
|
import tensorflow as tf
|
||||||
|
|
||||||
as_tensor = tf.constant
|
as_tensor = tf.constant
|
||||||
is_tensor = tf.is_tensor
|
is_tensor = tf.is_tensor
|
||||||
elif tensor_type == TensorType.PYTORCH:
|
elif tensor_type == TensorType.PYTORCH:
|
||||||
if not is_torch_available():
|
if not is_torch_available():
|
||||||
raise ImportError("Unable to convert output to PyTorch tensors format, PyTorch is not installed.")
|
raise ImportError("Unable to convert output to PyTorch tensors format, PyTorch is not installed.")
|
||||||
|
import torch
|
||||||
|
|
||||||
as_tensor = torch.tensor
|
as_tensor = torch.tensor
|
||||||
is_tensor = torch.is_tensor
|
is_tensor = torch.is_tensor
|
||||||
elif tensor_type == TensorType.JAX:
|
elif tensor_type == TensorType.JAX:
|
||||||
if not is_flax_available():
|
if not is_flax_available():
|
||||||
raise ImportError("Unable to convert output to JAX tensors format, JAX is not installed.")
|
raise ImportError("Unable to convert output to JAX tensors format, JAX is not installed.")
|
||||||
|
import jax.numpy as jnp # noqa: F811
|
||||||
|
|
||||||
as_tensor = jnp.array
|
as_tensor = jnp.array
|
||||||
is_tensor = _is_jax
|
is_tensor = _is_jax
|
||||||
else:
|
else:
|
||||||
@@ -2684,9 +2703,9 @@ class PreTrainedTokenizerBase(SpecialTokensMixin):
|
|||||||
first_element = encoded_inputs["input_ids"][index][0]
|
first_element = encoded_inputs["input_ids"][index][0]
|
||||||
# At this state, if `first_element` is still a list/tuple, it's an empty one so there is nothing to do.
|
# At this state, if `first_element` is still a list/tuple, it's an empty one so there is nothing to do.
|
||||||
if not isinstance(first_element, (int, list, tuple)):
|
if not isinstance(first_element, (int, list, tuple)):
|
||||||
if is_tf_available() and isinstance(first_element, tf.Tensor):
|
if is_tf_available() and _is_tensorflow(first_element):
|
||||||
return_tensors = "tf" if return_tensors is None else return_tensors
|
return_tensors = "tf" if return_tensors is None else return_tensors
|
||||||
elif is_torch_available() and isinstance(first_element, torch.Tensor):
|
elif is_torch_available() and _is_torch(first_element):
|
||||||
return_tensors = "pt" if return_tensors is None else return_tensors
|
return_tensors = "pt" if return_tensors is None else return_tensors
|
||||||
elif isinstance(first_element, np.ndarray):
|
elif isinstance(first_element, np.ndarray):
|
||||||
return_tensors = "np" if return_tensors is None else return_tensors
|
return_tensors = "np" if return_tensors is None else return_tensors
|
||||||
|
|||||||
@@ -15,14 +15,78 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
{%- if cookiecutter.generate_tensorflow_and_pytorch == "PyTorch & TensorFlow" %}
|
{%- if cookiecutter.generate_tensorflow_and_pytorch == "PyTorch & TensorFlow" %}
|
||||||
from ...file_utils import is_tf_available, is_torch_available, is_tokenizers_available
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_torch_available, is_tokenizers_available
|
||||||
{%- elif cookiecutter.generate_tensorflow_and_pytorch == "PyTorch" %}
|
{%- elif cookiecutter.generate_tensorflow_and_pytorch == "PyTorch" %}
|
||||||
from ...file_utils import is_torch_available, is_tokenizers_available
|
from ...file_utils import _BaseLazyModule, is_torch_available, is_tokenizers_available
|
||||||
{%- elif cookiecutter.generate_tensorflow_and_pytorch == "TensorFlow" %}
|
{%- elif cookiecutter.generate_tensorflow_and_pytorch == "TensorFlow" %}
|
||||||
from ...file_utils import is_tf_available, is_tokenizers_available
|
from ...file_utils import _BaseLazyModule, is_tf_available, is_tokenizers_available
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
_import_structure = {
|
||||||
|
"configuration_{{cookiecutter.lowercase_modelname}}": ["{{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP", "{{cookiecutter.camelcase_modelname}}Config"],
|
||||||
|
"tokenization_{{cookiecutter.lowercase_modelname}}": ["{{cookiecutter.camelcase_modelname}}Tokenizer"],
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tokenizers_available():
|
||||||
|
_import_structure["tokenization_{{cookiecutter.lowercase_modelname}}_fast"] = ["{{cookiecutter.camelcase_modelname}}TokenizerFast"]
|
||||||
|
|
||||||
|
{%- if (cookiecutter.generate_tensorflow_and_pytorch == "PyTorch & TensorFlow" or cookiecutter.generate_tensorflow_and_pytorch == "PyTorch") %}
|
||||||
|
{% if cookiecutter.is_encoder_decoder_model == "False" %}
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_{{cookiecutter.lowercase_modelname}}"] = [
|
||||||
|
"{{cookiecutter.uppercase_modelname}}_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForMaskedLM",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForCausalLM",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForMultipleChoice",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForQuestionAnswering",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForSequenceClassification",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForTokenClassification",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}Layer",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}Model",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}PreTrainedModel",
|
||||||
|
"load_tf_weights_in_{{cookiecutter.lowercase_modelname}}",
|
||||||
|
]
|
||||||
|
{% else %}
|
||||||
|
if is_torch_available():
|
||||||
|
_import_structure["modeling_{{cookiecutter.lowercase_modelname}}"] = [
|
||||||
|
"{{cookiecutter.uppercase_modelname}}_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForConditionalGeneration",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForQuestionAnswering",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}ForSequenceClassification",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}Model",
|
||||||
|
"{{cookiecutter.camelcase_modelname}}PreTrainedModel",
|
||||||
|
]
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{%- if (cookiecutter.generate_tensorflow_and_pytorch == "PyTorch & TensorFlow" or cookiecutter.generate_tensorflow_and_pytorch == "TensorFlow") %}
|
||||||
|
{% if cookiecutter.is_encoder_decoder_model == "False" %}
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_{{cookiecutter.lowercase_modelname}}"] = [
|
||||||
|
"TF_{{cookiecutter.uppercase_modelname}}_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}ForMaskedLM",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}ForCausalLM",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}ForMultipleChoice",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}ForQuestionAnswering",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}ForSequenceClassification",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}ForTokenClassification",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}Layer",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}Model",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}PreTrainedModel",
|
||||||
|
]
|
||||||
|
{% else %}
|
||||||
|
if is_tf_available():
|
||||||
|
_import_structure["modeling_tf_{{cookiecutter.lowercase_modelname}}"] = [
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}ForConditionalGeneration",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}Model",
|
||||||
|
"TF{{cookiecutter.camelcase_modelname}}PreTrainedModel",
|
||||||
|
]
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, {{cookiecutter.camelcase_modelname}}Config
|
from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, {{cookiecutter.camelcase_modelname}}Config
|
||||||
from .tokenization_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.camelcase_modelname}}Tokenizer
|
from .tokenization_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.camelcase_modelname}}Tokenizer
|
||||||
|
|
||||||
@@ -81,3 +145,20 @@ if is_tf_available():
|
|||||||
)
|
)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
else:
|
||||||
|
import importlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class _LazyModule(_BaseLazyModule):
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user