derektan commited on
Commit
51adbef
·
1 Parent(s): 246abd7

Attempt to deallocate before regenerating heatmap:

Browse files
Taxabind/TaxaBind/SatBind/clip_seg_tta.py CHANGED
@@ -430,9 +430,6 @@ class ClipSegTTA:
430
  species_name=self.species_name
431
  )
432
 
433
- # Save final heatmap after TTA steps
434
- self.generate_heatmap(img, imo, txt, sound=sound, modality=modality)
435
-
436
  ## NOTE: Added due to app.py (to allocate to GPU only when needed on HF)
437
  # if self.device.type == "cuda":
438
  print("Deallocating models from GPU...")
@@ -441,6 +438,10 @@ class ClipSegTTA:
441
  self.model_local.imo_encoder.to(self.device)
442
  self.model_local.bio_model.to(self.device)
443
 
 
 
 
 
444
  def generate_query_embeds(self, img, imo, txt, sound=None, modality="image"):
445
 
446
  # Query Embeds
 
430
  species_name=self.species_name
431
  )
432
 
 
 
 
433
  ## NOTE: Added due to app.py (to allocate to GPU only when needed on HF)
434
  # if self.device.type == "cuda":
435
  print("Deallocating models from GPU...")
 
438
  self.model_local.imo_encoder.to(self.device)
439
  self.model_local.bio_model.to(self.device)
440
 
441
+ # Save final heatmap after TTA steps
442
+ self.generate_heatmap(img, imo, txt, sound=sound, modality=modality)
443
+
444
+
445
  def generate_query_embeds(self, img, imo, txt, sound=None, modality="image"):
446
 
447
  # Query Embeds