Commit 74e954da authored by myhloli's avatar myhloli
Browse files

perf(inference): adjust batch ratio thresholds for GPU memory sizes

- Increase batch ratio to 32 for GPU memory >= 24GB
- Set batch ratio to 16 for GPU memory >= 16GB
- Reduce batch ratio to 8 for GPU memory >= 12GB
- Lower batch ratio to 4 for GPU memory >= 8GB
- Set batch ratio to 2 for GPU memory >= 6GB
- Keep batch ratio at 1 for lower GPU memory sizes
parent 7210f7a6
...@@ -257,13 +257,15 @@ def may_batch_image_analyze( ...@@ -257,13 +257,15 @@ def may_batch_image_analyze(
if str(device).startswith('npu') or str(device).startswith('cuda'): if str(device).startswith('npu') or str(device).startswith('cuda'):
gpu_memory = int(os.getenv('VIRTUAL_VRAM_SIZE', round(get_vram(device)))) gpu_memory = int(os.getenv('VIRTUAL_VRAM_SIZE', round(get_vram(device))))
if gpu_memory is not None: if gpu_memory is not None:
if gpu_memory >= 20: if gpu_memory >= 24:
batch_ratio = 32
elif gpu_memory >= 16:
batch_ratio = 16 batch_ratio = 16
elif gpu_memory >= 15: elif gpu_memory >= 12:
batch_ratio = 8 batch_ratio = 8
elif gpu_memory >= 10: elif gpu_memory >= 8:
batch_ratio = 4 batch_ratio = 4
elif gpu_memory >= 7: elif gpu_memory >= 6:
batch_ratio = 2 batch_ratio = 2
else: else:
batch_ratio = 1 batch_ratio = 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment