"examples/vscode:/vscode.git/clone" did not exist on "3ab0185b061baae207efed02799dd424ee8377f1"
Unverified Commit d91da4c6 authored by Xing Han Lu's avatar Xing Han Lu Committed by GitHub
Browse files

Add warning when using older version of torch for ViltFeatureExtractor (#16756)



* Update feature_extraction_vilt.py

* apply black

* Update imports

* Change warning to logging

* Use logger instead of logging.logging

* make fixup

* Move error message

* Update src/transformers/models/vilt/feature_extraction_vilt.py
Co-authored-by: default avatarXing Han Lu <xhlperso@gmail.com>
Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
parent 24092b14
...@@ -33,6 +33,7 @@ from ...utils import TensorType, is_torch_available, logging ...@@ -33,6 +33,7 @@ from ...utils import TensorType, is_torch_available, logging
if is_torch_available(): if is_torch_available():
import torch import torch
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
......
...@@ -41,6 +41,12 @@ from .configuration_vilt import ViltConfig ...@@ -41,6 +41,12 @@ from .configuration_vilt import ViltConfig
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
if torch.__version__ < (1, 10, 0):
logger.warning(
f"You are using torch=={torch.__version__}, but torch>=1.10.0 is required to use "
"ViltModel. Please upgrade torch."
)
_CONFIG_FOR_DOC = "ViltConfig" _CONFIG_FOR_DOC = "ViltConfig"
_CHECKPOINT_FOR_DOC = "dandelin/vilt-b32-mlm" _CHECKPOINT_FOR_DOC = "dandelin/vilt-b32-mlm"
......
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