Skip to content

Commit 0b47746

Browse files
committed
LFS bug
1 parent c1194cc commit 0b47746

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

.github/workflows/deploy-to-hf.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,13 @@ jobs:
4040
exit 1
4141
fi
4242
43-
# Create a temporary directory for the space
44-
mkdir -p space_repo
45-
cd space_repo
46-
4743
# Configure git credentials for Hugging Face
4844
git config --global credential.helper store
4945
echo "https://user:${HF_TOKEN}@huggingface.co" > ~/.git-credentials
5046
51-
# Set default branch to main
52-
git config --global init.defaultBranch main
47+
# Create a temporary directory for the space
48+
mkdir -p space_repo
49+
cd space_repo
5350
5451
# Initialize git repository with LFS
5552
git init
@@ -63,7 +60,6 @@ jobs:
6360
echo "*.h5 filter=lfs diff=lfs merge=lfs -text" >> .gitattributes
6461
echo "*.onnx filter=lfs diff=lfs merge=lfs -text" >> .gitattributes
6562
66-
6763
# Copy necessary files
6864
cp ../README.md .
6965
cp ../app.py .
@@ -73,11 +69,14 @@ jobs:
7369
cp -r ../templates .
7470
cp -r ../static .
7571
76-
# Copy model weights if they exist
77-
if [ -f ../weights.pt ]; then
78-
echo "Found weights.pt, copying..."
79-
cp ../weights.pt .
80-
fi
72+
# Copy all .pt and .onnx files from the root directory
73+
echo "Checking for model files..."
74+
find .. -maxdepth 1 -type f -name "*.pt" -exec cp {} . \;
75+
find .. -maxdepth 1 -type f -name "*.onnx" -exec cp {} . \;
76+
77+
# List what we're about to commit
78+
echo "Files to be committed:"
79+
ls -lh
8180
8281
# Add and commit
8382
git add .gitattributes
@@ -87,16 +86,19 @@ jobs:
8786
git commit -m "Update NemaQuant app from GitHub Actions - ${{ github.sha }}"
8887
8988
# Push to Hugging Face Space (force push to handle initial setup)
90-
git push --force origin main
89+
git push --force origin master
9190
9291
- name: Summary
9392
run: |
9493
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
9594
echo "- **Hugging Face Space**: \`https://huggingface.co/spaces/${{ secrets.HUGGINGFACE_SPACE_REPO }}\`" >> $GITHUB_STEP_SUMMARY
9695
echo "- **Commit**: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
9796
echo "- **Status**: Successfully deployed to HF Spaces" >> $GITHUB_STEP_SUMMARY
98-
if [ -f space_repo/weights.pt ]; then
99-
echo "- **Model weights**: Included via Git LFS" >> $GITHUB_STEP_SUMMARY
100-
else
101-
echo "- **Model weights**: Not found (add weights.pt to enable)" >> $GITHUB_STEP_SUMMARY
102-
fi
97+
echo "" >> $GITHUB_STEP_SUMMARY
98+
echo "### Model Files:" >> $GITHUB_STEP_SUMMARY
99+
cd space_repo
100+
for file in *.pt *.onnx; do
101+
if [ -f "$file" ]; then
102+
echo "- ✅ $file ($(ls -lh "$file" | awk '{print $5}'))" >> $GITHUB_STEP_SUMMARY
103+
fi
104+
done

0 commit comments

Comments
 (0)