File size: 2,886 Bytes
11efd6b
6b6c80c
 
 
 
b782be8
 
11efd6b
6b6c80c
92677c1
 
 
5ebd5ee
04ec9bf
 
 
5ebd5ee
b782be8
11efd6b
 
6b6c80c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4e244a4
 
 
9c665e8
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
title: ObjectAssembler - LEGO 3D Assembly Prediction
emoji: 🧱
colorFrom: blue
colorTo: red
sdk: docker
app_port: 7860
pinned: false
license: mit
preload_from_hub:
  - 0xZohar/object-assembler-models
  - openai/clip-vit-base-patch32
env:
  HF_HOME: /home/user/.cache/huggingface
  HF_HUB_CACHE: /home/user/.cache/huggingface/hub
  TRANSFORMERS_CACHE: /home/user/.cache/huggingface/transformers
  HF_HUB_DISABLE_XET: "1"
  LDRAW_LIBRARY_PATH: /home/user/ldraw
---

# ObjectAssembler: Assemble Your Object with Diverse Components

A deep learning-based system for predicting and visualizing LEGO brick assembly sequences using transformer models.

## Features

- **LDR File Processing**: Upload `.ldr` (LDraw format) files containing LEGO brick assembly instructions
- **Text-to-LEGO**: Describe your desired design in natural language (e.g., "red sports car")
- **AI-Powered Prediction**: Uses GPT-based transformer models to predict optimal assembly sequences
- **3D Rendering**: Generates high-quality 3D visualizations using Blender
- **Part Visualization**: Displays individual brick components with rendered previews
- **Interactive UI**: User-friendly Gradio interface for easy interaction

## Model Architecture

- **GPT Model**: 5-layer transformer with 12 attention heads
- **Shape Tokenizer**: VQ-VAE autoencoder with 16,384 token vocabulary
- **CLIP Integration**: Vision-language model for text-to-design retrieval
- **Model Size**: ~1.6GB total weights

## Usage

### Option 1: Upload LDR File
1. Upload an `.ldr` file containing LEGO part names
2. Click "Load Input" to process and visualize individual parts
3. Click "Generate New LDR & Render" to predict assembly sequence
4. Download the generated LDR file or view the 3D rendering

### Option 2: Text-to-LEGO
1. Enter a text description (e.g., "red sports car", "blue police car")
2. Click "Load Input" to retrieve a similar design
3. Click "Generate New LDR & Render" to generate assembly sequence
4. View the AI-generated LEGO model

## Hardware Requirements

- **GPU**: Runs on HuggingFace ZeroGPU (H200, 70GB VRAM)
- **Memory**: At least 8GB RAM
- **Storage**: ~2GB for model weights and dependencies

## Technical Stack

- PyTorch 2.0+
- Gradio 5.12.0+
- Blender 3.6 (for rendering)
- Transformers (Hugging Face)
- CLIP (OpenAI)
- **ZeroGPU** for efficient GPU allocation

## Citation

If you use this work in your research, please cite:

```bibtex
@article{objectassembler2024,
  title={ObjectAssembler: Assemble Your Object with Diverse Components},
  year={2024}
}
```

## License

MIT License

## Acknowledgments

Built with PyTorch, Gradio, Blender, and HuggingFace ZeroGPU.

---

**Latest Update (2025-11-24)**: Enhanced LDraw library verification with detailed part counts and critical part checks.

**Previous Update (2025-11-14)**: Added complete label mapping files for Text-to-LEGO functionality.