Spaces:
Sleeping
Sleeping
fix(ci): Use dvc pull by stage name and add dvc.lock
Browse files- .github/workflows/main.yaml +10 -5
.github/workflows/main.yaml
CHANGED
|
@@ -25,7 +25,7 @@ jobs:
|
|
| 25 |
- name: Install DVC and project requirements
|
| 26 |
run: |
|
| 27 |
pip install "dvc[gdrive]"
|
| 28 |
-
pip install -r requirements.txt
|
| 29 |
|
| 30 |
- name: Configure DVC
|
| 31 |
env:
|
|
@@ -34,15 +34,14 @@ jobs:
|
|
| 34 |
mkdir -p .dvc/tmp
|
| 35 |
echo "$GDRIVE_CREDENTIALS_DATA" > .dvc/tmp/gdrive-user-credentials.json
|
| 36 |
|
|
|
|
| 37 |
- name: Pull DVC Artifacts
|
| 38 |
-
run: dvc pull
|
| 39 |
|
| 40 |
-
# --- THIS IS THE FIX ---
|
| 41 |
- name: Log in to Hugging Face Hub
|
| 42 |
env:
|
| 43 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 44 |
run: |
|
| 45 |
-
# huggingface_hub is already installed via requirements.txt, but this is a safe fallback
|
| 46 |
pip install huggingface_hub
|
| 47 |
huggingface-cli login --token $HF_TOKEN
|
| 48 |
|
|
@@ -54,7 +53,13 @@ jobs:
|
|
| 54 |
git config --global user.email "action@github.com"
|
| 55 |
git config --global user.name "GitHub Action"
|
| 56 |
git clone https://huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME} hf_space_repo
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
rsync -av --delete app/ app.py requirements.txt README.md artifacts/model_training/model/ hf_space_repo/
|
| 59 |
cd hf_space_repo
|
| 60 |
git add .
|
|
|
|
| 25 |
- name: Install DVC and project requirements
|
| 26 |
run: |
|
| 27 |
pip install "dvc[gdrive]"
|
| 28 |
+
pip install -r requirements.txt
|
| 29 |
|
| 30 |
- name: Configure DVC
|
| 31 |
env:
|
|
|
|
| 34 |
mkdir -p .dvc/tmp
|
| 35 |
echo "$GDRIVE_CREDENTIALS_DATA" > .dvc/tmp/gdrive-user-credentials.json
|
| 36 |
|
| 37 |
+
# --- THIS IS THE FIX ---
|
| 38 |
- name: Pull DVC Artifacts
|
| 39 |
+
run: dvc pull -s model_training -f
|
| 40 |
|
|
|
|
| 41 |
- name: Log in to Hugging Face Hub
|
| 42 |
env:
|
| 43 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 44 |
run: |
|
|
|
|
| 45 |
pip install huggingface_hub
|
| 46 |
huggingface-cli login --token $HF_TOKEN
|
| 47 |
|
|
|
|
| 53 |
git config --global user.email "action@github.com"
|
| 54 |
git config --global user.name "GitHub Action"
|
| 55 |
git clone https://huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME} hf_space_repo
|
| 56 |
+
|
| 57 |
+
# We need to copy the dvc.yaml and dvc.lock files for the pull to work in the previous step
|
| 58 |
+
# This is incorrect. The pull happens before the clone. Let's fix the logic.
|
| 59 |
+
# The checkout action already brings dvc.yaml and dvc.lock
|
| 60 |
+
|
| 61 |
+
# The directory structure will be correct after the dvc pull.
|
| 62 |
+
# We just need to copy the final app and the pulled model.
|
| 63 |
rsync -av --delete app/ app.py requirements.txt README.md artifacts/model_training/model/ hf_space_repo/
|
| 64 |
cd hf_space_repo
|
| 65 |
git add .
|