1

I need to deploy a web app on OpenShift online platform which involves using a file that's stored on github repo with lfs.

When I built the app, I received this message:

---> Running application from Python script (app.py) ...
generated new fontManager
Traceback (most recent call last):
  File "app.py", line 72, in <module>
   model.load_state_dict(torch.load(WEIGHTS_FILE, map_location=device))
  File "/opt/app-root/lib/python3.6/site-packages/torch/serialization.py", line 585, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/opt/app-root/lib/python3.6/site-packages/torch/serialization.py", line 755, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.

I guess the reason must be that the weight file is stored by lfs. It looks like that OpenShift simply git pull the repo instead of git-lfs pull.

I used to git pull the entire repo to the terminal when I used other web services platforms, e.g. GCP, Azure.

So is it possible to open a terminal console and then I could git pull the repo? Or, any other alternatives?

PS: I am building it with dockerfile and here is my repo: https://github.com/MemphisMeng/global-wheat-detection-web-app

Memphis Meng
  • 1,267
  • 2
  • 13
  • 34
  • Have a look a this post - It might solve your problem... https://stackoverflow.com/questions/33049688/what-causes-the-error-pickle-unpicklingerror-invalid-load-key – Gail Wittich Aug 20 '20 at 05:05
  • 1
    I have exactly the same problem. It is a must to compress the assembly in one file .gz to pass it to the container. The GitHub limit doesn't allow me to do it. I need to get into a public Git repository in order to new-app in OpenShift – Andoni Ripoll Jarauta Mar 06 '23 at 13:25

1 Answers1

1

I am not sure how git-lfs plays while you build the Docker image. And also what type of Build strategy ( I assume docker build strategy since you have a Dockerfile here). I typically keep my model files separate from the Docker image in order to keep the image size smaller.

Instead, I create a persistent volume mount and have the model files loaded in that. Then make the volume mount part of the DeploymentConfig. This is very similar to docker run -v SOURCE:DESTINATION IMAGE_NAME

Resources

manisnesan
  • 11
  • 1