SpatialLM
3D-puntenwolk omzetten naar een plattegrond met muren, deuren, ramen en objecten, lokaal op de RTX 3070.
- Bron (X-post) https://x.com/0x0SojalSec/status/2108683699130970241
- Repository https://github.com/manycore-research/SpatialLM
Wat het allemaal doet
001 – SpatialLM experiment (LT007)
Bronnen
- X-post: https://x.com/0x0SojalSec/status/2108683699130970241
- Repo: https://github.com/manycore-research/SpatialLM (NeurIPS 2025)
- Model gebruikt: https://huggingface.co/manycore-research/SpatialLM1.1-Qwen-0.5B (kleinste, ~0.5B)
- Overige modellen: SpatialLM1.1-Llama-1B, SpatialLM-Llama-1B, SpatialLM-Qwen-0.5B
- Testdata: https://huggingface.co/datasets/manycore-research/SpatialLM-Testset (pcd/scene0000_00.ply)
SpatialLM leest een 3D-puntenwolk (z-as omhoog) en geeft een gestructureerde plattegrond terug: muren, deuren, ramen en objectboxen (bed, kast, ...) met categorie.
Systeemcheck (10-10-2026)
- RTX 3070 Laptop 8 GB, driver CUDA 13.2
- Python 3.12.5 (en 3.14), git 2.46. Geen conda, geen nvcc (CUDA toolkit), geen MSVC (cl.exe)
- C: ~2 GB vrij, D: ~29 GB vrij bij start, ~16 GB na installatie
Wat er staat (alles op D:)
| Pad | Inhoud |
|---|---|
| repo\ | git clone van SpatialLM (+1 regel patch, zie hieronder) |
| venv\ | Python 3.12 venv met alle deps (~6 GB) |
| hf\ | HF_HOME: model-cache |
| pipcache\ | PIP_CACHE_DIR (mag weg om ~3 GB vrij te maken) |
| tmp\ | TMP/TEMP |
| output\ | scene0000_00.txt (layout), scene0000_00.rrd (Rerun-visualisatie), inference.log |
| run_visualize.py | Windows-wrapper voor visualize.py |
| patch_flash.py | patch-script voor flash-attn fallback |
Stappen (PowerShell)
cd D:\APP_EXPERIMENT\001-spatiallm
$env:TMP="D:\APP_EXPERIMENT\001-spatiallm\tmp"; $env:TEMP=$env:TMP
$env:PIP_CACHE_DIR="D:\APP_EXPERIMENT\001-spatiallm\pipcache"
$env:HF_HOME="D:\APP_EXPERIMENT\001-spatiallm\hf"
$env:PYTHONUTF8="1"
git clone --depth 1 https://github.com/manycore-research/SpatialLM.git repo
py -3.12 -m venv venv
.\venv\Scripts\python.exe -m pip install torch==2.4.1 torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu124
.\venv\Scripts\python.exe -m pip install "transformers>=4.41.2,<=4.46.1" "safetensors>=0.4.5" pandas einops "numpy<2" scipy scikit-learn toml "tokenizers>=0.19,<0.20.4" "huggingface_hub[cli]<1" "rerun-sdk>=0.21,<0.22" shapely bbox terminaltables open3d addict timm spconv-cu124 "pyarrow<19"
.\venv\Scripts\python.exe -m pip install torch-scatter -f https://data.pyg.org/whl/torch-2.4.0+cu124.html
py -3.12 patch_flash.py
cd repo
..\venv\Scripts\huggingface-cli.exe download manycore-research/SpatialLM-Testset pcd/scene0000_00.ply --repo-type dataset --local-dir .
..\venv\Scripts\python.exe inference.py --point_cloud pcd/scene0000_00.ply --output ..\output\scene0000_00.txt --model_path manycore-research/SpatialLM1.1-Qwen-0.5B
..\venv\Scripts\python.exe ..\run_visualize.py --point_cloud pcd/scene0000_00.ply --layout ..\output\scene0000_00.txt --save ..\output\scene0000_00.rrd
..\venv\Scripts\rerun.exe ..\output\scene0000_00.rrd # opent de 3D-viewer
Resultaat
Inference werkt native op Windows met GPU (~32 s generatie, ~1 min totaal incl. laden). Uitvoer voor scene0000_00 (slaapkamer): 6 muren, 1 deur, 1 raam, 7 objecten (gordijn, kaptafel, kruk, bed, schilderij, nachtkastje, kledingkast). Visualisatie-bestand output\scene0000_00.rrd (10,8 MB) is gemaakt.
Problemen en oplossingen
- Geen conda/CUDA toolkit/MSVC: officieel pad (conda + cuda-toolkit + torchsparse/flash-attn bouwen) kan niet zonder installers. Opgelost door alleen kant-en-klare wheels te gebruiken: SpatialLM 1.1 (Sonata-encoder) heeft torchsparse niet nodig.
- spconv-cu120 heeft geen wheel voor Python 3.12: spconv-cu124 2.3.8 wel.
- flash-attn heeft geen Windows-wheel: 1 regel patch in repo\spatiallm\model\sonata_encoder.py valt terug op standaard attention als flash_attn ontbreekt. Iets trager/meer geheugen, werkt prima op 8 GB.
- pyarrow (nieuw) eist numpy 2, SpatialLM wil numpy<2: pyarrow<19 gepind.
- huggingface-cli crasht op Windows-console-encoding: zet PYTHONUTF8=1.
- open3d-DLL faalt als rerun/pyarrow eerst laadt (in visualize.py): run_visualize.py importeert open3d eerst.
- SpatialLM 1.0-modellen (torchsparse) niet getest: torchsparse moet gecompileerd worden (MSVC + CUDA toolkit).
Advies: native vs WSL vs Docker
- Native (huidig): werkt voor SpatialLM 1.1 inference + visualisatie, zonder admin, alles op D:. Aanrader voor experimenteren.
- WSL2/Docker: nodig als je het officiële pad wilt (flash-attn, torchsparse, finetunen). Eerst de WSL/Docker-data naar D: verplaatsen (wsl --export/--import of Docker Desktop > Settings > Resources > Disk image location), anders loopt C: vol.
- C: heeft maar ~1,5 GB vrij: ruim dat sowieso op.

