Skip to content

Instantly share code, notes, and snippets.

@sayakpaul
Created July 11, 2021 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayakpaul/4497062cbd43ee36ae0e9aed03e6f94c to your computer and use it in GitHub Desktop.
Save sayakpaul/4497062cbd43ee36ae0e9aed03e6f94c to your computer and use it in GitHub Desktop.
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
start_time = time.time()
for _ in range(1000):
with torch.no_grad():
model = model.to(DEVICE)
inputs = processor(text=[semantic_search_phrase],
images=all_images, return_tensors="pt", padding=True)
inputs = inputs.to(DEVICE)
outputs = model(**inputs)
end_time = time.time() - start_time
print(f"Total time: {end_time:.3f} seconds.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment