Applies the rest of the init refactor except to modular files (#35238)
* [test_all] Applies the rest of the init refactor except to modular files * Revert modular that doesn't work * [test_all] TFGPT2Tokenizer
This commit is contained in:
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_audio_spectrogram_transformer import *
|
from .configuration_audio_spectrogram_transformer import *
|
||||||
from .convert_audio_spectrogram_transformer_original_to_pytorch import *
|
|
||||||
from .feature_extraction_audio_spectrogram_transformer import *
|
from .feature_extraction_audio_spectrogram_transformer import *
|
||||||
from .modeling_audio_spectrogram_transformer import *
|
from .modeling_audio_spectrogram_transformer import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_bark import *
|
from .configuration_bark import *
|
||||||
from .convert_suno_to_hf import *
|
|
||||||
from .generation_configuration_bark import *
|
|
||||||
from .modeling_bark import *
|
from .modeling_bark import *
|
||||||
from .processing_bark import *
|
from .processing_bark import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_bart import *
|
from .configuration_bart import *
|
||||||
from .convert_bart_original_pytorch_checkpoint_to_pytorch import *
|
|
||||||
from .modeling_bart import *
|
from .modeling_bart import *
|
||||||
from .modeling_flax_bart import *
|
from .modeling_flax_bart import *
|
||||||
from .modeling_tf_bart import *
|
from .modeling_tf_bart import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_beit import *
|
from .configuration_beit import *
|
||||||
from .convert_beit_unilm_to_pytorch import *
|
|
||||||
from .feature_extraction_beit import *
|
from .feature_extraction_beit import *
|
||||||
from .image_processing_beit import *
|
from .image_processing_beit import *
|
||||||
from .modeling_beit import *
|
from .modeling_beit import *
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_bert import *
|
from .configuration_bert import *
|
||||||
from .convert_bert_original_tf2_checkpoint_to_pytorch import *
|
|
||||||
from .convert_bert_original_tf_checkpoint_to_pytorch import *
|
|
||||||
from .convert_bert_pytorch_checkpoint_to_original_tf import *
|
|
||||||
from .convert_bert_token_dropping_original_tf2_checkpoint_to_pytorch import *
|
|
||||||
from .modeling_bert import *
|
from .modeling_bert import *
|
||||||
from .modeling_flax_bert import *
|
from .modeling_flax_bert import *
|
||||||
from .modeling_tf_bert import *
|
from .modeling_tf_bert import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_big_bird import *
|
from .configuration_big_bird import *
|
||||||
from .convert_bigbird_original_tf_checkpoint_to_pytorch import *
|
|
||||||
from .modeling_big_bird import *
|
from .modeling_big_bird import *
|
||||||
from .modeling_flax_big_bird import *
|
from .modeling_flax_big_bird import *
|
||||||
from .tokenization_big_bird import *
|
from .tokenization_big_bird import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_bigbird_pegasus import *
|
from .configuration_bigbird_pegasus import *
|
||||||
from .convert_bigbird_pegasus_tf_to_pytorch import *
|
|
||||||
from .modeling_bigbird_pegasus import *
|
from .modeling_bigbird_pegasus import *
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_biogpt import *
|
from .configuration_biogpt import *
|
||||||
from .convert_biogpt_original_pytorch_checkpoint_to_pytorch import *
|
|
||||||
from .modeling_biogpt import *
|
from .modeling_biogpt import *
|
||||||
from .tokenization_biogpt import *
|
from .tokenization_biogpt import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_bit import *
|
from .configuration_bit import *
|
||||||
from .convert_bit_to_pytorch import *
|
|
||||||
from .image_processing_bit import *
|
from .image_processing_bit import *
|
||||||
from .modeling_bit import *
|
from .modeling_bit import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_blenderbot import *
|
from .configuration_blenderbot import *
|
||||||
from .convert_blenderbot_original_pytorch_checkpoint_to_pytorch import *
|
|
||||||
from .modeling_blenderbot import *
|
from .modeling_blenderbot import *
|
||||||
from .modeling_flax_blenderbot import *
|
from .modeling_flax_blenderbot import *
|
||||||
from .modeling_tf_blenderbot import *
|
from .modeling_tf_blenderbot import *
|
||||||
|
|||||||
@@ -19,12 +19,9 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_blip import *
|
from .configuration_blip import *
|
||||||
from .convert_blip_original_pytorch_to_hf import *
|
|
||||||
from .image_processing_blip import *
|
from .image_processing_blip import *
|
||||||
from .modeling_blip import *
|
from .modeling_blip import *
|
||||||
from .modeling_blip_text import *
|
|
||||||
from .modeling_tf_blip import *
|
from .modeling_tf_blip import *
|
||||||
from .modeling_tf_blip_text import *
|
|
||||||
from .processing_blip import *
|
from .processing_blip import *
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_blip_2 import *
|
from .configuration_blip_2 import *
|
||||||
from .convert_blip_2_original_to_pytorch import *
|
|
||||||
from .modeling_blip_2 import *
|
from .modeling_blip_2 import *
|
||||||
from .processing_blip_2 import *
|
from .processing_blip_2 import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_bloom import *
|
from .configuration_bloom import *
|
||||||
from .convert_bloom_original_checkpoint_to_pytorch import *
|
|
||||||
from .modeling_bloom import *
|
from .modeling_bloom import *
|
||||||
from .modeling_flax_bloom import *
|
from .modeling_flax_bloom import *
|
||||||
from .tokenization_bloom_fast import *
|
from .tokenization_bloom_fast import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_bros import *
|
from .configuration_bros import *
|
||||||
from .convert_bros_to_pytorch import *
|
|
||||||
from .modeling_bros import *
|
from .modeling_bros import *
|
||||||
from .processing_bros import *
|
from .processing_bros import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .convert_byt5_original_tf_checkpoint_to_pytorch import *
|
|
||||||
from .tokenization_byt5 import *
|
from .tokenization_byt5 import *
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_canine import *
|
from .configuration_canine import *
|
||||||
from .convert_canine_original_tf_checkpoint_to_pytorch import *
|
|
||||||
from .modeling_canine import *
|
from .modeling_canine import *
|
||||||
from .tokenization_canine import *
|
from .tokenization_canine import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_chameleon import *
|
from .configuration_chameleon import *
|
||||||
from .convert_chameleon_weights_to_hf import *
|
|
||||||
from .image_processing_chameleon import *
|
from .image_processing_chameleon import *
|
||||||
from .modeling_chameleon import *
|
from .modeling_chameleon import *
|
||||||
from .processing_chameleon import *
|
from .processing_chameleon import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_chinese_clip import *
|
from .configuration_chinese_clip import *
|
||||||
from .convert_chinese_clip_original_pytorch_to_hf import *
|
|
||||||
from .feature_extraction_chinese_clip import *
|
from .feature_extraction_chinese_clip import *
|
||||||
from .image_processing_chinese_clip import *
|
from .image_processing_chinese_clip import *
|
||||||
from .modeling_chinese_clip import *
|
from .modeling_chinese_clip import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_clap import *
|
from .configuration_clap import *
|
||||||
from .convert_clap_original_pytorch_to_hf import *
|
|
||||||
from .feature_extraction_clap import *
|
from .feature_extraction_clap import *
|
||||||
from .modeling_clap import *
|
from .modeling_clap import *
|
||||||
from .processing_clap import *
|
from .processing_clap import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_clip import *
|
from .configuration_clip import *
|
||||||
from .convert_clip_original_pytorch_to_hf import *
|
|
||||||
from .feature_extraction_clip import *
|
from .feature_extraction_clip import *
|
||||||
from .image_processing_clip import *
|
from .image_processing_clip import *
|
||||||
from .modeling_clip import *
|
from .modeling_clip import *
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from ...utils.import_utils import define_import_structure
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_clipseg import *
|
from .configuration_clipseg import *
|
||||||
from .convert_clipseg_original_pytorch_to_hf import *
|
|
||||||
from .modeling_clipseg import *
|
from .modeling_clipseg import *
|
||||||
from .processing_clipseg import *
|
from .processing_clipseg import *
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2023 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -13,67 +13,18 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import (
|
from ...utils import _LazyModule
|
||||||
OptionalDependencyNotAvailable,
|
from ...utils.import_utils import define_import_structure
|
||||||
_LazyModule,
|
|
||||||
is_torch_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_clvp": [
|
|
||||||
"ClvpConfig",
|
|
||||||
"ClvpDecoderConfig",
|
|
||||||
"ClvpEncoderConfig",
|
|
||||||
],
|
|
||||||
"feature_extraction_clvp": ["ClvpFeatureExtractor"],
|
|
||||||
"processing_clvp": ["ClvpProcessor"],
|
|
||||||
"tokenization_clvp": ["ClvpTokenizer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_clvp"] = [
|
|
||||||
"ClvpModelForConditionalGeneration",
|
|
||||||
"ClvpForCausalLM",
|
|
||||||
"ClvpModel",
|
|
||||||
"ClvpPreTrainedModel",
|
|
||||||
"ClvpEncoder",
|
|
||||||
"ClvpDecoder",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_clvp import (
|
from .configuration_clvp import *
|
||||||
ClvpConfig,
|
from .feature_extraction_clvp import *
|
||||||
ClvpDecoderConfig,
|
from .modeling_clvp import *
|
||||||
ClvpEncoderConfig,
|
from .processing_clvp import *
|
||||||
)
|
from .tokenization_clvp import *
|
||||||
from .feature_extraction_clvp import ClvpFeatureExtractor
|
|
||||||
from .processing_clvp import ClvpProcessor
|
|
||||||
from .tokenization_clvp import ClvpTokenizer
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_clvp import (
|
|
||||||
ClvpDecoder,
|
|
||||||
ClvpEncoder,
|
|
||||||
ClvpForCausalLM,
|
|
||||||
ClvpModel,
|
|
||||||
ClvpModelForConditionalGeneration,
|
|
||||||
ClvpPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -438,3 +438,6 @@ class ClvpConfig(PretrainedConfig):
|
|||||||
decoder_config=decoder_config.to_dict(),
|
decoder_config=decoder_config.to_dict(),
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ClvpConfig", "ClvpDecoderConfig", "ClvpEncoderConfig"]
|
||||||
|
|||||||
@@ -236,3 +236,6 @@ class ClvpFeatureExtractor(SequenceFeatureExtractor):
|
|||||||
padded_inputs["input_features"] = input_features
|
padded_inputs["input_features"] = input_features
|
||||||
|
|
||||||
return padded_inputs.convert_to_tensors(return_tensors)
|
return padded_inputs.convert_to_tensors(return_tensors)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ClvpFeatureExtractor"]
|
||||||
|
|||||||
@@ -2021,3 +2021,13 @@ class ClvpModelForConditionalGeneration(ClvpPreTrainedModel, GenerationMixin):
|
|||||||
text_encoder_hidden_states=text_outputs.hidden_states,
|
text_encoder_hidden_states=text_outputs.hidden_states,
|
||||||
speech_encoder_hidden_states=speech_outputs.hidden_states,
|
speech_encoder_hidden_states=speech_outputs.hidden_states,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"ClvpModelForConditionalGeneration",
|
||||||
|
"ClvpForCausalLM",
|
||||||
|
"ClvpModel",
|
||||||
|
"ClvpPreTrainedModel",
|
||||||
|
"ClvpEncoder",
|
||||||
|
"ClvpDecoder",
|
||||||
|
]
|
||||||
|
|||||||
@@ -88,3 +88,6 @@ class ClvpProcessor(ProcessorMixin):
|
|||||||
the docstring of this method for more information.
|
the docstring of this method for more information.
|
||||||
"""
|
"""
|
||||||
return self.tokenizer.decode(*args, **kwargs)
|
return self.tokenizer.decode(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ClvpProcessor"]
|
||||||
|
|||||||
@@ -362,3 +362,6 @@ class ClvpTokenizer(PreTrainedTokenizer):
|
|||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
return vocab_file, merge_file
|
return vocab_file, merge_file
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ClvpTokenizer"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2023 MetaAI and The HuggingFace Inc. team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -13,45 +13,15 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_sentencepiece_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_code_llama"] = ["CodeLlamaTokenizer"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_code_llama_fast"] = ["CodeLlamaTokenizerFast"]
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
try:
|
from .tokenization_code_llama import *
|
||||||
if not is_sentencepiece_available():
|
from .tokenization_code_llama_fast import *
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_code_llama import CodeLlamaTokenizer
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_code_llama_fast import CodeLlamaTokenizerFast
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -447,3 +447,6 @@ class CodeLlamaTokenizer(PreTrainedTokenizer):
|
|||||||
self.__dict__ = d
|
self.__dict__ = d
|
||||||
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
||||||
self.sp_model.LoadFromSerializedProto(self.sp_model_proto)
|
self.sp_model.LoadFromSerializedProto(self.sp_model_proto)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CodeLlamaTokenizer"]
|
||||||
|
|||||||
@@ -376,3 +376,6 @@ class CodeLlamaTokenizerFast(PreTrainedTokenizerFast):
|
|||||||
if token_ids_1 is None:
|
if token_ids_1 is None:
|
||||||
return self.bos_token_id + token_ids_0 + self.eos_token_id
|
return self.bos_token_id + token_ids_0 + self.eos_token_id
|
||||||
return self.bos_token_id + token_ids_0 + token_ids_1 + self.eos_token_id
|
return self.bos_token_id + token_ids_0 + token_ids_1 + self.eos_token_id
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CodeLlamaTokenizerFast"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2022 Salesforce authors, The EleutherAI, and HuggingFace Teams. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -13,59 +13,17 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_codegen": ["CodeGenConfig", "CodeGenOnnxConfig"],
|
|
||||||
"tokenization_codegen": ["CodeGenTokenizer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_codegen_fast"] = ["CodeGenTokenizerFast"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_codegen"] = [
|
|
||||||
"CodeGenForCausalLM",
|
|
||||||
"CodeGenModel",
|
|
||||||
"CodeGenPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_codegen import CodeGenConfig, CodeGenOnnxConfig
|
from .configuration_codegen import *
|
||||||
from .tokenization_codegen import CodeGenTokenizer
|
from .modeling_codegen import *
|
||||||
|
from .tokenization_codegen import *
|
||||||
try:
|
from .tokenization_codegen_fast import *
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_codegen_fast import CodeGenTokenizerFast
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_codegen import (
|
|
||||||
CodeGenForCausalLM,
|
|
||||||
CodeGenModel,
|
|
||||||
CodeGenPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -225,3 +225,6 @@ class CodeGenOnnxConfig(OnnxConfigWithPast):
|
|||||||
@property
|
@property
|
||||||
def default_onnx_opset(self) -> int:
|
def default_onnx_opset(self) -> int:
|
||||||
return 13
|
return 13
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CodeGenConfig", "CodeGenOnnxConfig"]
|
||||||
|
|||||||
@@ -809,3 +809,6 @@ class CodeGenForCausalLM(CodeGenPreTrainedModel, GenerationMixin):
|
|||||||
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past)
|
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past)
|
||||||
for layer_past in past_key_values
|
for layer_past in past_key_values
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CodeGenForCausalLM", "CodeGenModel", "CodeGenPreTrainedModel"]
|
||||||
|
|||||||
@@ -414,3 +414,6 @@ class CodeGenTokenizer(PreTrainedTokenizer):
|
|||||||
return completion[: min(terminals_pos)]
|
return completion[: min(terminals_pos)]
|
||||||
else:
|
else:
|
||||||
return completion
|
return completion
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CodeGenTokenizer"]
|
||||||
|
|||||||
@@ -270,3 +270,6 @@ class CodeGenTokenizerFast(PreTrainedTokenizerFast):
|
|||||||
return completion[: min(terminals_pos)]
|
return completion[: min(terminals_pos)]
|
||||||
else:
|
else:
|
||||||
return completion
|
return completion
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CodeGenTokenizerFast"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2024 Cohere and The HuggingFace Inc. team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -13,65 +13,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import (
|
from ...utils import _LazyModule
|
||||||
OptionalDependencyNotAvailable,
|
from ...utils.import_utils import define_import_structure
|
||||||
_LazyModule,
|
|
||||||
is_sentencepiece_available,
|
|
||||||
is_tokenizers_available,
|
|
||||||
is_torch_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_cohere": ["CohereConfig"],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_cohere_fast"] = ["CohereTokenizerFast"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_cohere"] = [
|
|
||||||
"CohereForCausalLM",
|
|
||||||
"CohereModel",
|
|
||||||
"CoherePreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_cohere import CohereConfig
|
from .configuration_cohere import *
|
||||||
|
from .modeling_cohere import *
|
||||||
try:
|
from .tokenization_cohere_fast import *
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_cohere_fast import CohereTokenizerFast
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_cohere import (
|
|
||||||
CohereForCausalLM,
|
|
||||||
CohereModel,
|
|
||||||
CoherePreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -198,3 +198,6 @@ class CohereConfig(PretrainedConfig):
|
|||||||
tie_word_embeddings=tie_word_embeddings,
|
tie_word_embeddings=tie_word_embeddings,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CohereConfig"]
|
||||||
|
|||||||
@@ -1145,3 +1145,6 @@ class CohereForCausalLM(CoherePreTrainedModel, GenerationMixin):
|
|||||||
hidden_states=outputs.hidden_states,
|
hidden_states=outputs.hidden_states,
|
||||||
attentions=outputs.attentions,
|
attentions=outputs.attentions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CohereForCausalLM", "CohereModel", "CoherePreTrainedModel"]
|
||||||
|
|||||||
@@ -510,3 +510,6 @@ class CohereTokenizerFast(PreTrainedTokenizerFast):
|
|||||||
output = output + bos_token_id + token_ids_1 + eos_token_id
|
output = output + bos_token_id + token_ids_1 + eos_token_id
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CohereTokenizerFast"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2022 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -11,71 +11,19 @@
|
|||||||
# 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
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_conditional_detr": [
|
|
||||||
"ConditionalDetrConfig",
|
|
||||||
"ConditionalDetrOnnxConfig",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_vision_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["feature_extraction_conditional_detr"] = ["ConditionalDetrFeatureExtractor"]
|
|
||||||
_import_structure["image_processing_conditional_detr"] = ["ConditionalDetrImageProcessor"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_conditional_detr"] = [
|
|
||||||
"ConditionalDetrForObjectDetection",
|
|
||||||
"ConditionalDetrForSegmentation",
|
|
||||||
"ConditionalDetrModel",
|
|
||||||
"ConditionalDetrPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_conditional_detr import (
|
from .configuration_conditional_detr import *
|
||||||
ConditionalDetrConfig,
|
from .feature_extraction_conditional_detr import *
|
||||||
ConditionalDetrOnnxConfig,
|
from .image_processing_conditional_detr import *
|
||||||
)
|
from .modeling_conditional_detr import *
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_vision_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .feature_extraction_conditional_detr import ConditionalDetrFeatureExtractor
|
|
||||||
from .image_processing_conditional_detr import ConditionalDetrImageProcessor
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_conditional_detr import (
|
|
||||||
ConditionalDetrForObjectDetection,
|
|
||||||
ConditionalDetrForSegmentation,
|
|
||||||
ConditionalDetrModel,
|
|
||||||
ConditionalDetrPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -273,3 +273,6 @@ class ConditionalDetrOnnxConfig(OnnxConfig):
|
|||||||
@property
|
@property
|
||||||
def default_onnx_opset(self) -> int:
|
def default_onnx_opset(self) -> int:
|
||||||
return 12
|
return 12
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConditionalDetrConfig", "ConditionalDetrOnnxConfig"]
|
||||||
|
|||||||
@@ -41,3 +41,6 @@ class ConditionalDetrFeatureExtractor(ConditionalDetrImageProcessor):
|
|||||||
FutureWarning,
|
FutureWarning,
|
||||||
)
|
)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConditionalDetrFeatureExtractor"]
|
||||||
|
|||||||
@@ -1851,3 +1851,6 @@ class ConditionalDetrImageProcessor(BaseImageProcessor):
|
|||||||
|
|
||||||
results.append({"segmentation": segmentation, "segments_info": segments})
|
results.append({"segmentation": segmentation, "segments_info": segments})
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConditionalDetrImageProcessor"]
|
||||||
|
|||||||
@@ -2105,3 +2105,11 @@ class ConditionalDetrMHAttentionMap(nn.Module):
|
|||||||
weights = nn.functional.softmax(weights.flatten(2), dim=-1).view(weights.size())
|
weights = nn.functional.softmax(weights.flatten(2), dim=-1).view(weights.size())
|
||||||
weights = self.dropout(weights)
|
weights = self.dropout(weights)
|
||||||
return weights
|
return weights
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"ConditionalDetrForObjectDetection",
|
||||||
|
"ConditionalDetrForSegmentation",
|
||||||
|
"ConditionalDetrModel",
|
||||||
|
"ConditionalDetrPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2020 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -13,114 +13,18 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import (
|
from ...utils import _LazyModule
|
||||||
OptionalDependencyNotAvailable,
|
from ...utils.import_utils import define_import_structure
|
||||||
_LazyModule,
|
|
||||||
is_tf_available,
|
|
||||||
is_tokenizers_available,
|
|
||||||
is_torch_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_convbert": ["ConvBertConfig", "ConvBertOnnxConfig"],
|
|
||||||
"tokenization_convbert": ["ConvBertTokenizer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_convbert_fast"] = ["ConvBertTokenizerFast"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_convbert"] = [
|
|
||||||
"ConvBertForMaskedLM",
|
|
||||||
"ConvBertForMultipleChoice",
|
|
||||||
"ConvBertForQuestionAnswering",
|
|
||||||
"ConvBertForSequenceClassification",
|
|
||||||
"ConvBertForTokenClassification",
|
|
||||||
"ConvBertLayer",
|
|
||||||
"ConvBertModel",
|
|
||||||
"ConvBertPreTrainedModel",
|
|
||||||
"load_tf_weights_in_convbert",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_tf_convbert"] = [
|
|
||||||
"TFConvBertForMaskedLM",
|
|
||||||
"TFConvBertForMultipleChoice",
|
|
||||||
"TFConvBertForQuestionAnswering",
|
|
||||||
"TFConvBertForSequenceClassification",
|
|
||||||
"TFConvBertForTokenClassification",
|
|
||||||
"TFConvBertLayer",
|
|
||||||
"TFConvBertModel",
|
|
||||||
"TFConvBertPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_convbert import ConvBertConfig, ConvBertOnnxConfig
|
from .configuration_convbert import *
|
||||||
from .tokenization_convbert import ConvBertTokenizer
|
from .modeling_convbert import *
|
||||||
|
from .modeling_tf_convbert import *
|
||||||
try:
|
from .tokenization_convbert import *
|
||||||
if not is_tokenizers_available():
|
from .tokenization_convbert_fast import *
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_convbert_fast import ConvBertTokenizerFast
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_convbert import (
|
|
||||||
ConvBertForMaskedLM,
|
|
||||||
ConvBertForMultipleChoice,
|
|
||||||
ConvBertForQuestionAnswering,
|
|
||||||
ConvBertForSequenceClassification,
|
|
||||||
ConvBertForTokenClassification,
|
|
||||||
ConvBertLayer,
|
|
||||||
ConvBertModel,
|
|
||||||
ConvBertPreTrainedModel,
|
|
||||||
load_tf_weights_in_convbert,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_tf_convbert import (
|
|
||||||
TFConvBertForMaskedLM,
|
|
||||||
TFConvBertForMultipleChoice,
|
|
||||||
TFConvBertForQuestionAnswering,
|
|
||||||
TFConvBertForSequenceClassification,
|
|
||||||
TFConvBertForTokenClassification,
|
|
||||||
TFConvBertLayer,
|
|
||||||
TFConvBertModel,
|
|
||||||
TFConvBertPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -155,3 +155,6 @@ class ConvBertOnnxConfig(OnnxConfig):
|
|||||||
("token_type_ids", dynamic_axis),
|
("token_type_ids", dynamic_axis),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvBertConfig", "ConvBertOnnxConfig"]
|
||||||
|
|||||||
@@ -1331,3 +1331,16 @@ class ConvBertForQuestionAnswering(ConvBertPreTrainedModel):
|
|||||||
hidden_states=outputs.hidden_states,
|
hidden_states=outputs.hidden_states,
|
||||||
attentions=outputs.attentions,
|
attentions=outputs.attentions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"ConvBertForMaskedLM",
|
||||||
|
"ConvBertForMultipleChoice",
|
||||||
|
"ConvBertForQuestionAnswering",
|
||||||
|
"ConvBertForSequenceClassification",
|
||||||
|
"ConvBertForTokenClassification",
|
||||||
|
"ConvBertLayer",
|
||||||
|
"ConvBertModel",
|
||||||
|
"ConvBertPreTrainedModel",
|
||||||
|
"load_tf_weights_in_convbert",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1462,3 +1462,15 @@ class TFConvBertForQuestionAnswering(TFConvBertPreTrainedModel, TFQuestionAnswer
|
|||||||
if getattr(self, "qa_outputs", None) is not None:
|
if getattr(self, "qa_outputs", None) is not None:
|
||||||
with tf.name_scope(self.qa_outputs.name):
|
with tf.name_scope(self.qa_outputs.name):
|
||||||
self.qa_outputs.build([None, None, self.config.hidden_size])
|
self.qa_outputs.build([None, None, self.config.hidden_size])
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"TFConvBertForMaskedLM",
|
||||||
|
"TFConvBertForMultipleChoice",
|
||||||
|
"TFConvBertForQuestionAnswering",
|
||||||
|
"TFConvBertForSequenceClassification",
|
||||||
|
"TFConvBertForTokenClassification",
|
||||||
|
"TFConvBertLayer",
|
||||||
|
"TFConvBertModel",
|
||||||
|
"TFConvBertPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -507,3 +507,6 @@ class WordpieceTokenizer:
|
|||||||
else:
|
else:
|
||||||
output_tokens.extend(sub_tokens)
|
output_tokens.extend(sub_tokens)
|
||||||
return output_tokens
|
return output_tokens
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvBertTokenizer"]
|
||||||
|
|||||||
@@ -171,3 +171,6 @@ class ConvBertTokenizerFast(PreTrainedTokenizerFast):
|
|||||||
def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
|
def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
|
||||||
files = self._tokenizer.model.save(save_directory, name=filename_prefix)
|
files = self._tokenizer.model.save(save_directory, name=filename_prefix)
|
||||||
return tuple(files)
|
return tuple(files)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvBertTokenizerFast"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2022 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -13,86 +13,18 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import (
|
from ...utils import _LazyModule
|
||||||
OptionalDependencyNotAvailable,
|
from ...utils.import_utils import define_import_structure
|
||||||
_LazyModule,
|
|
||||||
is_tf_available,
|
|
||||||
is_torch_available,
|
|
||||||
is_vision_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {"configuration_convnext": ["ConvNextConfig", "ConvNextOnnxConfig"]}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_vision_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["feature_extraction_convnext"] = ["ConvNextFeatureExtractor"]
|
|
||||||
_import_structure["image_processing_convnext"] = ["ConvNextImageProcessor"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_convnext"] = [
|
|
||||||
"ConvNextForImageClassification",
|
|
||||||
"ConvNextModel",
|
|
||||||
"ConvNextPreTrainedModel",
|
|
||||||
"ConvNextBackbone",
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_tf_convnext"] = [
|
|
||||||
"TFConvNextForImageClassification",
|
|
||||||
"TFConvNextModel",
|
|
||||||
"TFConvNextPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_convnext import ConvNextConfig, ConvNextOnnxConfig
|
from .configuration_convnext import *
|
||||||
|
from .feature_extraction_convnext import *
|
||||||
try:
|
from .image_processing_convnext import *
|
||||||
if not is_vision_available():
|
from .modeling_convnext import *
|
||||||
raise OptionalDependencyNotAvailable()
|
from .modeling_tf_convnext import *
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .feature_extraction_convnext import ConvNextFeatureExtractor
|
|
||||||
from .image_processing_convnext import ConvNextImageProcessor
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_convnext import (
|
|
||||||
ConvNextBackbone,
|
|
||||||
ConvNextForImageClassification,
|
|
||||||
ConvNextModel,
|
|
||||||
ConvNextPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_tf_convnext import TFConvNextForImageClassification, TFConvNextModel, TFConvNextPreTrainedModel
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -137,3 +137,6 @@ class ConvNextOnnxConfig(OnnxConfig):
|
|||||||
@property
|
@property
|
||||||
def atol_for_validation(self) -> float:
|
def atol_for_validation(self) -> float:
|
||||||
return 1e-5
|
return 1e-5
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvNextConfig", "ConvNextOnnxConfig"]
|
||||||
|
|||||||
@@ -31,3 +31,6 @@ class ConvNextFeatureExtractor(ConvNextImageProcessor):
|
|||||||
FutureWarning,
|
FutureWarning,
|
||||||
)
|
)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvNextFeatureExtractor"]
|
||||||
|
|||||||
@@ -318,3 +318,6 @@ class ConvNextImageProcessor(BaseImageProcessor):
|
|||||||
|
|
||||||
data = {"pixel_values": images}
|
data = {"pixel_values": images}
|
||||||
return BatchFeature(data=data, tensor_type=return_tensors)
|
return BatchFeature(data=data, tensor_type=return_tensors)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvNextImageProcessor"]
|
||||||
|
|||||||
@@ -546,3 +546,6 @@ class ConvNextBackbone(ConvNextPreTrainedModel, BackboneMixin):
|
|||||||
hidden_states=hidden_states if output_hidden_states else None,
|
hidden_states=hidden_states if output_hidden_states else None,
|
||||||
attentions=None,
|
attentions=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvNextForImageClassification", "ConvNextModel", "ConvNextPreTrainedModel", "ConvNextBackbone"]
|
||||||
|
|||||||
@@ -664,3 +664,6 @@ class TFConvNextForImageClassification(TFConvNextPreTrainedModel, TFSequenceClas
|
|||||||
if hasattr(self.classifier, "name"):
|
if hasattr(self.classifier, "name"):
|
||||||
with tf.name_scope(self.classifier.name):
|
with tf.name_scope(self.classifier.name):
|
||||||
self.classifier.build([None, None, self.config.hidden_sizes[-1]])
|
self.classifier.build([None, None, self.config.hidden_sizes[-1]])
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["TFConvNextForImageClassification", "TFConvNextModel", "TFConvNextPreTrainedModel"]
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
# flake8: noqa
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
# There's no way to ignore "F401 '...' imported but unused" warnings in this
|
|
||||||
# module, but to preserve other warnings. So, don't check this module at all.
|
|
||||||
|
|
||||||
# Copyright 2023 The HuggingFace Team. All rights reserved.
|
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -17,73 +13,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
# rely on isort to merge the imports
|
from ...utils import _LazyModule
|
||||||
from ...utils import (
|
from ...utils.import_utils import define_import_structure
|
||||||
OptionalDependencyNotAvailable,
|
|
||||||
_LazyModule,
|
|
||||||
is_torch_available,
|
|
||||||
is_tf_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {"configuration_convnextv2": ["ConvNextV2Config"]}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_convnextv2"] = [
|
|
||||||
"ConvNextV2ForImageClassification",
|
|
||||||
"ConvNextV2Model",
|
|
||||||
"ConvNextV2PreTrainedModel",
|
|
||||||
"ConvNextV2Backbone",
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_tf_convnextv2"] = [
|
|
||||||
"TFConvNextV2ForImageClassification",
|
|
||||||
"TFConvNextV2Model",
|
|
||||||
"TFConvNextV2PreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_convnextv2 import (
|
from .configuration_convnextv2 import *
|
||||||
ConvNextV2Config,
|
from .modeling_convnextv2 import *
|
||||||
)
|
from .modeling_tf_convnextv2 import *
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_convnextv2 import (
|
|
||||||
ConvNextV2Backbone,
|
|
||||||
ConvNextV2ForImageClassification,
|
|
||||||
ConvNextV2Model,
|
|
||||||
ConvNextV2PreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_tf_convnextv2 import (
|
|
||||||
TFConvNextV2ForImageClassification,
|
|
||||||
TFConvNextV2Model,
|
|
||||||
TFConvNextV2PreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -113,3 +113,6 @@ class ConvNextV2Config(BackboneConfigMixin, PretrainedConfig):
|
|||||||
self._out_features, self._out_indices = get_aligned_output_features_output_indices(
|
self._out_features, self._out_indices = get_aligned_output_features_output_indices(
|
||||||
out_features=out_features, out_indices=out_indices, stage_names=self.stage_names
|
out_features=out_features, out_indices=out_indices, stage_names=self.stage_names
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvNextV2Config"]
|
||||||
|
|||||||
@@ -569,3 +569,6 @@ class ConvNextV2Backbone(ConvNextV2PreTrainedModel, BackboneMixin):
|
|||||||
hidden_states=hidden_states if output_hidden_states else None,
|
hidden_states=hidden_states if output_hidden_states else None,
|
||||||
attentions=None,
|
attentions=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["ConvNextV2ForImageClassification", "ConvNextV2Model", "ConvNextV2PreTrainedModel", "ConvNextV2Backbone"]
|
||||||
|
|||||||
@@ -678,3 +678,6 @@ class TFConvNextV2ForImageClassification(TFConvNextV2PreTrainedModel, TFSequence
|
|||||||
if getattr(self, "classifier", None) is not None:
|
if getattr(self, "classifier", None) is not None:
|
||||||
with tf.name_scope(self.classifier.name):
|
with tf.name_scope(self.classifier.name):
|
||||||
self.classifier.build([None, None, self.config.hidden_sizes[-1]])
|
self.classifier.build([None, None, self.config.hidden_sizes[-1]])
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["TFConvNextV2ForImageClassification", "TFConvNextV2Model", "TFConvNextV2PreTrainedModel"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2020 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -11,49 +11,17 @@
|
|||||||
# 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
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
_import_structure = {}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_sentencepiece_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_cpm"] = ["CpmTokenizer"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_cpm_fast"] = ["CpmTokenizerFast"]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
try:
|
from .tokenization_cpm import *
|
||||||
if not is_sentencepiece_available():
|
from .tokenization_cpm_fast import *
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_cpm import CpmTokenizer
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_cpm_fast import CpmTokenizerFast
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -343,3 +343,6 @@ class CpmTokenizer(PreTrainedTokenizer):
|
|||||||
text = super()._decode(*args, **kwargs)
|
text = super()._decode(*args, **kwargs)
|
||||||
text = text.replace(" ", "").replace("\u2582", " ").replace("\u2583", "\n")
|
text = text.replace(" ", "").replace("\u2582", " ").replace("\u2583", "\n")
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CpmTokenizer"]
|
||||||
|
|||||||
@@ -236,3 +236,6 @@ class CpmTokenizerFast(PreTrainedTokenizerFast):
|
|||||||
text = super()._decode(*args, **kwargs)
|
text = super()._decode(*args, **kwargs)
|
||||||
text = text.replace(" ", "").replace("\u2582", " ").replace("\u2583", "\n")
|
text = text.replace(" ", "").replace("\u2582", " ").replace("\u2583", "\n")
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CpmTokenizerFast"]
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
# flake8: noqa
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
# There's no way to ignore "F401 '...' imported but unused" warnings in this
|
|
||||||
# module, but to preserve other warnings. So, don't check this module at all.
|
|
||||||
|
|
||||||
# Copyright 2022 The HuggingFace Team and The OpenBMB Team. All rights reserved.
|
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -17,46 +13,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
# rely on isort to merge the imports
|
from ...utils import _LazyModule
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_cpmant": ["CpmAntConfig"],
|
|
||||||
"tokenization_cpmant": ["CpmAntTokenizer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_cpmant"] = [
|
|
||||||
"CpmAntForCausalLM",
|
|
||||||
"CpmAntModel",
|
|
||||||
"CpmAntPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_cpmant import CpmAntConfig
|
from .configuration_cpmant import *
|
||||||
from .tokenization_cpmant import CpmAntTokenizer
|
from .modeling_cpmant import *
|
||||||
|
from .tokenization_cpmant import *
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_cpmant import (
|
|
||||||
CpmAntForCausalLM,
|
|
||||||
CpmAntModel,
|
|
||||||
CpmAntPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -117,3 +117,6 @@ class CpmAntConfig(PretrainedConfig):
|
|||||||
self.use_cache = use_cache
|
self.use_cache = use_cache
|
||||||
self.vocab_size = vocab_size
|
self.vocab_size = vocab_size
|
||||||
self.init_std = init_std
|
self.init_std = init_std
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CpmAntConfig"]
|
||||||
|
|||||||
@@ -855,3 +855,6 @@ class CpmAntForCausalLM(CpmAntPreTrainedModel, GenerationMixin):
|
|||||||
key_value_layer[0] = key_value_layer[0][beam_idx]
|
key_value_layer[0] = key_value_layer[0][beam_idx]
|
||||||
key_value_layer[1] = key_value_layer[1][beam_idx]
|
key_value_layer[1] = key_value_layer[1][beam_idx]
|
||||||
return past_key_values
|
return past_key_values
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CpmAntForCausalLM", "CpmAntModel", "CpmAntPreTrainedModel"]
|
||||||
|
|||||||
@@ -265,3 +265,6 @@ class CpmAntTokenizer(PreTrainedTokenizer):
|
|||||||
if token_ids_1 is not None:
|
if token_ids_1 is not None:
|
||||||
return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1))
|
return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1))
|
||||||
return [1] + ([0] * len(token_ids_0))
|
return [1] + ([0] * len(token_ids_0))
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CpmAntTokenizer"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2020 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -11,75 +11,19 @@
|
|||||||
# 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
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_ctrl": ["CTRLConfig"],
|
|
||||||
"tokenization_ctrl": ["CTRLTokenizer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_ctrl"] = [
|
|
||||||
"CTRLForSequenceClassification",
|
|
||||||
"CTRLLMHeadModel",
|
|
||||||
"CTRLModel",
|
|
||||||
"CTRLPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_tf_ctrl"] = [
|
|
||||||
"TFCTRLForSequenceClassification",
|
|
||||||
"TFCTRLLMHeadModel",
|
|
||||||
"TFCTRLModel",
|
|
||||||
"TFCTRLPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_ctrl import CTRLConfig
|
from .configuration_ctrl import *
|
||||||
from .tokenization_ctrl import CTRLTokenizer
|
from .modeling_ctrl import *
|
||||||
|
from .modeling_tf_ctrl import *
|
||||||
try:
|
from .tokenization_ctrl import *
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_ctrl import (
|
|
||||||
CTRLForSequenceClassification,
|
|
||||||
CTRLLMHeadModel,
|
|
||||||
CTRLModel,
|
|
||||||
CTRLPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_tf_ctrl import (
|
|
||||||
TFCTRLForSequenceClassification,
|
|
||||||
TFCTRLLMHeadModel,
|
|
||||||
TFCTRLModel,
|
|
||||||
TFCTRLPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -111,3 +111,6 @@ class CTRLConfig(PretrainedConfig):
|
|||||||
self.use_cache = use_cache
|
self.use_cache = use_cache
|
||||||
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CTRLConfig"]
|
||||||
|
|||||||
@@ -839,3 +839,6 @@ class CTRLForSequenceClassification(CTRLPreTrainedModel):
|
|||||||
hidden_states=transformer_outputs.hidden_states,
|
hidden_states=transformer_outputs.hidden_states,
|
||||||
attentions=transformer_outputs.attentions,
|
attentions=transformer_outputs.attentions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CTRLForSequenceClassification", "CTRLLMHeadModel", "CTRLModel", "CTRLPreTrainedModel"]
|
||||||
|
|||||||
@@ -926,3 +926,6 @@ class TFCTRLForSequenceClassification(TFCTRLPreTrainedModel, TFSequenceClassific
|
|||||||
if getattr(self, "transformer", None) is not None:
|
if getattr(self, "transformer", None) is not None:
|
||||||
with tf.name_scope(self.transformer.name):
|
with tf.name_scope(self.transformer.name):
|
||||||
self.transformer.build(None)
|
self.transformer.build(None)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["TFCTRLForSequenceClassification", "TFCTRLLMHeadModel", "TFCTRLModel", "TFCTRLPreTrainedModel"]
|
||||||
|
|||||||
@@ -246,3 +246,6 @@ class CTRLTokenizer(PreTrainedTokenizer):
|
|||||||
# tokens_generated_so_far = re.sub('(@@ )', '', string=filtered_tokens)
|
# tokens_generated_so_far = re.sub('(@@ )', '', string=filtered_tokens)
|
||||||
# tokens_generated_so_far = re.sub('(@@ ?$)', '', string=tokens_generated_so_far)
|
# tokens_generated_so_far = re.sub('(@@ ?$)', '', string=tokens_generated_so_far)
|
||||||
# return ''.join(tokens_generated_so_far)
|
# return ''.join(tokens_generated_so_far)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CTRLTokenizer"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2022 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -13,65 +13,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {"configuration_cvt": ["CvtConfig"]}
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_cvt"] = [
|
|
||||||
"CvtForImageClassification",
|
|
||||||
"CvtModel",
|
|
||||||
"CvtPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_tf_cvt"] = [
|
|
||||||
"TFCvtForImageClassification",
|
|
||||||
"TFCvtModel",
|
|
||||||
"TFCvtPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_cvt import CvtConfig
|
from .configuration_cvt import *
|
||||||
|
from .modeling_cvt import *
|
||||||
try:
|
from .modeling_tf_cvt import *
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_cvt import (
|
|
||||||
CvtForImageClassification,
|
|
||||||
CvtModel,
|
|
||||||
CvtPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_tf_cvt import (
|
|
||||||
TFCvtForImageClassification,
|
|
||||||
TFCvtModel,
|
|
||||||
TFCvtPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -141,3 +141,6 @@ class CvtConfig(PretrainedConfig):
|
|||||||
self.stride_q = stride_q
|
self.stride_q = stride_q
|
||||||
self.initializer_range = initializer_range
|
self.initializer_range = initializer_range
|
||||||
self.layer_norm_eps = layer_norm_eps
|
self.layer_norm_eps = layer_norm_eps
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CvtConfig"]
|
||||||
|
|||||||
@@ -720,3 +720,6 @@ class CvtForImageClassification(CvtPreTrainedModel):
|
|||||||
return ((loss,) + output) if loss is not None else output
|
return ((loss,) + output) if loss is not None else output
|
||||||
|
|
||||||
return ImageClassifierOutputWithNoAttention(loss=loss, logits=logits, hidden_states=outputs.hidden_states)
|
return ImageClassifierOutputWithNoAttention(loss=loss, logits=logits, hidden_states=outputs.hidden_states)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CvtForImageClassification", "CvtModel", "CvtPreTrainedModel"]
|
||||||
|
|||||||
@@ -1091,3 +1091,6 @@ class TFCvtForImageClassification(TFCvtPreTrainedModel, TFSequenceClassification
|
|||||||
if hasattr(self.classifier, "name"):
|
if hasattr(self.classifier, "name"):
|
||||||
with tf.name_scope(self.classifier.name):
|
with tf.name_scope(self.classifier.name):
|
||||||
self.classifier.build([None, None, self.config.embed_dim[-1]])
|
self.classifier.build([None, None, self.config.embed_dim[-1]])
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["TFCvtForImageClassification", "TFCvtModel", "TFCvtPreTrainedModel"]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# coding=utf-8
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
# Copyright 2024 Descript and The HuggingFace Inc. team. All rights reserved.
|
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -14,47 +13,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import (
|
from ...utils import _LazyModule
|
||||||
OptionalDependencyNotAvailable,
|
from ...utils.import_utils import define_import_structure
|
||||||
_LazyModule,
|
|
||||||
is_torch_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_dac": ["DacConfig"],
|
|
||||||
"feature_extraction_dac": ["DacFeatureExtractor"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_dac"] = [
|
|
||||||
"DacModel",
|
|
||||||
"DacPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_dac import (
|
from .configuration_dac import *
|
||||||
DacConfig,
|
from .feature_extraction_dac import *
|
||||||
)
|
from .modeling_dac import *
|
||||||
from .feature_extraction_dac import DacFeatureExtractor
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_dac import (
|
|
||||||
DacModel,
|
|
||||||
DacPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -109,3 +109,6 @@ class DacConfig(PretrainedConfig):
|
|||||||
def frame_rate(self) -> int:
|
def frame_rate(self) -> int:
|
||||||
hop_length = np.prod(self.upsampling_ratios)
|
hop_length = np.prod(self.upsampling_ratios)
|
||||||
return math.ceil(self.sampling_rate / hop_length)
|
return math.ceil(self.sampling_rate / hop_length)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DacConfig"]
|
||||||
|
|||||||
@@ -168,3 +168,6 @@ class DacFeatureExtractor(SequenceFeatureExtractor):
|
|||||||
padded_inputs = padded_inputs.convert_to_tensors(return_tensors)
|
padded_inputs = padded_inputs.convert_to_tensors(return_tensors)
|
||||||
|
|
||||||
return padded_inputs
|
return padded_inputs
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DacFeatureExtractor"]
|
||||||
|
|||||||
@@ -719,3 +719,6 @@ class DacModel(DacPreTrainedModel):
|
|||||||
return (loss, audio_values, quantized_representation, audio_codes, projected_latents)
|
return (loss, audio_values, quantized_representation, audio_codes, projected_latents)
|
||||||
|
|
||||||
return DacOutput(loss, audio_values, quantized_representation, audio_codes, projected_latents)
|
return DacOutput(loss, audio_values, quantized_representation, audio_codes, projected_latents)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DacModel", "DacPreTrainedModel"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2022 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -11,115 +11,22 @@
|
|||||||
# 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
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_data2vec_audio": ["Data2VecAudioConfig"],
|
|
||||||
"configuration_data2vec_text": [
|
|
||||||
"Data2VecTextConfig",
|
|
||||||
"Data2VecTextOnnxConfig",
|
|
||||||
],
|
|
||||||
"configuration_data2vec_vision": [
|
|
||||||
"Data2VecVisionConfig",
|
|
||||||
"Data2VecVisionOnnxConfig",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_data2vec_audio"] = [
|
|
||||||
"Data2VecAudioForAudioFrameClassification",
|
|
||||||
"Data2VecAudioForCTC",
|
|
||||||
"Data2VecAudioForSequenceClassification",
|
|
||||||
"Data2VecAudioForXVector",
|
|
||||||
"Data2VecAudioModel",
|
|
||||||
"Data2VecAudioPreTrainedModel",
|
|
||||||
]
|
|
||||||
_import_structure["modeling_data2vec_text"] = [
|
|
||||||
"Data2VecTextForCausalLM",
|
|
||||||
"Data2VecTextForMaskedLM",
|
|
||||||
"Data2VecTextForMultipleChoice",
|
|
||||||
"Data2VecTextForQuestionAnswering",
|
|
||||||
"Data2VecTextForSequenceClassification",
|
|
||||||
"Data2VecTextForTokenClassification",
|
|
||||||
"Data2VecTextModel",
|
|
||||||
"Data2VecTextPreTrainedModel",
|
|
||||||
]
|
|
||||||
_import_structure["modeling_data2vec_vision"] = [
|
|
||||||
"Data2VecVisionForImageClassification",
|
|
||||||
"Data2VecVisionForMaskedImageModeling",
|
|
||||||
"Data2VecVisionForSemanticSegmentation",
|
|
||||||
"Data2VecVisionModel",
|
|
||||||
"Data2VecVisionPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
if is_tf_available():
|
|
||||||
_import_structure["modeling_tf_data2vec_vision"] = [
|
|
||||||
"TFData2VecVisionForImageClassification",
|
|
||||||
"TFData2VecVisionForSemanticSegmentation",
|
|
||||||
"TFData2VecVisionModel",
|
|
||||||
"TFData2VecVisionPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_data2vec_audio import Data2VecAudioConfig
|
from .configuration_data2vec_audio import *
|
||||||
from .configuration_data2vec_text import (
|
from .configuration_data2vec_text import *
|
||||||
Data2VecTextConfig,
|
from .configuration_data2vec_vision import *
|
||||||
Data2VecTextOnnxConfig,
|
from .modeling_data2vec_audio import *
|
||||||
)
|
from .modeling_data2vec_text import *
|
||||||
from .configuration_data2vec_vision import (
|
from .modeling_data2vec_vision import *
|
||||||
Data2VecVisionConfig,
|
from .modeling_tf_data2vec_vision import *
|
||||||
Data2VecVisionOnnxConfig,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_data2vec_audio import (
|
|
||||||
Data2VecAudioForAudioFrameClassification,
|
|
||||||
Data2VecAudioForCTC,
|
|
||||||
Data2VecAudioForSequenceClassification,
|
|
||||||
Data2VecAudioForXVector,
|
|
||||||
Data2VecAudioModel,
|
|
||||||
Data2VecAudioPreTrainedModel,
|
|
||||||
)
|
|
||||||
from .modeling_data2vec_text import (
|
|
||||||
Data2VecTextForCausalLM,
|
|
||||||
Data2VecTextForMaskedLM,
|
|
||||||
Data2VecTextForMultipleChoice,
|
|
||||||
Data2VecTextForQuestionAnswering,
|
|
||||||
Data2VecTextForSequenceClassification,
|
|
||||||
Data2VecTextForTokenClassification,
|
|
||||||
Data2VecTextModel,
|
|
||||||
Data2VecTextPreTrainedModel,
|
|
||||||
)
|
|
||||||
from .modeling_data2vec_vision import (
|
|
||||||
Data2VecVisionForImageClassification,
|
|
||||||
Data2VecVisionForMaskedImageModeling,
|
|
||||||
Data2VecVisionForSemanticSegmentation,
|
|
||||||
Data2VecVisionModel,
|
|
||||||
Data2VecVisionPreTrainedModel,
|
|
||||||
)
|
|
||||||
if is_tf_available():
|
|
||||||
from .modeling_tf_data2vec_vision import (
|
|
||||||
TFData2VecVisionForImageClassification,
|
|
||||||
TFData2VecVisionForSemanticSegmentation,
|
|
||||||
TFData2VecVisionModel,
|
|
||||||
TFData2VecVisionPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -283,3 +283,6 @@ class Data2VecAudioConfig(PretrainedConfig):
|
|||||||
@property
|
@property
|
||||||
def inputs_to_logits_ratio(self):
|
def inputs_to_logits_ratio(self):
|
||||||
return math.prod(self.conv_stride)
|
return math.prod(self.conv_stride)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["Data2VecAudioConfig"]
|
||||||
|
|||||||
@@ -149,3 +149,6 @@ class Data2VecTextOnnxConfig(OnnxConfig):
|
|||||||
("attention_mask", dynamic_axis),
|
("attention_mask", dynamic_axis),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["Data2VecTextConfig", "Data2VecTextOnnxConfig"]
|
||||||
|
|||||||
@@ -189,3 +189,6 @@ class Data2VecVisionOnnxConfig(OnnxConfig):
|
|||||||
@property
|
@property
|
||||||
def atol_for_validation(self) -> float:
|
def atol_for_validation(self) -> float:
|
||||||
return 1e-4
|
return 1e-4
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["Data2VecVisionConfig", "Data2VecVisionOnnxConfig"]
|
||||||
|
|||||||
@@ -1763,3 +1763,13 @@ class Data2VecAudioForXVector(Data2VecAudioPreTrainedModel):
|
|||||||
hidden_states=outputs.hidden_states,
|
hidden_states=outputs.hidden_states,
|
||||||
attentions=outputs.attentions,
|
attentions=outputs.attentions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"Data2VecAudioForAudioFrameClassification",
|
||||||
|
"Data2VecAudioForCTC",
|
||||||
|
"Data2VecAudioForSequenceClassification",
|
||||||
|
"Data2VecAudioForXVector",
|
||||||
|
"Data2VecAudioModel",
|
||||||
|
"Data2VecAudioPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1539,3 +1539,15 @@ def create_position_ids_from_input_ids(input_ids, padding_idx, past_key_values_l
|
|||||||
mask = input_ids.ne(padding_idx).int()
|
mask = input_ids.ne(padding_idx).int()
|
||||||
incremental_indices = (torch.cumsum(mask, dim=1).type_as(mask) + past_key_values_length) * mask
|
incremental_indices = (torch.cumsum(mask, dim=1).type_as(mask) + past_key_values_length) * mask
|
||||||
return incremental_indices.long() + padding_idx
|
return incremental_indices.long() + padding_idx
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"Data2VecTextForCausalLM",
|
||||||
|
"Data2VecTextForMaskedLM",
|
||||||
|
"Data2VecTextForMultipleChoice",
|
||||||
|
"Data2VecTextForQuestionAnswering",
|
||||||
|
"Data2VecTextForSequenceClassification",
|
||||||
|
"Data2VecTextForTokenClassification",
|
||||||
|
"Data2VecTextModel",
|
||||||
|
"Data2VecTextPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1444,3 +1444,11 @@ class Data2VecVisionForSemanticSegmentation(Data2VecVisionPreTrainedModel):
|
|||||||
hidden_states=outputs.hidden_states if output_hidden_states else None,
|
hidden_states=outputs.hidden_states if output_hidden_states else None,
|
||||||
attentions=outputs.attentions,
|
attentions=outputs.attentions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"Data2VecVisionForImageClassification",
|
||||||
|
"Data2VecVisionForSemanticSegmentation",
|
||||||
|
"Data2VecVisionModel",
|
||||||
|
"Data2VecVisionPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1714,3 +1714,11 @@ class TFData2VecVisionForSemanticSegmentation(TFData2VecVisionPreTrainedModel):
|
|||||||
if getattr(self, "fpn2", None) is not None:
|
if getattr(self, "fpn2", None) is not None:
|
||||||
with tf.name_scope(self.fpn2[0].name):
|
with tf.name_scope(self.fpn2[0].name):
|
||||||
self.fpn2[0].build([None, None, None, self.config.hidden_size])
|
self.fpn2[0].build([None, None, None, self.config.hidden_size])
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"TFData2VecVisionForImageClassification",
|
||||||
|
"TFData2VecVisionForSemanticSegmentation",
|
||||||
|
"TFData2VecVisionModel",
|
||||||
|
"TFData2VecVisionPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -13,39 +13,15 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
|
from ...utils import _LazyModule
|
||||||
|
from ...utils.import_utils import define_import_structure
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_dbrx": ["DbrxConfig"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_dbrx"] = [
|
|
||||||
"DbrxForCausalLM",
|
|
||||||
"DbrxModel",
|
|
||||||
"DbrxPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_dbrx import DbrxConfig
|
from .configuration_dbrx import *
|
||||||
|
from .modeling_dbrx import *
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_dbrx import DbrxForCausalLM, DbrxModel, DbrxPreTrainedModel
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -227,3 +227,6 @@ class DbrxConfig(PretrainedConfig):
|
|||||||
raise ValueError("tie_word_embeddings is not supported for DBRX models.")
|
raise ValueError("tie_word_embeddings is not supported for DBRX models.")
|
||||||
|
|
||||||
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DbrxConfig"]
|
||||||
|
|||||||
@@ -1374,3 +1374,6 @@ class DbrxForCausalLM(DbrxPreTrainedModel, GenerationMixin):
|
|||||||
attentions=outputs.attentions,
|
attentions=outputs.attentions,
|
||||||
router_logits=outputs.router_logits,
|
router_logits=outputs.router_logits,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DbrxForCausalLM", "DbrxModel", "DbrxPreTrainedModel"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2020 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -11,106 +11,20 @@
|
|||||||
# 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
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import (
|
from ...utils import _LazyModule
|
||||||
OptionalDependencyNotAvailable,
|
from ...utils.import_utils import define_import_structure
|
||||||
_LazyModule,
|
|
||||||
is_tf_available,
|
|
||||||
is_tokenizers_available,
|
|
||||||
is_torch_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_deberta": ["DebertaConfig", "DebertaOnnxConfig"],
|
|
||||||
"tokenization_deberta": ["DebertaTokenizer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_deberta_fast"] = ["DebertaTokenizerFast"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_deberta"] = [
|
|
||||||
"DebertaForMaskedLM",
|
|
||||||
"DebertaForQuestionAnswering",
|
|
||||||
"DebertaForSequenceClassification",
|
|
||||||
"DebertaForTokenClassification",
|
|
||||||
"DebertaModel",
|
|
||||||
"DebertaPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_tf_deberta"] = [
|
|
||||||
"TFDebertaForMaskedLM",
|
|
||||||
"TFDebertaForQuestionAnswering",
|
|
||||||
"TFDebertaForSequenceClassification",
|
|
||||||
"TFDebertaForTokenClassification",
|
|
||||||
"TFDebertaModel",
|
|
||||||
"TFDebertaPreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_deberta import DebertaConfig, DebertaOnnxConfig
|
from .configuration_deberta import *
|
||||||
from .tokenization_deberta import DebertaTokenizer
|
from .modeling_deberta import *
|
||||||
|
from .modeling_tf_deberta import *
|
||||||
try:
|
from .tokenization_deberta import *
|
||||||
if not is_tokenizers_available():
|
from .tokenization_deberta_fast import *
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_deberta_fast import DebertaTokenizerFast
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_deberta import (
|
|
||||||
DebertaForMaskedLM,
|
|
||||||
DebertaForQuestionAnswering,
|
|
||||||
DebertaForSequenceClassification,
|
|
||||||
DebertaForTokenClassification,
|
|
||||||
DebertaModel,
|
|
||||||
DebertaPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_tf_deberta import (
|
|
||||||
TFDebertaForMaskedLM,
|
|
||||||
TFDebertaForQuestionAnswering,
|
|
||||||
TFDebertaForSequenceClassification,
|
|
||||||
TFDebertaForTokenClassification,
|
|
||||||
TFDebertaModel,
|
|
||||||
TFDebertaPreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -194,3 +194,6 @@ class DebertaOnnxConfig(OnnxConfig):
|
|||||||
if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
|
if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
|
||||||
del dummy_inputs["token_type_ids"]
|
del dummy_inputs["token_type_ids"]
|
||||||
return dummy_inputs
|
return dummy_inputs
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DebertaConfig", "DebertaOnnxConfig"]
|
||||||
|
|||||||
@@ -1332,3 +1332,13 @@ class DebertaForQuestionAnswering(DebertaPreTrainedModel):
|
|||||||
hidden_states=outputs.hidden_states,
|
hidden_states=outputs.hidden_states,
|
||||||
attentions=outputs.attentions,
|
attentions=outputs.attentions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"DebertaForMaskedLM",
|
||||||
|
"DebertaForQuestionAnswering",
|
||||||
|
"DebertaForSequenceClassification",
|
||||||
|
"DebertaForTokenClassification",
|
||||||
|
"DebertaModel",
|
||||||
|
"DebertaPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1640,3 +1640,13 @@ class TFDebertaForQuestionAnswering(TFDebertaPreTrainedModel, TFQuestionAnswerin
|
|||||||
if getattr(self, "qa_outputs", None) is not None:
|
if getattr(self, "qa_outputs", None) is not None:
|
||||||
with tf.name_scope(self.qa_outputs.name):
|
with tf.name_scope(self.qa_outputs.name):
|
||||||
self.qa_outputs.build([None, None, self.config.hidden_size])
|
self.qa_outputs.build([None, None, self.config.hidden_size])
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"TFDebertaForMaskedLM",
|
||||||
|
"TFDebertaForQuestionAnswering",
|
||||||
|
"TFDebertaForSequenceClassification",
|
||||||
|
"TFDebertaForTokenClassification",
|
||||||
|
"TFDebertaModel",
|
||||||
|
"TFDebertaPreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
@@ -391,3 +391,6 @@ class DebertaTokenizer(PreTrainedTokenizer):
|
|||||||
if (is_split_into_words or add_prefix_space) and (len(text) > 0 and not text[0].isspace()):
|
if (is_split_into_words or add_prefix_space) and (len(text) > 0 and not text[0].isspace()):
|
||||||
text = " " + text
|
text = " " + text
|
||||||
return (text, kwargs)
|
return (text, kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DebertaTokenizer"]
|
||||||
|
|||||||
@@ -245,3 +245,6 @@ class DebertaTokenizerFast(PreTrainedTokenizerFast):
|
|||||||
def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
|
def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
|
||||||
files = self._tokenizer.model.save(save_directory, name=filename_prefix)
|
files = self._tokenizer.model.save(save_directory, name=filename_prefix)
|
||||||
return tuple(files)
|
return tuple(files)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DebertaTokenizerFast"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2020 The HuggingFace Team. All rights reserved.
|
# Copyright 2024 The HuggingFace Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -11,112 +11,20 @@
|
|||||||
# 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
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ...utils import (
|
from ...utils import _LazyModule
|
||||||
OptionalDependencyNotAvailable,
|
from ...utils.import_utils import define_import_structure
|
||||||
_LazyModule,
|
|
||||||
is_tf_available,
|
|
||||||
is_tokenizers_available,
|
|
||||||
is_torch_available,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
|
||||||
"configuration_deberta_v2": ["DebertaV2Config", "DebertaV2OnnxConfig"],
|
|
||||||
"tokenization_deberta_v2": ["DebertaV2Tokenizer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["tokenization_deberta_v2_fast"] = ["DebertaV2TokenizerFast"]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_tf_deberta_v2"] = [
|
|
||||||
"TFDebertaV2ForMaskedLM",
|
|
||||||
"TFDebertaV2ForQuestionAnswering",
|
|
||||||
"TFDebertaV2ForMultipleChoice",
|
|
||||||
"TFDebertaV2ForSequenceClassification",
|
|
||||||
"TFDebertaV2ForTokenClassification",
|
|
||||||
"TFDebertaV2Model",
|
|
||||||
"TFDebertaV2PreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
_import_structure["modeling_deberta_v2"] = [
|
|
||||||
"DebertaV2ForMaskedLM",
|
|
||||||
"DebertaV2ForMultipleChoice",
|
|
||||||
"DebertaV2ForQuestionAnswering",
|
|
||||||
"DebertaV2ForSequenceClassification",
|
|
||||||
"DebertaV2ForTokenClassification",
|
|
||||||
"DebertaV2Model",
|
|
||||||
"DebertaV2PreTrainedModel",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .configuration_deberta_v2 import (
|
from .configuration_deberta_v2 import *
|
||||||
DebertaV2Config,
|
from .modeling_deberta_v2 import *
|
||||||
DebertaV2OnnxConfig,
|
from .modeling_tf_deberta_v2 import *
|
||||||
)
|
from .tokenization_deberta_v2 import *
|
||||||
from .tokenization_deberta_v2 import DebertaV2Tokenizer
|
from .tokenization_deberta_v2_fast import *
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tokenizers_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .tokenization_deberta_v2_fast import DebertaV2TokenizerFast
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_tf_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_tf_deberta_v2 import (
|
|
||||||
TFDebertaV2ForMaskedLM,
|
|
||||||
TFDebertaV2ForMultipleChoice,
|
|
||||||
TFDebertaV2ForQuestionAnswering,
|
|
||||||
TFDebertaV2ForSequenceClassification,
|
|
||||||
TFDebertaV2ForTokenClassification,
|
|
||||||
TFDebertaV2Model,
|
|
||||||
TFDebertaV2PreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not is_torch_available():
|
|
||||||
raise OptionalDependencyNotAvailable()
|
|
||||||
except OptionalDependencyNotAvailable:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
from .modeling_deberta_v2 import (
|
|
||||||
DebertaV2ForMaskedLM,
|
|
||||||
DebertaV2ForMultipleChoice,
|
|
||||||
DebertaV2ForQuestionAnswering,
|
|
||||||
DebertaV2ForSequenceClassification,
|
|
||||||
DebertaV2ForTokenClassification,
|
|
||||||
DebertaV2Model,
|
|
||||||
DebertaV2PreTrainedModel,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|
_file = globals()["__file__"]
|
||||||
|
sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
|
||||||
|
|||||||
@@ -193,3 +193,6 @@ class DebertaV2OnnxConfig(OnnxConfig):
|
|||||||
if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
|
if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
|
||||||
del dummy_inputs["token_type_ids"]
|
del dummy_inputs["token_type_ids"]
|
||||||
return dummy_inputs
|
return dummy_inputs
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["DebertaV2Config", "DebertaV2OnnxConfig"]
|
||||||
|
|||||||
@@ -1506,3 +1506,14 @@ class DebertaV2ForMultipleChoice(DebertaV2PreTrainedModel):
|
|||||||
hidden_states=outputs.hidden_states,
|
hidden_states=outputs.hidden_states,
|
||||||
attentions=outputs.attentions,
|
attentions=outputs.attentions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"DebertaV2ForMaskedLM",
|
||||||
|
"DebertaV2ForMultipleChoice",
|
||||||
|
"DebertaV2ForQuestionAnswering",
|
||||||
|
"DebertaV2ForSequenceClassification",
|
||||||
|
"DebertaV2ForTokenClassification",
|
||||||
|
"DebertaV2Model",
|
||||||
|
"DebertaV2PreTrainedModel",
|
||||||
|
]
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user