Unverified Commit 1f3c2282 authored by Patrick von Platen's avatar Patrick von Platen Committed by GitHub
Browse files

Temp fix for broken detectron2 import (#18699)

* add first generation tutorial

* [Circle CI] Temporary fix for broken detectron2 import

* remove generation
parent e95d433d
...@@ -43,12 +43,26 @@ from ...utils import ( ...@@ -43,12 +43,26 @@ from ...utils import (
from .configuration_layoutlmv2 import LayoutLMv2Config from .configuration_layoutlmv2 import LayoutLMv2Config
logger = logging.get_logger(__name__)
# soft dependency # soft dependency
if is_detectron2_available(): if is_detectron2_available():
import detectron2 import detectron2
from detectron2.modeling import META_ARCH_REGISTRY
logger = logging.get_logger(__name__) try:
from detectron2.modeling import META_ARCH_REGISTRY
except ImportError:
# NOTE: This is a temporary fix because currently there are
# import problems when using detectron2 from master (see issues below)
# it's better to have a silent error here in case someone imports this file
# without using the model which without this hack would break.
logger.warning(
"The detectron2 import seems to be broken. See:"
"https://github.com/facebookresearch/detectron2/issues/4489 or"
"https://github.com/facebookresearch/detectron2/issues/4487"
)
pass
_CHECKPOINT_FOR_DOC = "microsoft/layoutlmv2-base-uncased" _CHECKPOINT_FOR_DOC = "microsoft/layoutlmv2-base-uncased"
_CONFIG_FOR_DOC = "LayoutLMv2Config" _CONFIG_FOR_DOC = "LayoutLMv2Config"
......
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