-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.sh
executable file
·87 lines (78 loc) · 2.63 KB
/
setup.sh
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
#!/bin/bash
# General
## root dir, you can change it to your specified dir, but remember to change the path in the following script, root_dir in the config.py and src/utils/write_xxx.py
sudo mkdir -p ~/BT
sudo chmod -R 777 ~/BT
cd ~/BT
## plugins
sudo apt-get install software-properties-common tmux net-tools
# BridgeTower
## update Python
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8 python3.8-venv
## create virtual environment
cd ~/BT
python3.8 -m venv venv_BridgeTower
# echo "alias venv_BridgeTower='source ~/BT/venv_BridgeTower/bin/activate'" >> ~/.bashrc
# echo "source ~/BT/venv_BridgeTower/bin/activate" >> ~/.bashrc
source ~/.bashrc
## git clone
cd ~/BT
mkdir BridgeTower
# Please put here our code
cd ~/BT/BridgeTower
## dependency
source ~/BT/venv_BridgeTower/bin/activate
pip install --upgrade pip
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
pip install -r requirements.txt
pip install evalai
pip install --upgrade requests click python-dateutil
## mkdir
sudo mkdir -p ~/BT
sudo mkdir -p ~/BT/dataset/
sudo mkdir -p ~/BT/best_checkpoints/
sudo mkdir -p ~/BT/checkpoints/
sudo mkdir -p ~/BT/logs/
sudo chmod -R 777 ~/BT
## download data and checkpoints, and put them in ~/BT/dataset/ and ~/BT/best_checkpoints/
## the final file structure of ~/BT/dataset/ should be like this:
# root
# └── dataset
# ├── pre-train
# ├── fine-tune
# ├── sbu
# ├── cc
# ├── nlvr
# │ ├── dev
# │ ├── images
# │ ├── nlvr
# │ ├── nlvr2
# │ ├── test1
# │ └── README.md
# ├── vg
# │ ├── annotations
# │ ├── coco_splits
# │ ├── images
# │ ├── vgqa
# │ └── image_data.json
# └── mscoco_flickr30k_vqav2_snli_ve
# ├── flickr30k-images
# ├── karpathy
# ├── snli_ve
# ├── test2015
# ├── train2014
# ├── val2014
# └── vqav2
## then run the src/utils/write_xxx.py to convert the dataset to pyarrow binary file.
# python src/utils/write_coco_karpathy.py
# python src/utils/write_conceptual_caption.py
# python src/utils/write_f30k_karpathy.py
# python src/utils/write_nlvr2.py
# python src/utils/write_sbu.py
# python src/utils/write_vg.py
# python src/utils/write_vqa.py
# python src/utils/vgqa_split.py
# python src/utils/write_vgqa.py
# cp ~/BT/dataset/pre-train/coco_caption_karpathy_* ~/BT/dataset/fine-tune