Spaces:
Running
Running
fix: pull model from models/
Browse files- DEPLOY_TO_HF.md +27 -3
- Dockerfile +1 -1
DEPLOY_TO_HF.md
CHANGED
|
@@ -5,8 +5,16 @@ This guide covers pushing the model and geodata to Hugging Face Hub and deployin
|
|
| 5 |
## Prerequisites
|
| 6 |
|
| 7 |
- Hugging Face account with write access to `developmentseed` organization
|
|
|
|
| 8 |
- HF access token: `hf auth login`
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
## 1. Push Model to Hugging Face
|
|
@@ -48,7 +56,9 @@ The HF Spaces Dockerfile expects the model at `models/ckpt-001.gguf`.
|
|
| 48 |
|
| 49 |
## 2. Push Geodata to Hugging Face
|
| 50 |
|
| 51 |
-
Upload the normalized geodata copies
|
|
|
|
|
|
|
| 52 |
|
| 53 |
### Prepare normalized data
|
| 54 |
|
|
@@ -59,6 +69,18 @@ data/overture_normalized/divisions_area/*.parquet
|
|
| 59 |
data/natural_earth_normalized/ne_geography.parquet
|
| 60 |
```
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
### Upload dataset
|
| 63 |
|
| 64 |
```bash
|
|
@@ -77,7 +99,7 @@ hf upload developmentseed/gazet-geodata \
|
|
| 77 |
--commit-message "Upload Natural Earth normalized data"
|
| 78 |
```
|
| 79 |
|
| 80 |
-
The repo
|
| 81 |
|
| 82 |
```
|
| 83 |
gazet-geodata/
|
|
@@ -88,6 +110,8 @@ gazet-geodata/
|
|
| 88 |
└── ne_geography.parquet
|
| 89 |
```
|
| 90 |
|
|
|
|
|
|
|
| 91 |
---
|
| 92 |
|
| 93 |
## 3. Deploy to Hugging Face Spaces
|
|
@@ -192,7 +216,7 @@ hf download developmentseed/gazet-model \
|
|
| 192 |
/models/ckpt-001.gguf \
|
| 193 |
--local-dir models
|
| 194 |
|
| 195 |
-
# Download geodata from HF
|
| 196 |
hf download developmentseed/gazet-geodata \
|
| 197 |
--repo-type dataset \
|
| 198 |
--local-dir data
|
|
|
|
| 5 |
## Prerequisites
|
| 6 |
|
| 7 |
- Hugging Face account with write access to `developmentseed` organization
|
| 8 |
+
- HF CLI installed: `uvx hf` or `pip install hf` or `brew install hf`
|
| 9 |
- HF access token: `hf auth login`
|
| 10 |
|
| 11 |
+
```bash
|
| 12 |
+
# Install HF CLI (choose one)
|
| 13 |
+
pip install hf
|
| 14 |
+
brew install hf
|
| 15 |
+
uvx hf # run without installing
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
---
|
| 19 |
|
| 20 |
## 1. Push Model to Hugging Face
|
|
|
|
| 56 |
|
| 57 |
## 2. Push Geodata to Hugging Face
|
| 58 |
|
| 59 |
+
Upload only the normalized geodata copies. The app uses `gazet.config` which automatically prefers normalized data when present.
|
| 60 |
+
|
| 61 |
+
> **Important**: Only upload normalized data to HF. Don't upload the original `overture/` or `natural_earth_geoparquet/` directories. This keeps the HF repo small and reduces download time during Space builds.
|
| 62 |
|
| 63 |
### Prepare normalized data
|
| 64 |
|
|
|
|
| 69 |
data/natural_earth_normalized/ne_geography.parquet
|
| 70 |
```
|
| 71 |
|
| 72 |
+
If not, create them from the original data:
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
# Create normalized directories
|
| 76 |
+
mkdir -p data/overture_normalized/divisions_area
|
| 77 |
+
mkdir -p data/natural_earth_normalized
|
| 78 |
+
|
| 79 |
+
# Copy and normalize
|
| 80 |
+
cp data/overture/divisions_area/*.parquet data/overture_normalized/divisions_area/
|
| 81 |
+
cp data/natural_earth_geoparquet/ne_geography.parquet data/natural_earth_normalized/
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
### Upload dataset
|
| 85 |
|
| 86 |
```bash
|
|
|
|
| 99 |
--commit-message "Upload Natural Earth normalized data"
|
| 100 |
```
|
| 101 |
|
| 102 |
+
The HF repo will only contain:
|
| 103 |
|
| 104 |
```
|
| 105 |
gazet-geodata/
|
|
|
|
| 110 |
└── ne_geography.parquet
|
| 111 |
```
|
| 112 |
|
| 113 |
+
This keeps the repo size minimal - only what's needed for deployment.
|
| 114 |
+
|
| 115 |
---
|
| 116 |
|
| 117 |
## 3. Deploy to Hugging Face Spaces
|
|
|
|
| 216 |
/models/ckpt-001.gguf \
|
| 217 |
--local-dir models
|
| 218 |
|
| 219 |
+
# Download geodata from HF (only normalized data is downloaded)
|
| 220 |
hf download developmentseed/gazet-geodata \
|
| 221 |
--repo-type dataset \
|
| 222 |
--local-dir data
|
Dockerfile
CHANGED
|
@@ -35,7 +35,7 @@ RUN uv sync --frozen --extra demo
|
|
| 35 |
# Download model from HF
|
| 36 |
RUN uv run python -c "\
|
| 37 |
from huggingface_hub import hf_hub_download; \
|
| 38 |
-
hf_hub_download('developmentseed/gazet-model', 'ckpt-001.gguf', local_dir='
|
| 39 |
|
| 40 |
# Download geodata from HF (repo structure matches app's expected layout)
|
| 41 |
RUN uv run python -c "\
|
|
|
|
| 35 |
# Download model from HF
|
| 36 |
RUN uv run python -c "\
|
| 37 |
from huggingface_hub import hf_hub_download; \
|
| 38 |
+
hf_hub_download('developmentseed/gazet-model', 'models/ckpt-001.gguf', local_dir='.')"
|
| 39 |
|
| 40 |
# Download geodata from HF (repo structure matches app's expected layout)
|
| 41 |
RUN uv run python -c "\
|