Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,106 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+

|
| 6 |
+

|
| 7 |
+
|
| 8 |
+
## Accountable Textual-Visual Chat Learns to Reject Human Instructions in Image Re-creation
|
| 9 |
+
|
| 10 |
+
The *official* repository for [Accountable Textual-Visual Chat Learns to Reject
|
| 11 |
+
Human Instructions in Image Re-creation]().
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
### Requirements
|
| 16 |
+
|
| 17 |
+
- Python 3.8
|
| 18 |
+
- matplotlib == 3.1.1
|
| 19 |
+
- numpy == 1.19.4
|
| 20 |
+
- pandas == 0.25.1
|
| 21 |
+
- scikit_learn == 0.21.3
|
| 22 |
+
- torch == 1.8.0
|
| 23 |
+
|
| 24 |
+
### Installation
|
| 25 |
+
|
| 26 |
+
We provide an environment file; ``environment.yml`` containing the required dependencies. Clone the repo and run the following command in the root of this directory:
|
| 27 |
+
```
|
| 28 |
+
conda env create -f environment.yml
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### Dataset
|
| 32 |
+
|
| 33 |
+
Please refer to [DOWNLOAD.md](data/DOWNLOAD.md) for dataset preparation.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
### Pretrained Models
|
| 37 |
+
Please refer to [pretrained-models](pretrained-models/README.md) to download the released models.
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
### Train
|
| 41 |
+
|
| 42 |
+
#### Training commands
|
| 43 |
+
|
| 44 |
+
+ To train the first stage:
|
| 45 |
+
```shell
|
| 46 |
+
bash dist_train_vae.sh ${DATA_NAME} ${NODES} ${GPUS}
|
| 47 |
+
```
|
| 48 |
+
+ To train the second stage:
|
| 49 |
+
```shell
|
| 50 |
+
bash dist_train_atvc.sh ${VAE_PATH} ${DATA_NAME} ${NODES} ${GPUS}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
#### Arguments
|
| 54 |
+
|
| 55 |
+
+ `${VAE_PATH}`: path of pretrained vae model.
|
| 56 |
+
+ `${DATA_NAME}`: dataset for training, e.g. `CLEVR-ATVC`, `Fruit-ATVC`.
|
| 57 |
+
+ `${NODES}`: number of node.
|
| 58 |
+
+ `${GPUS}`: number of gpus for each node.
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
### Test
|
| 62 |
+
|
| 63 |
+
#### Testing commands
|
| 64 |
+
|
| 65 |
+
+ To test image reconstruction ability of the first stage:
|
| 66 |
+
```shell
|
| 67 |
+
bash gen_vae.sh ${GPU} ${VAE_PATH} ${IMAGE_PATH}
|
| 68 |
+
```
|
| 69 |
+
+ To test atvc final model:
|
| 70 |
+
```shell
|
| 71 |
+
bash gen_atvc.sh ${GPU} ${ATVC_PATH} ${TEXT_QUERY} ${IMAGE_PATH}
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
#### Arguments
|
| 75 |
+
|
| 76 |
+
+ `${GPU}`: id of one gpu, e.g. `0`.
|
| 77 |
+
+ `${VAE_PATH}`: path of pretrained vae model.
|
| 78 |
+
+ `${IMAGE_PATH}`: image path for reconstrction, e.g. `input.png`.
|
| 79 |
+
+ `${ATVC_PATH}`: path of pretrained atvc model.
|
| 80 |
+
+ `${TEXT_QUERY}`: text-based query, e.g. `"Please put the small blue cube on top of the small yellow cylinder."`.
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
### License
|
| 84 |
+
|
| 85 |
+
`ATVC` is released under the [Apache 2.0 license](LICENSE).
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
### Citation
|
| 89 |
+
If you find this code useful for your research, please cite our paper
|
| 90 |
+
```
|
| 91 |
+
@article{zhang2023accountable,
|
| 92 |
+
title={Accountable Textual-Visual Chat Learns to Reject Human Instructions in Image Re-creation},
|
| 93 |
+
author={Zhang, Zhiwei and Liu, Yuliang},
|
| 94 |
+
journal={arXiv preprint arXiv:2303.05983},
|
| 95 |
+
year={2023}
|
| 96 |
+
}
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## Acknowledgement
|
| 100 |
+
|
| 101 |
+
Our code is learned from [DALLE-pytorch](https://github.com/lucidrains/DALLE-pytorch) and [CLIP](https://github.com/openai/CLIP). We would like to thank all the people who help label text-image pairs and participate in human evaluation experiments. We hope our explorations and findings contribute valuable insights regarding the accountability of textual-visual generative models.
|
| 102 |
+
|
| 103 |
+
## Contact
|
| 104 |
+
|
| 105 |
+
This project is developed by Zhiwei Zhang ([@zzw-zwzhang](https://github.com/zzw-zwzhang)) and Yuliang Liu ([@Yuliang-Liu](https://github.com/Yuliang-Liu)).
|
| 106 |
+
|