Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] Remove test proxy suggestion #2073

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
import subprocess
import os
import sys
from utils import TORCH_DEPS, proxy_suggestion, get_pkg_versions, _test_https
from utils import TORCH_DEPS, get_pkg_versions
from userbenchmark import list_userbenchmarks
from pathlib import Path

REPO_ROOT = Path(__file__).parent

def pip_install_requirements(requirements_txt="requirements.txt"):
if not _test_https():
print(proxy_suggestion)
sys.exit(-1)
try:
subprocess.run([sys.executable, '-m', 'pip', 'install', '-q', '-r', requirements_txt],
check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
Expand Down
15 changes: 1 addition & 14 deletions torchbenchmark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,14 @@ def __exit__(self, exc_type, exc_value, traceback):
pass

with add_path(str(REPO_PATH)):
from utils import TORCH_DEPS, get_pkg_versions, proxy_suggestion
from utils import TORCH_DEPS, get_pkg_versions

this_dir = pathlib.Path(__file__).parent.absolute()
model_dir = 'models'
internal_model_dir = "fb"
canary_model_dir = "canary_models"
install_file = 'install.py'


def _test_https(test_url: str = 'https://github.com', timeout: float = 0.5) -> bool:
try:
request.urlopen(test_url, timeout=timeout)
except OSError:
return False
return True


def _install_deps(model_path: str, verbose: bool = True) -> Tuple[bool, Any]:
from .util.env_check import get_pkg_versions
run_args = [
Expand Down Expand Up @@ -135,10 +126,6 @@ def _is_canary_model(model_name: str) -> bool:
return False

def setup(models: List[str] = [], verbose: bool = True, continue_on_fail: bool = False, test_mode: bool = False, allow_canary: bool = False) -> bool:
if not _test_https():
print(proxy_suggestion)
sys.exit(-1)

failures = {}
models = list(map(lambda p: p.lower(), models))
model_paths = filter(lambda p: True if not models else os.path.basename(p).lower() in models, _list_model_paths())
Expand Down
11 changes: 0 additions & 11 deletions utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

TORCH_DEPS = ['torch', 'torchvision', 'torchaudio']

proxy_suggestion = "Unable to verify https connectivity, " \
"required for setup.\n" \
"Do you need to use a proxy?"

class add_path():
def __init__(self, path):
self.path = path
Expand All @@ -30,10 +26,3 @@ def get_pkg_versions(packages: List[str], reload: bool=False) -> Dict[str, str]:
module = importlib.reload(module)
versions[module.__name__] = module.__version__
return versions

def _test_https(test_url: str = 'https://github.com', timeout: float = 0.5) -> bool:
try:
request.urlopen(test_url, timeout=timeout)
except OSError:
return False
return True
Loading