Upload single large file
Browse files- models/README.md +69 -0
models/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Project
|
| 2 |
+
|
| 3 |
+
This guide provides instructions for setting up the environment, training the model, and running inference.
|
| 4 |
+
|
| 5 |
+
## Quick Start
|
| 6 |
+
|
| 7 |
+
### 1. Environment Setup
|
| 8 |
+
|
| 9 |
+
Follow these steps to set up the required environment.
|
| 10 |
+
|
| 11 |
+
1. **Create and activate a new Conda environment:**
|
| 12 |
+
```bash
|
| 13 |
+
conda create -n creatidesign python=3.10 -y
|
| 14 |
+
conda activate creatidesign
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
2. **Install PyTorch with CUDA 12.0:**
|
| 18 |
+
```bash
|
| 19 |
+
conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.0 -c pytorch -c nvidia
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
3. **Install the remaining dependencies:**
|
| 23 |
+
```bash
|
| 24 |
+
pip install -r requirements.txt
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
### 2. Dataset Preparation
|
| 28 |
+
|
| 29 |
+
1. **Download the COCO dataset.**
|
| 30 |
+
2. Update the dataset path in the following file:
|
| 31 |
+
`dataloader/unilayout_coco.py`
|
| 32 |
+
|
| 33 |
+
### 3. Model Preparation
|
| 34 |
+
|
| 35 |
+
1. **Download the pre-trained model weights.**
|
| 36 |
+
2. Update the model path in the training script:
|
| 37 |
+
`train/train_coco.sh`
|
| 38 |
+
|
| 39 |
+
### 4. Training
|
| 40 |
+
|
| 41 |
+
To start training the model, run the following command:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
bash train/train_coco.sh
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### 5. Testing / Inference
|
| 48 |
+
|
| 49 |
+
To run inference using a trained model, execute the test script:
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
python test_coco.py
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## Configuration Notes
|
| 58 |
+
|
| 59 |
+
1. **Model Configuration:**
|
| 60 |
+
The main model configuration can be found and modified in `train_coco.py`.
|
| 61 |
+
|
| 62 |
+
2. **RMA (Region Mask Attention) Settings:**
|
| 63 |
+
You can enable or disable RMA based on your available GPU memory.
|
| 64 |
+
|
| 65 |
+
| Configuration | Settings in `train_coco.py` | Requirements & Performance |
|
| 66 |
+
|:---|:---|:---|
|
| 67 |
+
| **With RMA** (Full) | `mask_cross_attention_double_layers: 1`<br>`mask_cross_attention_single_layers: 1` | **Slower training speed.**<br>Requires > 96G of GPU memory. |
|
| 68 |
+
| **With RMA** (Partial) | `mask_cross_attention_double_layers: 0`<br>`mask_cross_attention_single_layers: 1` | <br>Requires > 64G of GPU memory (e.g., ~80G). |
|
| 69 |
+
| **Without RMA** | `mask_cross_attention_double_layers: 0`<br>`mask_cross_attention_single_layers: 0` | **Faster training speed.**<br>Requires < 64G of GPU memory. |
|