# Diagram Generation (DiagramGLIGEN) Instructions

## Setup
We start our code from GLIGEN repo. How to set up the environment can be found [here](https://github.com/gligen/GLIGEN/tree/master/env_docker).


## Training

First we need to set up the checkpoints, datafiles, and the output paths specified in the configuration file `./configs/Diagram_train.yaml`.


Then run the following commnand for DiagramGLIGEN training:
```
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -m torch.distributed.launch --nproc_per_node=8 main.py  --yaml_file=configs/Diagram_train.yaml  --batch_size=4
```

## Inference

First we need to set up the checkpoints, datafiles, and the output paths specified in the configuration file `./configs/Diagram_inference.yaml`.


Then run the following commnand for DiagramGLIGEN inference:
```
CUDA_VISIBLE_DEVICES=0 python main.py --mode inference --yaml_file=configs/Diagram_inference.yaml --output_folder DiagramGLIGEN_output --customized xxx
```

where `--customized` should be the path for the diagram plan json file generated from the first diagram planning stage.
