def METHOD_NAME(self):
    predictor = DefaultPredictor(self.cfg)
    while True:
        task = self.task_queue.get()
        if isinstance(task, AsyncPredictor._StopToken):
            break
        idx, data = task
        result = predictor(data)
        self.result_queue.put((idx, result))