Unverified Commit 86a15472 authored by Minwoo Lee's avatar Minwoo Lee Committed by GitHub
Browse files

Fix omitted lazy import for xlm-prophetnet (#13052)



* Fix omitted lazy import for xlm-prophetnet

* Update src/transformers/models/xlm_prophetnet/__init__.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Fix style using black
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent d58926ab
...@@ -15,15 +15,39 @@ ...@@ -15,15 +15,39 @@
# 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 ...file_utils import is_sentencepiece_available, is_torch_available from ...file_utils import _LazyModule, is_sentencepiece_available, is_torch_available
from .configuration_xlm_prophetnet import XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMProphetNetConfig
_import_structure = {
"configuration_xlm_prophetnet": [
"XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP",
"XLMProphetNetConfig",
],
}
if is_sentencepiece_available(): if is_sentencepiece_available():
from .tokenization_xlm_prophetnet import XLMProphetNetTokenizer _import_structure["tokenization_xlm_prophetnet"] = ["XLMProphetNetTokenizer"]
if is_torch_available(): if is_torch_available():
_import_structure["modeling_xlm_prophetnet"] = [
"XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST",
"XLMProphetNetDecoder",
"XLMProphetNetEncoder",
"XLMProphetNetForCausalLM",
"XLMProphetNetForConditionalGeneration",
"XLMProphetNetModel",
]
if TYPE_CHECKING:
from .configuration_xlm_prophetnet import XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMProphetNetConfig
if is_sentencepiece_available():
from .tokenization_xlm_prophetnet import XLMProphetNetTokenizer
if is_torch_available():
from .modeling_xlm_prophetnet import ( from .modeling_xlm_prophetnet import (
XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST, XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
XLMProphetNetDecoder, XLMProphetNetDecoder,
...@@ -32,3 +56,8 @@ if is_torch_available(): ...@@ -32,3 +56,8 @@ if is_torch_available():
XLMProphetNetForConditionalGeneration, XLMProphetNetForConditionalGeneration,
XLMProphetNetModel, XLMProphetNetModel,
) )
else:
import sys
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment