Add README
Browse files
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Parametric Floorplan Generator
|
| 2 |
+
|
| 3 |
+
A model that generates 2D construction/home floor plans from parametric input (room count, total area, room types, adjacency constraints).
|
| 4 |
+
|
| 5 |
+
## Approach
|
| 6 |
+
|
| 7 |
+
This model is based on the **DStruct2Design** paper ([arXiv:2407.15723](https://arxiv.org/abs/2407.15723)):
|
| 8 |
+
> *DStruct2Design: Data and Benchmarks for Data Structure Driven Generative Floor Plan Design*
|
| 9 |
+
|
| 10 |
+
The approach fine-tunes **Qwen2.5-1.5B-Instruct** with LoRA on the [ludolara/DStruct2Design](https://huggingface.co/datasets/ludolara/DStruct2Design) dataset, learning to output structured JSON floorplans from natural-language parametric constraints.
|
| 11 |
+
|
| 12 |
+
## Dataset
|
| 13 |
+
|
| 14 |
+
- **Source**: `ludolara/DStruct2Design`
|
| 15 |
+
- **Train**: 10,000 examples
|
| 16 |
+
- **Validation**: 1,000 examples
|
| 17 |
+
- **Test**: 1,000 examples
|
| 18 |
+
- **Format**: Each example contains:
|
| 19 |
+
- `room_count`: number of rooms
|
| 20 |
+
- `total_area`: total floor area in m²
|
| 21 |
+
- `room_types`: list of room type strings
|
| 22 |
+
- `rooms`: list of rooms with polygon vertices, area, width, height
|
| 23 |
+
- `edges`: adjacency graph (room index pairs)
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
### Training
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
pip install transformers trl torch datasets peft accelerate trackio
|
| 31 |
+
python train.py
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
### Inference
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
python generate.py --room_count 4 --total_area 100 --room_types Bedroom Bathroom Kitchen LivingRoom
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Example Output
|
| 41 |
+
|
| 42 |
+
For input:
|
| 43 |
+
```
|
| 44 |
+
Generate a floor plan with 4 rooms and a total area of 100 square meters.
|
| 45 |
+
The room types are: Bedroom, Bathroom, Kitchen, LivingRoom.
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
The model outputs JSON like:
|
| 49 |
+
```json
|
| 50 |
+
{
|
| 51 |
+
"rooms": [
|
| 52 |
+
{
|
| 53 |
+
"room_type": "Bedroom",
|
| 54 |
+
"area": 25.2,
|
| 55 |
+
"width": 6.1,
|
| 56 |
+
"height": 4.1,
|
| 57 |
+
"floor_polygon": [
|
| 58 |
+
{"x": 6.1, "z": 4.1},
|
| 59 |
+
{"x": 6.1, "z": 10.2},
|
| 60 |
+
{"x": 10.2, "z": 10.2},
|
| 61 |
+
{"x": 10.2, "z": 4.1}
|
| 62 |
+
],
|
| 63 |
+
"is_regular": 1
|
| 64 |
+
},
|
| 65 |
+
...
|
| 66 |
+
],
|
| 67 |
+
"edges": [[0,1], [0,2], [0,3], [1,3], [2,3]],
|
| 68 |
+
"room_count": 4,
|
| 69 |
+
"total_area": 100.0,
|
| 70 |
+
"room_types": ["Bedroom", "Bathroom", "Kitchen", "LivingRoom"]
|
| 71 |
+
}
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Architecture
|
| 75 |
+
|
| 76 |
+
| Component | Value |
|
| 77 |
+
|-----------|-------|
|
| 78 |
+
| Base Model | Qwen2.5-1.5B-Instruct |
|
| 79 |
+
| Fine-tuning | LoRA (r=16, alpha=32) |
|
| 80 |
+
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
|
| 81 |
+
| Epochs | 5 |
|
| 82 |
+
| Batch Size | 4 (accumulation=4) |
|
| 83 |
+
| Learning Rate | 1e-4 |
|
| 84 |
+
| Max Sequence Length | 2048 |
|
| 85 |
+
| Precision | bf16 |
|
| 86 |
+
|
| 87 |
+
## Links
|
| 88 |
+
|
| 89 |
+
- Paper: [DStruct2Design (arXiv:2407.15723)](https://arxiv.org/abs/2407.15723)
|
| 90 |
+
- Dataset: [ludolara/DStruct2Design](https://huggingface.co/datasets/ludolara/DStruct2Design)
|