-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpkit-cli.py
66 lines (42 loc) · 1.53 KB
/
expkit-cli.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
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
from expkit.setup import ExpSetup
from expkit.storage import DiskStorage
from qflow.utils.eval import *
import json
# python expkit-cli.py --base_dir ~/quest-rlhf/gemma-outputs/ --mode clean
# python expkit-cli.py --base_dir ~/quest-rlhf/gemma-outputs/ --mode list --query_args {"n":64}
def main(
base_dir="outputs/",
mode="list",
query_args: str = {},
):
print(query_args)
# query_args = json.loads(str(query_args))
# r = {}
if mode == "list":
setup = ExpSetup(storage=DiskStorage(base_dir=base_dir, mode="r")).query(
query_args
)
for e in setup.experiments:
print(e.name)
elif mode == "clean":
setup = ExpSetup(storage=DiskStorage(base_dir=base_dir, mode="r")).query(
query_args
)
empty = setup.filter(lambda e: not e.has_data())
for e in empty:
print(e.name)
e.document_storage.delete()
elif mode == "count":
setup = ExpSetup(storage=DiskStorage(base_dir=base_dir, mode="r")).query(
query_args
)
print(len(setup.experiments))
else:
raise ValueError("Invalid mode - available options : {list,clean,count}")
# r[e.meta["model_path"]] = 1
# for k in r.keys():
# print(k)
if __name__ == "__main__":
import fire
fire.Fire(main)
# python expkit-cli.py --base_dir ../quest-rlhf/gemma-outputs/ --query_args '{"steps":1,"variant":"ancestral","model_path": "/gscratch/ark/graf/LLaMA-Factory/saves/gemma-2-2b-it/full/dposft/"}'