-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
can't pass an object parameter to pipeline.run() #5636
Comments
Hey @faaany sorry for the late reply. I've seen your PR and I have to say I'm really torn on that... I believe there are reasons why we deepcopy kwargs, but the Pipeline code is so intricate I have a hard time proving whether it's necessary or not without investing a lot of time. So, before I go into a long chase to understand whether your change is safe or not, let's understand how blocking it is. Is it really necessary to pass the streaming handler as a parameter of the pipeline? What's the difference between this approach and giving such handler to PromptNode directly? |
for my usage scenario, this is necessary, because my pipeline is deployed using a pipeline YAML with REST API. If my front-end application doesn't send any requests to the backend, the pipeline won't run. So I need to pass the streaming handler param during runtime in order to get a streamed response. If I give such a handler to PromptNode directly, I will see the streamed output on my backend machine, but not in the front-end. I saw that many users in Discord asked for this feature. I think they also have similar problems as I do. |
And yes, it is a bit risky to replace deep copy with shallow copy. How about this approach: we can explicitly drop the stream_handler param from the kwargs and after the deep copy, we add it back to the parameter list? |
@vblagoje maybe you have more insights on this issue? |
Hey @faaany sorry for the late reply 🙈
I'm not sure I get this. How do you pass a streaming handler over HTTP? 👀 Maybe I didn't understand your explanation. Feel free to share a code example or a colab if that helps! |
@faaany I'm thinking about an alternative solution to your problem that wouldn't require this change. I'm not sure whether it would work though. I'm taking into consideration #5697 too. My idea would be to create a stream handler similar to Then we'd change It should be accessible with a similar logic:
Not elegant but it should do the job. I didn't test it but I believe that conceptually it should work, even if a bit convoluted. I very much prefer if we don't touch the |
@silvanocerza thanks for the idea! I will give it a try and let you know how it goes. |
Hey @faaany, any news on this? I'm curious to know if you managed to make it work. 👀 |
Hi @silvanocerza, sorry for my late response! We had long national holidays here in China and I also took some additional days off... I was not able to set this up before my holidays, but I will look at it this week and get back to you soon. Thank you for answering! |
Describe the bug
I implemented a FastAPITokenStreamingHandler object in the RESTAPI layer following the example mentioned in this PR and pass it as a parameter to
pipeline.run()
. The only difference to that example is that now I am using a pipeline instead of promptnode. My code is like this:But I then got the following error message:
Error message
Expected behavior
After debugging, I found that the problem lies in this line of code. Is there any particular reason that we use deep copy instead of shallow copy here? If no, I would suggest using shallow copy because the deep copy prevents passing an object to the underlying
pipeline.run()
FAQ Check
System:
The text was updated successfully, but these errors were encountered: