hi everyone, I am trying to use bentoml/openllm li...
# ask-for-help
z
hi everyone, I am trying to use bentoml/openllm library. I have a question regarding the minimum GPU requirements. as whenever I do openllm serve {model_name}, although the model should use 12 GB or 24 GB of GPU memory I find that the process is taking up to 72GB! the process name is venv/xxxx/bin/python. so if any help is appreciated why this high GPU utilization is happening and how to reduce it. Thank you in advance
c
This is likely due to it trying to reserve all available GPU memory for KV store - which caches intermediate states during inference, necessary for speed and throughput
z
do you know how can I stop such behavior as I need the GPU memory in other simultaneous operations @Chaoyu
c
yes there should be a config - @Jiang what’s the config for setting GPU utilization rate?
@Zeyad please note that KV store memory is critical for LLM inference performance. Reducing the memory for it can lead to significantly reduced performance, especially under heavily load
z
@Chaoyu yes that makes sense but like maybe I allocate like 5-7 extra GBs but does it make sense for a model of 12 GB to consume 72GB? @Jiang if you can assist with that please to how to control GPU utilization rate. Thanks you inadvance
c
Yes it’s normal behavior for LLM inference runtime to occupy all available memory by default for best performance. Most production use cases will be setup this way. You can configure it to use less but usually not recommend- it’s quite easy to run into OOM issues this way
z
@Chaoyu can you let me know how to control the occupation as I need to deploy other services on the same GPU and the openllm model utilizes it all, so I would like to know how to adjust the option and then test it
c
Are you running with Docker containers by any chance? or just by running
openllm serve
?
What GPU are you using?
If you are using a MIG supported GPU, this can be done by just limiting the GPU memory assigned for openllm container https://docs.nvidia.com/datacenter/tesla/mig-user-guide/index.html#supported-gpus
If not MIG supported GPU, try adding the following config - the default for GPU memory utilization is 0.9, you can try reduce the number to, for example, 0.3 (Use 30% of remaining GPU memory for caching)
Copy code
engine_config:
  gpu_memory_utilization: 0.3
I’m not sure what’s the best way to set this configuration - @Jiang could you help?
j
@Chaoyu You are correct. The inference engine vLLM will try to use more GPU memory as kv cache for longer context length, more concurrency and prefix caches. The default gpu_memory_utilization is 0.9. Tuning that config should do the trick.
z
@Chaoyu I am using Nvidia A100 but will check if MIG is supported. I am using a docker container yes and sometimes test with openllm serve to isolate any problems but the goal is to use docker. Nice thank you for providing this config will try it. But can you advise where to set this config? @Chaoyu @Jiang Like is it in a certain file or should be added in my docker-compose. Thanks
@Chaoyu @Jiang sorry for bothering you a lot but if you can assist please as I am blocked for several days where exactly to set that config, it would be appreciated
a
Hi there, there are two ways to approach with this: 1. If you just want to modify a specific parameters for a given model, then you can go directly to
$(openllm repo default)/bentoml/bentos
and modify the
openllm_config.yaml
configuration directly for the engine config. For example the configuration for llama3.2 is here:`/Users/work/.openllm/repos/github.com/bentoml/openllm-models/main/bentoml/bentos/llama3.2/11b-vision-instruct-1fbd/src/openllm_config.yaml` (note that this won’t persist once
openllm repo update
isused) 2. If you wish to persist these changes I recommend this and maintain a tree of your own modification of bentos (lmk if you need help with this). This option is more suitable when you have a suite of bentos that is derived from our main branch. You can then add the repo via
openllm repo add my-repo <https://github.com/aarnphm/my-openllm-repo-tree>
. The bento can the be used with
openllm run llama2 --repo my-repo
If you have any specific use case that requires more customisation then we are all ears 🙂
z
Hi @Aaron Pham thank you for the detailed help, really appreciated. Will start working and testing that and if other help needed will communicate with you. Thank you all for helping. 🙏
a
Lmk if there are anything else i dan help with. Feel free to ping me in this thread
👍 1