Error: model_kwargs["past_key_values"] is "None"

#4
by Jian8 - opened

model_kwargs["past_key_values"] is "None"
The error content is as shown below:
image.png
utils.py path: xgen.venv\Lib\site-packages\transformers\generation\utils.py

I have installed: https://huggingface.co/Salesforce/xgen-mm-phi3-mini-instruct-r-v1#troubleshoot
And, I have installed the latest version of transformers 4.41.0:pip install transformers
Then I execute these codes: https://huggingface.co/Salesforce/xgen-mm-phi3-mini-instruct-r-v1#how-to-use
Then, I encountered the above error. I use Win10, PyCharm 2024.1.1 (Professional Edition).
Please help me solve this problem, many thanks.

Same thing happens using Ubuntu 20.04, Python 3.10.11...

I have solved this problem. I only need to modify the error code like this:
if "past_key_values" in model_kwargs:
=>
if "past_key_values" in model_kwargs and model_kwargs["past_key_values"]:

image.png

I think this is a bug of the lastest transformer.

Wow it works! Thank you so much.

you are a straight up genius

Salesforce org

Hi @Jian8 @PeePants , and @RiverFlows , we have updated the inference code so that you don't need to hack the transformers's code. Our inference code is compatible with transformers==4.41.1. Please give it a try and let us know if you have any issues. Thanks!

UncleFish changed discussion status to closed

Sign up or log in to comment