              save_iteration = iteration % self._args.save_interval == 0 or iteration == 1
  
              if save_iteration or self._save_now or self._refresh_preview:
                  viewer = display_func
              else:
                  viewer = None
              timelapse = self._timelapse if save_iteration else None
 
</s> remove         self._display_mask = not self._display_mask
 </s> add         display_mask = not self._display_mask
        print("\n")  # Break to not garble loss output
        logger.info("Toggling mask display %s...", "on" if display_mask else "off")
        self._display_mask = display_mask </s> remove                 if is_preview and cv_key == ord("t"):
 </s> add                 if is_preview and cv_key == ord("m"): </s> remove                     self._refresh_preview = True
 </s> add  </s> remove         preview_trigger().clear()
 </s> add         preview_trigger().clear(trigger_type=None)
            if self._toggle_preview_mask:
                trainer.toggle_mask()
                self._toggle_preview_mask = False
                self._refresh_preview = True

              save_iteration = iteration % self._args.save_interval == 0 or iteration == 1
  
            if self._toggle_preview_mask:
                trainer.toggle_mask()
                self._toggle_preview_mask = False
                self._refresh_preview = True

              if save_iteration or self._save_now or self._refresh_preview:
                  viewer = display_func
              else:
                  viewer = None
              timelapse = self._timelapse if save_iteration else None
keep add keep keep keep keep keep
 Updates
  - Change shortcut key to M
  - Slight optimizations
  - GUI support for mask toggling 
scripts/train.py