clean postbuild script

clean warnings
This commit is contained in:
Alex Bezdieniezhnykh
2025-04-28 10:20:06 +03:00
parent 47aa8b862b
commit babcbc0fc7
12 changed files with 56 additions and 51 deletions
+2 -2
View File
@@ -79,9 +79,9 @@ cdef class ApiClient:
try:
r = requests.post(url, headers=headers, files=files, allow_redirects=True)
r.raise_for_status()
print(f"Uploaded {filename} to {constants.API_URL}/{folder} successfully: {r.status_code}.")
constants.log(f"Uploaded {filename} to {constants.API_URL}/{folder} successfully: {r.status_code}.")
except Exception as e:
print(f"Upload fail: {e}")
constants.log(f"Upload fail: {e}")
cdef load_bytes(self, str filename, str folder):
hardware_service = HardwareService()
+3 -4
View File
@@ -7,7 +7,7 @@ import tensorrt as trt
import pycuda.driver as cuda
import pycuda.autoinit # required for automatically initialize CUDA, do not remove.
import pynvml
cimport constants
cdef class InferenceEngine:
def __init__(self, model_bytes: bytes, batch_size: int = 1, **kwargs):
@@ -51,7 +51,6 @@ cdef class OnnxEngine(InferenceEngine):
cdef class TensorRTEngine(InferenceEngine):
def __init__(self, model_bytes: bytes, batch_size: int = 4, **kwargs):
super().__init__(model_bytes, batch_size)
print('Enter init TensorRT')
try:
logger = trt.Logger(trt.Logger.WARNING)
@@ -142,7 +141,7 @@ cdef class TensorRTEngine(InferenceEngine):
return None
if builder.platform_has_fast_fp16:
print('Converting to supported fp16')
constants.log('Converting to supported fp16')
config.set_flag(trt.BuilderFlag.FP16)
else:
print('Converting to supported fp32. (fp16 is not supported)')
@@ -151,7 +150,7 @@ cdef class TensorRTEngine(InferenceEngine):
if plan is None:
print('Conversion failed.')
return None
print('conversion done!')
constants.log('conversion done!')
return bytes(plan)
cdef tuple get_input_shape(self):
+1 -1
View File
@@ -66,7 +66,7 @@ cdef class RemoteCommandHandler:
self._on_command(cmd)
except Exception as e:
if not self._shutdown_event.is_set():
print(f"Worker error: {e}")
constants.log(f"Worker error: {e}")
import traceback
traceback.print_exc()
finally: