Class UDF usage consulting #4675
Unanswered
stayrascal
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys, I meet a problem during using class UDF about the init args, let's assume I have a
Operator
which accept some init args, the popular usage might be as follow:It's a little bit inconvenient for me that I have to set the init args at first to reset the
UDF
and then use it, so I try to create a wrapper function to handle it likellm_generate
, the detail as follow:Option A:
or
Option B:
Simillar to
llm_generate
The problem puzzling me is that is there any performance difference between these two options.
The option A using a Wrapper class which hold a external variable as a closure, and the wrapper class will be treat as a
UserDefinedPyFuncLike
and wrapper again and then pass to rust via Pyo3 as aRuntimePyObject
.Sine option A using a closure, some problems might occur, e.g. memory leak, serialization, concurrency problem, I'm not sure if it will occur in daft case, or the Option B is a better solution?
Beta Was this translation helpful? Give feedback.
All reactions