-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
41 lines (35 loc) · 1.77 KB
/
setup.py
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
import os
import gdown
import argparse
parser = argparse.ArgumentParser(prog='Generating Advprompter Data')
parser.add_argument('--model', default=False, action='store_true')
args = parser.parse_args()
# Download data dependencies
data_urls = [
'https://huggingface.co/datasets/hamishivi/alpaca-farm-davinci-003-2048-token/resolve/main/davinci_003_outputs.json',
'https://raw.githubusercontent.com/gururise/AlpacaDataCleaned/refs/heads/main/alpaca_data_cleaned.json',
'https://raw.githubusercontent.com/tatsu-lab/stanford_alpaca/refs/heads/main/alpaca_data.json',
'https://raw.githubusercontent.com/tatsu-lab/alpaca_eval/refs/heads/main/client_configs/openai_configs_example.yaml',
]
os.makedirs('data', exist_ok=True)
for data_url in data_urls:
data_path = 'data/' + data_url.split('/')[-1]
if os.path.exists(data_path): print(data_path, 'already exists.'); continue
cmd = 'wget -P data {data_url}'.format(data_url=data_url, data_path=data_path)
print(cmd)
os.system(cmd)
# Download model dependencies
if not args.model: exit()
model_paths = [
'huggyllama/llama-7b_SpclSpclSpcl_None_2024-06-02-00-00-00',
'mistralai/Mistral-7B-v0.1_SpclSpclSpcl_None_2024-07-20-01-59-11',
'huggyllama/llama-7b_SpclSpclSpcl_NaiveCompletion_2024-02-02-00-00-00',
'mistralai/Mistral-7B-v0.1_SpclSpclSpcl_NaiveCompletion_2024-07-20-05-46-17',
]
for model_path in model_paths:
if os.path.exists(model_path): print(model_path, 'already exists.'); continue
model_dir = model_path.split('/')[0]
os.makedirs(model_dir, exist_ok=True)
cmd = 'wget -P {model_dir} https://dl.fbaipublicfiles.com/SecAlign/{model_path} && unzip {model_path} -d {model_dir} && rm {model_path}'.format(model_path=model_path + '.zip', model_dir=model_dir)
print(cmd)
os.system(cmd)