Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timm_efficientdet: benchmark coverage for custom devices #2374

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions torchbenchmark/models/timm_efficientdet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ class Model(BenchmarkModel):

def __init__(self, test, device, batch_size=None, extra_args=[]):
super().__init__(test=test, device=device, batch_size=batch_size, extra_args=extra_args)
if not device == "cuda":
# Only implemented on CUDA because the original model code explicitly calls the `Tensor.cuda()` API
# https://github.com/rwightman/efficientdet-pytorch/blob/9cb43186711d28bd41f82f132818c65663b33c1f/effdet/data/loader.py#L114
raise NotImplementedError("The original model code forces the use of CUDA.")
# generate arguments
args = get_args()
# setup train and eval batch size
Expand Down Expand Up @@ -136,7 +132,8 @@ def __init__(self, test, device, batch_size=None, extra_args=[]):
mean=input_config['mean'],
std=input_config['std'],
num_workers=args.workers,
pin_mem=args.pin_mem)
pin_mem=args.pin_mem,
device=args.device)
self.loader = prefetch(self.loader, self.device, self.NUM_OF_BATCHES)
self.args = args
# Only run 1 epoch
Expand Down
2 changes: 2 additions & 0 deletions torchbenchmark/models/timm_efficientdet/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def create_datasets_and_loaders(
anchor_labeler=labeler,
transform_fn=transform_train_fn,
collate_fn=collate_fn,
device=args.device
)

if args.val_skip > 1:
Expand All @@ -83,6 +84,7 @@ def create_datasets_and_loaders(
anchor_labeler=labeler,
transform_fn=transform_eval_fn,
collate_fn=collate_fn,
device=args.device
)

evaluator = create_evaluator(args.dataset, loader_eval.dataset, distributed=args.distributed, pred_yxyx=False)
Expand Down
Loading