              return
  
          timestamps, loss = self._to_numpy(data, is_live)
  
          if not is_live or (is_live and not self._data.get(session_id, None)):
              self._data[session_id] = dict(labels=self._loss_labels,
                                            loss=zlib.compress(loss),
                                            loss_shape=loss.shape,
                                            timestamps=zlib.compress(timestamps),
                                            timestamps_shape=timestamps.shape)
          else:
              self._add_latest_live(session_id, loss, timestamps)
  
      def _to_numpy(self, data, is_live):
          """ Extract each individual step data into separate numpy arrays for loss and timestamps.
 
</s> remove     def _to_numpy(self, data, is_live):
 </s> add     def _to_numpy(self,
                  data: Dict[int, EventData],
                  is_live: bool) -> Tuple[np.ndarray, np.ndarray]: </s> remove         times, loss = zip(*[(data[idx].get("timestamp"), data[idx].get("loss", []))
                            for idx in sorted(data)])
        times, loss = self._process_data(data, times, loss, is_live)
 </s> add         times, loss = self._process_data(data, is_live) </s> remove         retval = {}
 </s> add         retval: Dict[int, Dict[str, np.ndarray]] = {} </s> remove             timestamp = update.get("timestamp")
            update["timestamp"] = carry_over["timestamp"] if timestamp is None else timestamp
            update.setdefault("loss", []).extend(carry_over.get("loss", []))
 </s> add             timestamp = update.timestamp
            update.timestamp = carry_over.timestamp if not timestamp else timestamp
            update.loss = carry_over.loss + update.loss </s> remove         cache = self._data[session_id]
        for metric in ("loss", "timestamps"):
            data = locals()[metric]
            dtype = "float32" if metric == "loss" else "float64"

            old = np.frombuffer(zlib.decompress(cache[metric]), dtype=dtype)
            if data.ndim > 1:
                old = old.reshape(-1, *data.shape[1:])

            new = np.concatenate((old, data))

            logger.debug("'%s' old_shape: %s new_shape: %s",
                         metric, cache[f"{metric}_shape"], new.shape)
            cache[f"{metric}_shape"] = new.shape
            cache[metric] = zlib.compress(new)
 </s> add         self._data[session_id].add_live_data(timestamps, loss)
        if not is_live or (is_live and not self._data.get(session_id)):
            self._data[session_id] = _CacheData(self._loss_labels, timestamps, loss)
              return
  
          timestamps, loss = self._to_numpy(data, is_live)
  
        if not is_live or (is_live and not self._data.get(session_id)):
            self._data[session_id] = _CacheData(self._loss_labels, timestamps, loss)
        if not is_live or (is_live and not self._data.get(session_id)):
            self._data[session_id] = _CacheData(self._loss_labels, timestamps, loss)
        if not is_live or (is_live and not self._data.get(session_id)):
            self._data[session_id] = _CacheData(self._loss_labels, timestamps, loss)
        if not is_live or (is_live and not self._data.get(session_id)):
            self._data[session_id] = _CacheData(self._loss_labels, timestamps, loss)
        if not is_live or (is_live and not self._data.get(session_id)):
            self._data[session_id] = _CacheData(self._loss_labels, timestamps, loss)
        if not is_live or (is_live and not self._data.get(session_id)):
            self._data[session_id] = _CacheData(self._loss_labels, timestamps, loss)
          else:
              self._add_latest_live(session_id, loss, timestamps)
  
      def _to_numpy(self, data, is_live):
          """ Extract each individual step data into separate numpy arrays for loss and timestamps.
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 Bugfixes
  - plugin.train.unbalanced - decoder b
  - gui.stats - crash when log folder deleted
  - setup.py - install gcc=12.1.0 on linux (scipy dep)
  - setup.py - don't test ROCm unless valid
  - typofix - cli_args extract singleprocess help
typing
  - lib.gui.analysis.event_reader
  - lib.gpu_stats.directml - make platform specific
unit tests
  - lib.gui.analysis.event_reader 
lib/gui/analysis/event_reader.py