Loading model managed by Git LFS

Howdy y’all.

I’m new to this so forgive me if this is an overly simple question. I’m trying to deploy a model for classifying chromosomal abnormalities, but the “*.h5” file is not loading properly when I deploy via the cloud; it produces a FileNotFound Error. However, when I deploy the app locally it works as expected (see screenshots).

I’m thinking it might have to do with the fact that the model weights are managed by Git LFS. Anyone know if this idea makes sense or have any other clues why it might be working in my local environment and not from the repo? The model file was successfully pushed to my repo.

Thanks in advance!


[Update]

This error appears ~1 minute after my st reruns. Anyone have any ideas how to address the host key verification error verification mentioned below?

Updating files: 100% (649/649), done.iles has failed: git pull, cmd: sudo -u appuser GIT_SSH_COMMAND='ssh -i /home/appuser/.ssh/id_github -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o "LogLevel ERROR"' git fetch origin && sudo -u appuser git reset --hard origin/main: error: exit status 128: Updating files:  99% (648/649)
Downloading resources/models/02232021_512_res50_round1.h5.pth (308 MB)
Error downloading object: resources/models/02232021_512_res50_round1.h5.pth (d39f06c): Smudge error: Error downloading resources/models/02232021_512_res50_round1.h5.pth (d39f06cde3209115116f92a2991bfeffa3e9b24d5fd5f91252dabe2e8ca5fd37): batch request: Host key verification failed.: exit status 255

Errors logged to /app/chromosome-read/.git/lfs/logs/20220325T125420.316964331.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: resources/models/02232021_512_res50_round1.h5.pth: smudge filter lfs failed

I forked your github repo and had a look. Some quick remarks:

  • I cleaned and updated requirements.txt so that your app deploys now at least on Streamlit Cloud (Python 3.9 runtime), see my pull request on github.
  • Git-LFS works on Streamlit Cloud, i recently tested it with a github project.
  • I’m sorry to say that, but your streamlit_app.py code is quite a mess, full of bugs and the streamlit app barely works at all… :expressionless:

Hey, I appreciate you taking a look. No need to apologize. This is my first web app and I know it’s crude. It’s these kind of exchanges that will motivate me to become better. Got any favorite resources or developers to check out to learn from?

BTW, I reverted streamlit_app.py to try and load the model via git lfs (rather than with DropBox) but when I am still getting this error that indicates my model is not being downloaded by the streamlit app successfully.

[manager] Updating the app files has failed: git pull, cmd: sudo -u appuser GIT_SSH_COMMAND='ssh -i /home/appuser/.ssh/id_github -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o "LogLevel ERROR"' git fetch origin && sudo -u appuser git reset --hard origin/main: error: exit status 128: Downloading resources/models/03242022_resnet50.h5.pth (308 MB)
Error downloading object: resources/models/03242022_resnet50.h5.pth (db97b7f): Smudge error: Error downloading resources/models/03242022_resnet50.h5.pth (db97b7fbe53927583eb6c00a68ebc54c80b201309ef7c7149de78d016fee29e1): batch request: Host key verification failed.: exit status 255

Errors logged to /app/chromosome-read/.git/lfs/logs/20220327T030504.64824241.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: resources/models/03242022_resnet50.h5.pth: smudge filter lfs failed

Have any idea why that might be the case?

Not really.

I cherry picked the model file from your github repo and added it to my github repo and git committed it. Afterwards I had the same error as you.

However, I was able to eliminate the error after the following two attempts:

  • I removed the LFS file, did a git commit to github, added it again and committed it again to github.
  • I did a “reboot” of the app.

After that, the error was gone. Which of the two was causally responsible, I cannot say. I would first try a “reboot” :wink: