diff --git a/tico/__init__.py b/tico/__init__.py index c3637c05..53c4b9d4 100644 --- a/tico/__init__.py +++ b/tico/__init__.py @@ -18,14 +18,25 @@ from packaging.version import Version from tico.config import CompileConfigV1, get_default_config - from tico.utils.convert import convert, convert_from_exported_program, convert_from_pt2 # THIS LINE IS AUTOMATICALLY GENERATED BY setup.py __version__ = "0.1.0" +MINIMUM_SUPPORTED_VERSION = "2.5.0" +SECURE_TORCH_VERSION = "2.6.0" + +if Version(torch.__version__) < Version(MINIMUM_SUPPORTED_VERSION): + warnings.warn( + f"TICO officially supports torch>={MINIMUM_SUPPORTED_VERSION}. " + f"You are using a lower version of torch ({torch.__version__}). " + f"We highly recommend to upgrade torch>={MINIMUM_SUPPORTED_VERSION} to avoid unexpected behaviors." + ) -if Version(torch.__version__) < Version("2.5.0"): +if Version(torch.__version__) < Version(SECURE_TORCH_VERSION): warnings.warn( - f"TICO officially supports torch>=2.5. You are using a lower version of torch ({torch.__version__}). We highly recommend to upgrade torch >= 2.5 to avoid unexpected behaviors." + f"Detected PyTorch version {torch.__version__}, which may include known security vulnerabilities. " + f"We recommend upgrading to {SECURE_TORCH_VERSION} or later for better security.\n" + "Upgrade command: pip install --upgrade torch\n" + "For more details, see: https://pytorch.org/security" )