amaye15 commited on
Commit
a737583
·
1 Parent(s): 18f8eec

Old handler

Browse files
Files changed (1) hide show
  1. handler.py +2 -2
handler.py CHANGED
@@ -60,7 +60,7 @@ class EndpointHandler:
60
  self.logger.debug(f"Processing batch of {len(images)} images.")
61
  try:
62
  batch_images = self.processor.process_images(images).to(self.device)
63
- with torch.no_grad(), torch.amp.autocast():
64
  image_embeddings = self.model(**batch_images)
65
  self.logger.debug("Image batch processing complete.")
66
  return image_embeddings.cpu().tolist()
@@ -81,7 +81,7 @@ class EndpointHandler:
81
  self.logger.debug(f"Processing batch of {len(texts)} text queries.")
82
  try:
83
  batch_queries = self.processor.process_queries(texts).to(self.device)
84
- with torch.no_grad(), torch.amp.autocast():
85
  query_embeddings = self.model(**batch_queries)
86
  self.logger.debug("Text batch processing complete.")
87
  return query_embeddings.cpu().tolist()
 
60
  self.logger.debug(f"Processing batch of {len(images)} images.")
61
  try:
62
  batch_images = self.processor.process_images(images).to(self.device)
63
+ with torch.no_grad():
64
  image_embeddings = self.model(**batch_images)
65
  self.logger.debug("Image batch processing complete.")
66
  return image_embeddings.cpu().tolist()
 
81
  self.logger.debug(f"Processing batch of {len(texts)} text queries.")
82
  try:
83
  batch_queries = self.processor.process_queries(texts).to(self.device)
84
+ with torch.no_grad():
85
  query_embeddings = self.model(**batch_queries)
86
  self.logger.debug("Text batch processing complete.")
87
  return query_embeddings.cpu().tolist()