scorevision: push artifact
Browse files- chute_config.yml +0 -1
- miner.py +38 -0
chute_config.yml
CHANGED
|
@@ -3,7 +3,6 @@ Image:
|
|
| 3 |
run_command:
|
| 4 |
- pip install --upgrade setuptools wheel
|
| 5 |
- "pip install 'numpy>=1.23' 'onnxruntime-gpu>=1.16' 'nvidia-cudnn-cu12' 'nvidia-cublas-cu12' 'opencv-python-headless>=4.7' 'pillow>=9.5' 'huggingface_hub>=0.19.4' 'pydantic>=2.0' 'pyyaml>=6.0' 'aiohttp>=3.9' 'ensemble-boxes>=1.0'"
|
| 6 |
-
- "python3 -c \"import os,nvidia.cudnn,nvidia.cublas;cudnn=os.path.join(os.path.dirname(nvidia.cudnn.__file__),chr(108)+chr(105)+chr(98));cublas=os.path.join(os.path.dirname(nvidia.cublas.__file__),chr(108)+chr(105)+chr(98));open(chr(47)+chr(101)+chr(116)+chr(99)+chr(47)+chr(108)+chr(100)+chr(46)+chr(115)+chr(111)+chr(46)+chr(99)+chr(111)+chr(110)+chr(102)+chr(46)+chr(100)+chr(47)+chr(110)+chr(118)+chr(105)+chr(100)+chr(105)+chr(97)+chr(45)+chr(111)+chr(114)+chr(116)+chr(46)+chr(99)+chr(111)+chr(110)+chr(102),chr(119)).write(cudnn+chr(10)+cublas+chr(10))\" && ldconfig"
|
| 7 |
|
| 8 |
NodeSelector:
|
| 9 |
gpu_count: 1
|
|
|
|
| 3 |
run_command:
|
| 4 |
- pip install --upgrade setuptools wheel
|
| 5 |
- "pip install 'numpy>=1.23' 'onnxruntime-gpu>=1.16' 'nvidia-cudnn-cu12' 'nvidia-cublas-cu12' 'opencv-python-headless>=4.7' 'pillow>=9.5' 'huggingface_hub>=0.19.4' 'pydantic>=2.0' 'pyyaml>=6.0' 'aiohttp>=3.9' 'ensemble-boxes>=1.0'"
|
|
|
|
| 6 |
|
| 7 |
NodeSelector:
|
| 8 |
gpu_count: 1
|
miner.py
CHANGED
|
@@ -15,6 +15,44 @@ cls_id 0 is shared: "bus" for vehicle eval, "person" for person eval.
|
|
| 15 |
Vehicle eval uses cls_id 0-3. Person eval uses cls_id 0 only.
|
| 16 |
"""
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
from pathlib import Path
|
| 19 |
import math
|
| 20 |
import time
|
|
|
|
| 15 |
Vehicle eval uses cls_id 0-3. Person eval uses cls_id 0 only.
|
| 16 |
"""
|
| 17 |
|
| 18 |
+
import os
|
| 19 |
+
import ctypes
|
| 20 |
+
import glob as _glob
|
| 21 |
+
import logging as _logging
|
| 22 |
+
|
| 23 |
+
_cuda_log = _logging.getLogger(__name__)
|
| 24 |
+
|
| 25 |
+
def _preload_cuda_libs():
|
| 26 |
+
"""Pre-load CUDA libs from pip nvidia packages so onnxruntime-gpu finds them."""
|
| 27 |
+
try:
|
| 28 |
+
lib_dirs = []
|
| 29 |
+
for mod_name in ['nvidia.cudnn', 'nvidia.cublas']:
|
| 30 |
+
try:
|
| 31 |
+
mod = __import__(mod_name, fromlist=['__file__'])
|
| 32 |
+
lib_dir = os.path.join(os.path.dirname(mod.__file__), 'lib')
|
| 33 |
+
if os.path.isdir(lib_dir):
|
| 34 |
+
lib_dirs.append(lib_dir)
|
| 35 |
+
except ImportError:
|
| 36 |
+
pass
|
| 37 |
+
if not lib_dirs:
|
| 38 |
+
return
|
| 39 |
+
# Set LD_LIBRARY_PATH for subprocesses
|
| 40 |
+
existing = os.environ.get('LD_LIBRARY_PATH', '')
|
| 41 |
+
os.environ['LD_LIBRARY_PATH'] = ':'.join(lib_dirs + ([existing] if existing else []))
|
| 42 |
+
# Pre-load .so files with RTLD_GLOBAL so dlopen() finds them
|
| 43 |
+
for lib_dir in lib_dirs:
|
| 44 |
+
for so in sorted(_glob.glob(os.path.join(lib_dir, 'lib*.so*'))):
|
| 45 |
+
try:
|
| 46 |
+
ctypes.CDLL(so, mode=ctypes.RTLD_GLOBAL)
|
| 47 |
+
_cuda_log.info(f'Preloaded CUDA lib: {os.path.basename(so)}')
|
| 48 |
+
except OSError:
|
| 49 |
+
pass
|
| 50 |
+
except Exception as e:
|
| 51 |
+
_cuda_log.warning(f'CUDA preload error: {e}')
|
| 52 |
+
|
| 53 |
+
_preload_cuda_libs()
|
| 54 |
+
|
| 55 |
+
|
| 56 |
from pathlib import Path
|
| 57 |
import math
|
| 58 |
import time
|