Run this model with HF Jobs
Run Lukas3678/TopoDiff-v1-Alpine on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Lukas3678/TopoDiff-v1-Alpine. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Lukas3678/TopoDiff-v1-Alpine on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Lukas3678/TopoDiff-v1-Alpine with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Lukas3678/TopoDiff-v1-Alpine with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Lukas3678/TopoDiff-v1-Alpine", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- TopoDiff v1 (Alpine) β 30m β 5m β 0.5m Terrain Diffusion Cascade
- Visual Comparisons (Held-Out Dufourspitze Test Area)
- Out-of-Distribution Demo: K2 Massif (Karakoram, 4,894 m β 8,580 m)
- Benchmarks & Model Overview
- Repository Structure
- Study Regions (Switzerland β Train vs. Held-Out Test)
- Training & Validation Curves
- Quickstart (CLI & Live GUI)
- Limitations & Domain Scope (
v1-Alpine)
TopoDiff v1 (Alpine) β 30m β 5m β 0.5m Terrain Diffusion Cascade
TopoDiff is a two-stage physics-aware residual diffusion cascade (UNet2DModel, v-prediction, DDIM + Classifier-Free Guidance) that super-resolves coarse 30 m Digital Elevation Models (DEMs) via 5 m down to 0.5 m ground resolution.
- Version:
v1-Alpineβ trained exclusively on high-alpine SwissALTI3D (0.5 m) data (Aletsch Glacier & Matterhorn,568 kmΒ²) and evaluated strictly out-of-distribution on the Dufourspitze (94 kmΒ²) region. (Plannedv2-Globalwill extend TopoDiff across deserts, plains, karst, and coastal biomes worldwide.) - Weights: Stored cleanly in
.safetensorsformat insideweights/. - Includes: Standalone CLI (
src/topodiff_cli.py), Live Interactive GUI (src/topodiff_gui.pyβ watch DDIM denoising and mosaic assembly in real time!), training script (src/train_topodiff.py), swisstopo dataset CSV manifests (dataset_csv/), and pre-rendered GeoTIFFs for QGIS (assets/qgis_dufour/).
Visual Comparisons (Held-Out Dufourspitze Test Area)
Stage 1 (30 m β 5 m) β 1.2 km Γ 1.2 km Summit Crop
Full Cascade (30 m β 5 m β 0.5 m) β 300 m Γ 300 m Summit Crop
Out-of-Distribution Demo: K2 Massif (Karakoram, 4,894 m β 8,580 m)
Even though TopoDiff-v1-Alpine was trained solely in the Swiss Alps (β€ 4,634 m), it generalizes zero-shot to a large 7.29 km Γ 7.89 km (14,580 Γ 15,780 px at 0.5 m) crop over K2 (EPSG:32643). Both the 30 m input, the 5 m Stage 1 output, and the full 0.5 m cascade GeoTIFFs are included in assets/k2_demo/.
Benchmarks & Model Overview
| Stage | Resolution | Architecture | Weights | Held-Out Dufourspitze Benchmark |
|---|---|---|---|---|
| Stage 1 | 30 m β 5 m (6Γ) |
UNet2DModel (64, 128, 256, 512) Β· 57.89M params |
weights/stage1_30m_to_5m.safetensors |
RMSE 2.86 m Β· MAE 1.61 m (vs. Bicubic: 3.87 m RMSE) |
| Stage 2 | 5 m β 0.5 m (10Γ) |
UNet2DModel (96, 192, 384, 512) Β· 76.42M params |
weights/stage2_5m_to_05m.safetensors |
Val-RMSE 0.70 m (Epoch 23) |
| Full Cascade | 30 m β 5 m β 0.5 m (60Γ) |
Stage 1 + Stage 2 (1.5 Γ 1.5 km summit core) |
Both stages | RMSE 3.73 m Β· MAE 2.20 m (vs. Bicubic: 5.09 m RMSE) |
Repository Structure
TopoDiff-v1-Alpine/
βββ README.md # Model card & overview
βββ requirements.txt # Python dependencies
βββ weights/
β βββ stage1_30m_to_5m.safetensors # Stage 1 UNet2DModel (30m -> 5m)
β βββ stage2_5m_to_05m.safetensors # Stage 2 UNet2DModel (5m -> 0.5m)
βββ src/
β βββ topodiff_core.py # Model architecture, safetensors loader & live tiled diffusion engine
β βββ topodiff_cli.py # CLI tool for upscaling GeoTIFF DEMs (supports --demo)
β βββ topodiff_gui.py # Live Tkinter + Matplotlib GUI (real-time denoising & mosaic view)
β βββ train_topodiff.py # Reproducible training script
βββ docs/
β βββ ARCHITECTURE.md # Residual diffusion, slope/curvature conditioning & loss math
β βββ TUTORIAL_CLI_GUI.md # Step-by-step usage guide for GUI, CLI & Python API
β βββ DATASET.md # SwissALTI3D dataset details & curl download instructions
β βββ QGIS_3D_GUIDE.md # 2D Hillshade & 3D Terrain visualization in QGIS
βββ dataset_csv/
β βββ ch.swisstopo.swissalti3d-hfx01UGd.csv # 485 Aletsch Glacier training tiles
β βββ ch.swisstopo.swissalti3d-matterhorn.csv# 83 Matterhorn training tiles
β βββ ch.swisstopo.swissalti3d-dufour.csv # 94 Dufourspitze held-out test tiles
βββ assets/
βββ region_map.png # Zoomed swisstopo map of all train & test tiles
βββ training_curves.png # Training & validation curves (Stage 1 & Stage 2)
βββ compare_5m/ # Stage 1 (5m) 2D & 3D comparison figures
βββ qgis_dufour/ # Full cascade (0.5m) GeoTIFFs & previews ready for QGIS
βββ k2_demo/ # Large 7.3 Γ 7.9 km K2 demo (30m, 5m & 0.5m GeoTIFFs + hillshades)
Study Regions (Switzerland β Train vs. Held-Out Test)
All 662 source GeoTIFF download URLs (EPSG:2056, 0.5 m ground resolution) are included in dataset_csv/. See docs/DATASET.md for download commands.
Training & Validation Curves
Quickstart (CLI & Live GUI)
git clone https://huggingface.co/Lukas3678/TopoDiff-v1-Alpine
cd TopoDiff-v1-Alpine
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Launch the Live Interactive GUI
Watch DDIM denoising and mosaic tiling happen live on screen:
python src/topodiff_gui.py
Run via CLI
Quick test on a synthetic alpine peak (30 m -> 5 m):
python src/topodiff_cli.py --demo --target 5m --output demo_5m.tif --preview demo_preview.png
Upscale your own metric 30 m GeoTIFF all the way to 0.5 m:
python src/topodiff_cli.py --input my_30m_dem.tif --output out_05m.tif --target 0.5m --preview comparison.png
Detailed Documentation
- docs/TUTORIAL_CLI_GUI.md β Full CLI, Live GUI & Python API tutorial
- docs/ARCHITECTURE.md β Model architecture, physics conditioning & loss formulation
- docs/DATASET.md β SwissALTI3D regions & CSV download guide
- docs/QGIS_3D_GUIDE.md β Loading outputs in QGIS for 2D Hillshade & 3D Terrain view
Limitations & Domain Scope (v1-Alpine)
- Trained exclusively on high-alpine Swiss terrain (
~600 mβ4,634 m). Applyingv1-Alpineto flat plains, sand dunes, or urban areas can produce spurious rock-like ridges. - Input GeoTIFFs must be in a projected metric CRS (e.g.
EPSG:2056or UTM) with elevations in meters. - Elevation and reference map data source: Β© swisstopo (SwissALTI3D).
- Downloads last month
- -





