:wave: Hi everyone! Thanks for making daft, I've b...
# general
t
👋 Hi everyone! Thanks for making daft, I've been having a great time trying it out. Ran into a little bit of a snag today with inference using the ray backend though. It looks like it is re-initializing the stateful udf for every batch. Is there any way to force it to only perform initialization once to avoid the overhead of pulling the model and re-hydrating it every batch?
👀 1
🙌 1
k
Hi Tyler! Just to make sure, are you setting the
DAFT_ENABLE_ACTOR_POOL_PROJECTIONS
environment variable? Our stateful UDFs currently are gated behind that config
t
Ah no I am not! I'll try that. Do I need to set it in the
ray.init
env vars as well or only from the driver process?
k
If you're running on ray, you can just set it in the Python script of your Ray job. Something like
Copy code
import os
os.environ["DAFT_ENABLE_ACTOR_POOL_PROJECTIONS"] = "1"

import daft
# your code here
t
Sweet, giving that a go now.
k
With that flag set, you will also need to specify a concurrency that you'd like your stateful UDFs to run with. You can do this with
udf = udf.with_concurrency(n)
Also btw, we're stabilizing this API soon and will enable it by default in our next release! Will keep you posted
t
Awesome. That's great news. Will let you know how it goes.
❤️ 2
Works great. Thanks for the help.
🙌 1
k
Great to hear!