mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 07:48:50 +08:00
Add warnings for (slower) Torch 1.x and Windows not supporting torch.compile (#1982)
Add warning for torch 1.x and windows
This commit is contained in:
1 parent
efd83abb6d
commit
61e48108df
1 file changed
+7
@@ -19,6 +19,7 @@ Miscellaneous helper code.
|
|||||||
|
|
||||||
import platform
|
import platform
|
||||||
from typing import Any, Callable, Dict, List, Optional, TypeVar, Union
|
from typing import Any, Callable, Dict, List, Optional, TypeVar, Union
|
||||||
|
import warnings
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
@@ -167,11 +168,17 @@ def torch_compile(*args, **kwargs):
|
|||||||
"""
|
"""
|
||||||
if not hasattr(torch, "compile"):
|
if not hasattr(torch, "compile"):
|
||||||
# Backward compatibility for PyTorch 1.x
|
# 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
|
return torch.jit.script
|
||||||
elif platform.system() == "Windows":
|
elif platform.system() == "Windows":
|
||||||
# torch.compile is not supported on Windows
|
# torch.compile is not supported on Windows
|
||||||
# https://github.com/orgs/pytorch/projects/27
|
# https://github.com/orgs/pytorch/projects/27
|
||||||
# TODO: @jkulhanek, remove this once torch.compile is supported on Windows
|
# 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
|
return lambda x: x
|
||||||
else:
|
else:
|
||||||
return torch.compile(*args, **kwargs)
|
return torch.compile(*args, **kwargs)
|
||||||
Reference in new issue
Block a user