https://www.boundaryml.com logo
Ho can I use BAML not with a pre-hosted
# general
g
Ho can I use BAML not with a pre-hosted model or a self-hosted one in VLLM but rather inferenced in process via pytorch/... how could I connect BAML in such a scenario?
v
Sadly the only way to do this is to put your PyTorch model behind a local http proxy and then ping it. We just haven’t had enough requests for this to provide something more native!
If this comes up more often, we would be happy to support this better!
g
Would something like this work:
i.e. just manually passing the strings around - but using BAML for the prompt management and parsing?
Perhaps a bit more background: I want to run open models from Huggingface on Ray for a multi-step pipeline (1) speech to text of audio (2) extraction of some structured data from the now available text The models themselves would already be running on ray. Usually, they are smallish to medium in size and ray may run an actor /instance of the model for a batch of inputs. Details: https://github.com/l-mds/duckpond/tree/main/projects/100_combined/ai_example/ai_example/defs/audio_ai and https://georgheiler.com/event/vienna-data-engineering-meetup-simple-sovereign-scalable-data-stack/ for the extraction I would love to use BAML. Or should I from ray start VLLM and have VLLM auto-scale on ray and just send API requests? It would feel more natural to not need one more layer of RPC
v
ah that makes much more sense
the modular api is def the easiest way to do this
but personally i always do this whenever i get the chance:
Copy code
[ API Server ] <-----> [ hosted model inference ]
the rpc layer is usually worth it because
hosted model inference
usually have diferent (and much more intense) infrastructure requrements than a measly
API Server
(thats also why we didn't prioritize inline calling of models so far πŸ™‚ )
g
Understandable. My case is: A batch data pipeline. I cannot use the public model hosters and have to self-inference the models. Given that I anyways will have to spin up some ray workers in k8s on spot gpus - do you think colocating the inferencing + parsing in the actor via the lower-level API makes sense?
Or would you advise for spinning our own VLLM + extra RPC roundtrip?
I will not have an extra team maintaining it 😒 so anything which is more self-contained would be preferred i.e. the single codebase on ray with one/some actors
v
I think you can do so in the same machine in that case! You'll just get lower throughput for you application and it'll cost a bit more since you'll have to keep paying for GPU time even when you're doing plain buisness logic work
but really there should be not much of an issue from a doing it the way you showed in the gist!
personally, i would just ask claude code to vibe code something that gives me a split easily and i suspect that will be easier than you think πŸ™‚ (at least for the infra here)
g
the gist came from claude πŸ˜‰ but I wanted to first check the overall concepts would align with what a BAML expert recommends
Given that the ray workers would only be active mainly during the GPU inference time there should not be a lot of extra cost
thx for this clarification
v
good luck! and share back what you learn! If you find something like "Damn, if BAML exposed XYZ, it would have made life so much better" we'll def consider it and see if we can take it on
the modular api came from that kind of request πŸ™‚
g
sure!
good to know