fnruha0921's picture
add code
eea5f0e verified
Raw History Blame Contribute Delete
1.1 kB
#!/bin/bash
# Runs on the vast.ai instance: install deps and download HF data subsets.
set -x
cd /workspace
pip install -q "segmentation-models-pytorch>=0.5" opencv-python-headless shapely tifffile imagecodecs pyarrow "huggingface_hub[hf_transfer]" nbconvert ipykernel aifactory 2>&1 | tail -2
export HF_HUB_ENABLE_HF_TRANSFER=1
mkdir -p data/flair data/tcd
python - <<'EOF'
from huggingface_hub import hf_hub_download, snapshot_download
import os
# FLAIR (Etalab 2.0): a few diverse departements (forest/mountain/rural/coastal)
for z in ["D006_2020", "D052_2019", "D074_2020", "D035_2020", "D029_2021", "D041_2021"]:
p = hf_hub_download("IGNF/FLAIR-1-2", f"data/train-val/{z}.zip", repo_type="dataset", local_dir="data/flair")
print("got", p, os.path.getsize(p) // 2**20, "MB", flush=True)
# OAM-TCD (CC BY 4.0) train split parquet
snapshot_download("restor/tcd", repo_type="dataset", local_dir="data/tcd", allow_patterns=["data/train-*"])
print("tcd done", flush=True)
EOF
cd data/flair/data/train-val && for f in *.zip; do unzip -q -o "$f" -d ../../unz && rm "$f"; done
echo SETUP_DONE