Decoder2704/python-chatbot-jay
0
1# Ship `backend/artifacts/*.pkl` to Hugging Face Docker2 3If the Space fails with missing `vectorizer.pkl` / `question_vectors.pkl` / `chatbot_df.pkl`, the files were usually **not in git** or **not in the Docker build context**.4 5---6 7## 1. Verify locally8 9```bash10python3 backend/debug/verify_artifacts_for_deploy.py11```12 13Expect three `OK` lines with non-zero byte sizes.14 15---16 17## 2. Track files in git18 19`.gitignore` allows only `backend/artifacts/*.pkl` (not other junk in that folder).20 21```bash22git add -f backend/artifacts/*.pkl23git ls-files backend/artifacts24```25 26You should see the three `.pkl` paths.27 28---29 30## 3. Commit and push31 32```bash33git add .gitignore .dockerignore Dockerfile backend/app/main.py backend/debug/verify_artifacts_for_deploy.py34git commit -m "Fix: track retrieval artifacts for HF Docker deployment"35git push origin main36```37 38Use your real remote/branch instead of `origin main` if different. For a Hugging Face git remote, e.g.:39 40```bash41git push hf main42```43 44---45 46## 4. Validate inside a local container47 48```bash49docker build -t pybot-chatbot .50docker run --rm -d --name pybot-test -p 7860:7860 pybot-chatbot51docker exec pybot-test ls -la /app/backend/artifacts52docker stop pybot-test53```54 55Expect the three `.pkl` files listed with non-zero sizes.56 57---58 59## 5. Space logs60 61After deploy, open the Space **Logs**. You should see lines like:62 63`Deploy probe: artifact directory file names: [...]` 64`Deploy probe: vectorizer.pkl ... exists=True bytes=...`65 66If `exists=False` or the list is empty, the build context on HF did not contain the files — confirm **git push** included them and rebuild the Space.67 