Skip to content

Commit

Permalink
fix(api): only run CUDA GC on CUDA devices
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 26, 2023
1 parent 6809d2d commit e03b637
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/onnx_web/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def run_gc(devices: List[DeviceParams] = None):
gc.collect()

if torch.cuda.is_available() and devices is not None:
for device in devices:
for device in [d for d in devices if d.device.startswith("cuda")]:
logger.debug("running Torch garbage collection for device: %s", device)
with torch.cuda.device(device.torch_str()):
torch.cuda.empty_cache()
Expand Down

0 comments on commit e03b637

Please sign in to comment.