mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Improve is_fbcode functionality (#136871)
Summary: Previously is_fbcode just checked whether the checkout was git or not. This is extremely error prone. Lets make it fool-proof. Test Plan: unit tests Reviewed By: masnesral Differential Revision: D63545169 Pull Request resolved: https://github.com/pytorch/pytorch/pull/136871 Approved by: https://github.com/masnesral
This commit is contained in:
parent
283bda01aa
commit
a28b40fa74
|
|
@ -7,6 +7,7 @@ from unittest import skipIf
|
|||
|
||||
import torch
|
||||
import torch.utils.cpp_extension
|
||||
from torch._environment import is_fbcode
|
||||
from torch.testing._internal.common_utils import IS_WINDOWS, run_tests, TestCase
|
||||
|
||||
|
||||
|
|
@ -21,10 +22,6 @@ def remove_build_path():
|
|||
shutil.rmtree(default_build_root)
|
||||
|
||||
|
||||
def is_fbcode():
|
||||
return not hasattr(torch.version, "git_version")
|
||||
|
||||
|
||||
if is_fbcode():
|
||||
import caffe2.test.profiler_test_cpp_thread_lib as cpp # @manual=//caffe2/test:profiler_test_cpp_thread_lib
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from collections import Counter
|
|||
from typing import Dict
|
||||
|
||||
import torch
|
||||
from torch._environment import is_fbcode
|
||||
from torch._export import capture_pre_autograd_graph
|
||||
from torch.ao.quantization import (
|
||||
compare_results,
|
||||
|
|
@ -40,10 +41,6 @@ def _extract_debug_handles(model) -> Dict[str, int]:
|
|||
return debug_handle_map
|
||||
|
||||
|
||||
def is_fbcode():
|
||||
return not hasattr(torch.version, "git_version")
|
||||
|
||||
|
||||
@unittest.skipIf(IS_WINDOWS, "Windows not yet supported for torch.compile")
|
||||
class TestNumericDebugger(TestCase):
|
||||
def test_simple(self):
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ from os.path import abspath, dirname
|
|||
from typing import Any, Callable, Dict, Optional, Set, Type, TYPE_CHECKING, Union
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
def is_fbcode():
|
||||
return not hasattr(torch.version, "git_version")
|
||||
from torch._environment import is_fbcode
|
||||
|
||||
|
||||
# to configure logging for dynamo, aot, and inductor
|
||||
|
|
|
|||
2
torch/_environment.py
Normal file
2
torch/_environment.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def is_fbcode() -> bool:
|
||||
return False
|
||||
|
|
@ -3,10 +3,7 @@ import sys
|
|||
from typing import Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
def is_fbcode() -> bool:
|
||||
return not hasattr(torch.version, "git_version")
|
||||
from torch._environment import is_fbcode
|
||||
|
||||
|
||||
def _get_tristate_env(name: str) -> Optional[bool]:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user