UnpicklingError: invalid load key, 'v'. in ml project deployed on streamlit

Hii users, I am getting invalid load key error while loading a pickle,

UnpicklingError: invalid load key, ‘v’ Traceback: File “/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 552, in _run_script exec(code, module.dict) File “/mount/src/movie-recommender-web-application/app.py”, line 36, in similarity = pickle.load(open(‘similarity.pkl’, ‘rb’))

  • I’ve made sure that the pickle file is in the same directory as my app.py file.
  • Here is the error I got:

  • Here is loading of pickle :slight_smile:
    image

  • Here is the requirements.txt
    image

I am using similarity.pkl, uploaded through git LFS, used by app.py in this following project
LINK

Here is Deploy_of_project

pickle version 4.0,
Streamlit version 1.25.0

Please help me resolving this error.

I assume that the download of this git-lfs file fails, because there is no .gitattributes file in the repo.
Or your monthly git-lfs quota has been exceeded.
Try to add this.

.gitattributes

*.pkl filter=lfs diff=lfs merge=lfs -text

Thank you, @Franky1. I didn’t know about .gitattributes, but now it is working fine.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.