I'm trying to reduce the inference time of a model I have to put in production. I did not design it. It takes ~200/300ms to infer.
I did the following to profile it :
with profile(activities=[ProfilerActivity.CPU], record_shapes=True) as prof:
with record_function("model_inference"):
trainer.test(model=model, datamodule=dm)
Here are the results
Going from there, what should be my next steps ?
It seems the data loading is taking most of the time ? Does it mean my Dataset subclass is slow ?
I can also see that the to(device) method take ~12% of the total cpu time. I will only be using CPUs, can I remove the to(device) calls everywhere as they are useless?
