Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit e969e92

Browse files
authored
fix argparse error in yolo benchmarking (#111)
* fix argparse error in yolo benchmarking * update cuda sync condition * update installation instructions, yolo integration
1 parent 842b1e1 commit e969e92

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

integrations/ultralytics/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ git clone https://github.com/neuralmagic/sparseml.git
4040
# copy script
4141
cd yolov5
4242
git checkout c9bda11 # latest tested integration commit hash
43-
cp ../sparseml/integrations/ultralytics/*.py yolov5
44-
cp ../sparseml/integrations/ultralytics/deepsparse/*.py
43+
cp ../sparseml/integrations/ultralytics/*.py .
44+
cp ../sparseml/integrations/ultralytics/deepsparse/*.py .
4545

4646
# install dependencies
4747
pip install -r requirements.txt
@@ -139,4 +139,4 @@ Note for quantized performance, your CPU must support VNNI instructions.
139139

140140
### Server
141141
`sparseml/integrations/ultralytics/deepsparse/SERVER.md` contains relevant
142-
documentation for running the server and client examples.
142+
documentation for running the server and client examples.

integrations/ultralytics/deepsparse/benchmark.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ def parse_args():
231231
if args.engine == TORCH_ENGINE and args.device is None:
232232
args.device = "cuda:0" if torch.cuda.is_available() else "cpu"
233233

234+
return args
235+
234236

235237
def _parse_device(device: Union[str, int]) -> Union[str, int]:
236238
try:
@@ -390,7 +392,7 @@ def benchmark_yolo(args):
390392
progress_bar = tqdm(total=args.num_iterations)
391393

392394
for iteration, batch in enumerate(data_loader):
393-
if args.device != "cpu":
395+
if args.device not in ["cpu", None]:
394396
torch.cuda.synchronize()
395397
iter_start = time.time()
396398

@@ -407,7 +409,7 @@ def benchmark_yolo(args):
407409
# NMS
408410
outputs = postprocess_nms(outputs)
409411

410-
if args.device != "cpu":
412+
if args.device not in ["cpu", None]:
411413
torch.cuda.synchronize()
412414
iter_end = time.time()
413415

0 commit comments

Comments
 (0)