Download runtime/bankshot_device.py from racklab/BankShot-Search: direct link, hf CLI and curl.
- Browser
- Download file 1.71 kB
-
https://huggingface.co/racklab/BankShot-Search/resolve/main/runtime/bankshot_device.py
- Command line
-
hf download hf://racklab/BankShot-Search/runtime/bankshot_device.py
-
curl -L -o bankshot_device.py https://huggingface.co/racklab/BankShot-Search/resolve/main/runtime/bankshot_device.py
1.71 kB
| """Locate the original USB stick and its separately installed Windows runtime.""" | |
| import os | |
| from pathlib import Path | |
| import re | |
| import subprocess | |
| import sys | |
| def prepare_ncs1(): | |
| if os.name != "nt": | |
| raise RuntimeError("This NCS1 package uses the legacy Windows runtime") | |
| command = ("Get-PnpDevice -PresentOnly | Where-Object " | |
| "{ $_.InstanceId -like 'USB*VID_03E7*' } | Select-Object -ExpandProperty InstanceId") | |
| report = subprocess.run(["powershell.exe", "-NoProfile", "-NonInteractive", "-Command", command], | |
| check=True, stdout=subprocess.PIPE, text=True, timeout=15) | |
| ids = re.findall(r"^\s*USB\\VID_03E7&PID_([0-9A-F]{4})\\", report.stdout, re.I | re.M) | |
| if [value.upper() for value in ids] != ["2150"]: | |
| raise RuntimeError("Connect exactly one cold original NCS1 (USB 03E7:2150)") | |
| default = Path("D:/NTVStudy/tools/ncs1") | |
| path = Path(os.environ.get("BANKSHOT_NCS1_ROOT", str(default))).resolve() | |
| openvino = path / "ov2020" | |
| deployment = openvino / "deployment_tools" | |
| ie = deployment / "inference_engine" | |
| binding = openvino / "python/python3.7" | |
| if not binding.is_dir(): | |
| raise RuntimeError("Set BANKSHOT_NCS1_ROOT to the installed OpenVINO 2020.3.2 tool directory") | |
| dlls = (path / "redist", ie / "external/tbb/bin", ie / "bin/intel64/Release", | |
| ie / "bin/intel64/Debug", ie / "external/hddl/bin", deployment / "ngraph/lib") | |
| os.environ["PATH"] = os.pathsep.join(map(str, dlls)) + os.pathsep + os.environ.get("PATH", "") | |
| sys.path[:0] = [str(binding), str(openvino / "python/python3"), str(deployment / "model_optimizer")] | |
| return {"stick": "ncs1", "boot_usb_id": "03E7:2150"} | |