docstr: Filter finished requests from the batch, the finished ones will be removed from 'reqs'.
docstr_tok: ["Filter","finished","requests","from","the","batch",",","the","finished","ones","will","be","removed","from","'reqs","'","."]
code: def filter_finished(self) -> List[Req]:
      """
      Filter finished requests from the batch, the finished ones will be removed from 'reqs'.
      """
      # TODO: the logic of return should be defined here.
      unfinished_req = []
      finished_req = []
      for req in self.reqs:
          if not req.has_generate_finished:
              unfinished_req.append(req)
          else:
              finished_req.append(req)
      self.reqs = unfinished_req
      self.id_to_reqs = {req.request_id: req for req in self.reqs}
      return finished_req
  
imports: from typing import Dict, List, Tuple
  from .sampling_params import SamplingParams
label_desc: Use image node_id 6 for calling the Batch obj's underlying member method code with example usage: obj.filter_finished() and returns: finished_req