From 61e48108df31ec257eed811aa189e5cda6dea683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Kulh=C3=A1nek?= Date: Wed, 24 May 2023 00:18:53 +0200 Subject: [PATCH] Add warnings for (slower) Torch 1.x and Windows not supporting torch.compile (#1982) Add warning for torch 1.x and windows --- nerfstudio/utils/misc.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nerfstudio/utils/misc.py b/nerfstudio/utils/misc.py index 5b40117e9..e95bd4188 100644 --- a/nerfstudio/utils/misc.py +++ b/nerfstudio/utils/misc.py @@ -19,6 +19,7 @@ Miscellaneous helper code. import platform from typing import Any, Callable, Dict, List, Optional, TypeVar, Union +import warnings import torch @@ -167,11 +168,17 @@ def torch_compile(*args, **kwargs): """ if not hasattr(torch, "compile"): # Backward compatibility for PyTorch 1.x + warnings.warn( + "PyTorch 1.x will no longer be supported by Nerstudio. Please upgrade to PyTorch 2.x.", DeprecationWarning + ) return torch.jit.script elif platform.system() == "Windows": # torch.compile is not supported on Windows # https://github.com/orgs/pytorch/projects/27 # TODO: @jkulhanek, remove this once torch.compile is supported on Windows + warnings.warn( + "Windows does not yet support torch.compile and the performance will be affected.", RuntimeWarning + ) return lambda x: x else: return torch.compile(*args, **kwargs)