Skip to content

Commit 97afff9

Browse files
committed
fix: update input size for FaceDetector and enable TensorRT caching in ONNX providers
1 parent 3971186 commit 97afff9

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎inference_api/infrastructure/di_container.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Container(containers.DeclarativeContainer):
1515
face_detector = providers.Singleton(
1616
FaceDetector,
1717
model_path="models/buffalo_l/det_10g.onnx",
18-
input_size=(1920, 1920),
18+
input_size=(1024, 1024),
1919
device="cuda",
2020
num_threads=1,
2121
)

‎inference_api/infrastructure/onnx/utils.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ def get_providers(device: str) -> list:
66
if device == "cuda":
77
available = ort.get_available_providers()
88
providers: list[str | tuple[str, dict[str, object]]] = []
9+
if "TensorrtExecutionProvider" in available:
10+
providers.append(
11+
(
12+
"TensorrtExecutionProvider",
13+
{
14+
"trt_engine_cache_enable": True,
15+
"trt_engine_cache_path": "./trt_cache",
16+
"trt_fp16_enable": True,
17+
},
18+
)
19+
)
920
if "CUDAExecutionProvider" in available:
1021
providers.append(
1122
(

‎main_api/infrastructure/inference/hf_inference_service.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async def get_face_encodings(
2424
},
2525
}
2626

27-
async with httpx.AsyncClient(timeout=120.0) as client:
27+
async with httpx.AsyncClient(timeout=None) as client:
2828
response = await client.post(
2929
f"{self.api_url}/", json=payload, headers=headers
3030
)

0 commit comments

Comments
 (0)