Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning dictionary instead of a list in provided callback to ThreadedStreamer #97

Open
cgr71ii opened this issue Feb 21, 2023 · 0 comments

Comments

@cgr71ii
Copy link

cgr71ii commented Feb 21, 2023

Hi!

Is it possible for ThreadedStreamer to return a dictionary instead of a list? I'm doing

ThreadedStreamer(batch_prediction, batch_size=args.batch_size, max_latency=0.1)

and I'd like that the function batch_prediction returned a dictionary since my model does multitask training and I have the result of multiple tasks, not just one.

When I try it, I got the following error:

Exception in thread thread_worker:                                                              
Traceback (most recent call last):                                                              
  File "/home/cgarcia/miniconda3/envs/PUC/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()                                                                                  
  File "/home/cgarcia/miniconda3/envs/PUC/lib/python3.8/threading.py", line 870, in run         
    self._target(*self._args, **self._kwargs)                                                   
  File "/home/cgarcia/miniconda3/envs/PUC/lib/python3.8/site-packages/service_streamer/service_streamer.py", line 154, in run_forever
    handled = self._run_once()                                                                  
  File "/home/cgarcia/miniconda3/envs/PUC/lib/python3.8/site-packages/service_streamer/service_streamer.py", line 189, in _run_once
    self._send_response(client_id, task_id, request_id, model_outputs[i])                       
KeyError: 0                                                                                     

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant