-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Error: unpack_from requires a buffer of at least ... bytes for unpacking ... bytes at offset 4 (actual buffer size is ...) #7391
Comments
Something similar happened to me as well, we figured out a few things: First and most important, it seems the problem is the protobuf library version. Downgrading python's protobuf library from 5.27.2 to 5.27.1 fixed it. Second, the problem seems to be parsing a string or bytes length. It's transported as 1 byte of length then the buffer. However, instead of expanding the byte to 4 bytes by zero-extending, it repeats the byte 4 times. For example, in your example, the data is 3 bytes long ( I'm not sure if the problem is general in the protobuf library or specifically with how triton uses it, but since I've only seen the problem in triton I tend to think it's in the library usage. |
@ohad83 Thank you for your help - but unfortunately downgrading protobuf didn't work for me. I have tried several older versions of protobuf with no success. Although it is not the best solution, I did manage to get it working - by downgrading to Triton version 2.42 (docker container version 24.01), that was the newest Triton version which worked for me. |
I used 24.05 with conda packed environments for python models. At first everything was fine, then I repacked the environment and caused this problem. I fixed it by using pip inside container to install packages and stick to those versions when packing. Something definitely broke with recent updates. I haven't tried 24.06 yet. |
I found the reason:The triton Python backend already contains the numpy package. If your conda environment package also contains numpy and the version is inconsistent, compatibility issues may occur. The solution is to keep the numpy in your conda environment package consistent with the Python backend |
@adisabolic Do you still need support? |
I am also facing the same problem with Container Version 24.05 and Triton Inference Server Version 2.46.0.
|
Hello @adisabolic @suhaneshivam @ohad83 , The following PR should resolve this issue: triton-inference-server/python_backend#384. This fix will tentatively be a part of the 24.11 release. |
Description
I get the following error when using a
TYPE_STRING
input field in a triton model with Python backend:Looking at the
/opt/tritonserver/backends/python/triton_python_backend_utils.py
file, the line 117 is:sb = struct.unpack_from("<{}s".format(l), val_buf, offset)[0]
Triton Information
What version of Triton are you using?
I am using the docker base image
nvcr.io/nvidia/tritonserver:24.04-py3
with CUDA 12.4 installed on my Ubuntu machine 22.04.4 LTS (Jammy Jellyfish). Python version is 3.10.12.To Reproduce
I was able to make a minimal example for which I get the error.
config.pbtxt
of modelmodel.py
of modelexample client script
I have tried various things - from changing CUDA and Triton versions, changing Nvidia package versions, etc. None seems to work.
The text was updated successfully, but these errors were encountered: