<p>I need to deploy a web app on OpenShift online platform which involves using a file that's stored on github repo with lfs.</p>
<p>When I built the app, I received this message:</p>
<pre><code>---&gt; Running application from Python script (app.py) ...
generated new fontManager
Traceback (most recent call last):
  File &quot;app.py&quot;, line 72, in &lt;module&gt;
   model.load_state_dict(torch.load(WEIGHTS_FILE, map_location=device))
  File &quot;/opt/app-root/lib/python3.6/site-packages/torch/serialization.py&quot;, line 585, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File &quot;/opt/app-root/lib/python3.6/site-packages/torch/serialization.py&quot;, line 755, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.
</code></pre>
<p>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.</p>
<p>I used to git pull the entire repo to the terminal when I used other web services platforms, e.g. GCP, Azure.</p>
<p>So is it possible to open a terminal console and then I could git pull the repo? Or, any other alternatives?</p>
<p>PS: I am building it with dockerfile and here is my repo: <a href="https://github.com/MemphisMeng/global-wheat-detection-web-app" rel="nofollow noreferrer">https://github.com/MemphisMeng/global-wheat-detection-web-app</a></p>

Memphis Meng
<p>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.</p>
<p>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 <code>docker run -v SOURCE:DESTINATION IMAGE_NAME</code></p>
<p>Resources</p>
<ul>
<li><a href="https://www.openshift.com/blog/experimenting-with-persistent-volumes" rel="nofollow noreferrer">https://www.openshift.com/blog/experimenting-with-persistent-volumes</a></li>
<li><a href="https://developers.redhat.com/blog/2017/10/26/configure-persistent-storage-openshift-kubernetes-development-environment/" rel="nofollow noreferrer">https://developers.redhat.com/blog/2017/10/26/configure-persistent-storage-openshift-kubernetes-development-environment/</a></li>
</ul>
