-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpath_table.py
More file actions
70 lines (57 loc) · 2.49 KB
/
path_table.py
File metadata and controls
70 lines (57 loc) · 2.49 KB
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
import os
from pathlib import Path
from typing import List, Union
from ._utils._colors import print_note, print_warning
_PATH_TABLE = {
"llava-v1.5-7b": "liuhaotian/llava-v1.5-7b",
"llava-v1.5-13b": "liuhaotian/llava-v1.5-13b",
"llava-v1.6-vicuna-7b": "liuhaotian/llava-v1.6-vicuna-7b",
"llava-v1.6-vicuna-13b": "liuhaotian/llava-v1.6-vicuna-7b",
"llava-v1.6-34b": "liuhaotian/llava-v1.6-34b",
"Qwen-VL-Chat": "Qwen/Qwen-VL-Chat",
"POPE folder path": "./benchs/pope",
# You should set up these paths.
# Please download COCO dataset from https://cocodataset.org/
"COCO annotation": "path/to/annotations/instances_val2014.json",
"COCO path": "path/to/images/val2014",
# Please download GQA dataset from https://cs.stanford.edu/people/dorarad/gqa/download.html
"GQA path": "path/to/images",
# Please download MME Benchmark from https://huggingface.co/datasets/darkyarding/MME/blob/main/MME_Benchmark_release_version.zip
"MME root": "path/to/MME_Benchmark",
}
def get_path_from_table(name: str) -> Path:
if name not in _PATH_TABLE:
raise KeyError(f"'{name}' not found in path table.")
path = _PATH_TABLE[name]
print_note(f"Get '{name}' from path {path}")
return Path(path)
# _current_file_path = os.path.abspath(__file__) if "__file__" in globals() else None
# _ROOT_PATHS: List[Union[str, None]] = [
# os.getcwd(),
# os.path.dirname(_current_file_path) if _current_file_path else None,
# os.path.expanduser("~"),
# ]
# def get_path_from_table(name: str) -> Path:
# if name not in _PATH_TABLE:
# raise KeyError(f"Model '{name}' not found in path table.")
# path = _PATH_TABLE[name]
# if os.path.isabs(path):
# print_note(f"Get '{name}' from path {path}")
# return Path(path)
# checked_paths = []
# for root in _ROOT_PATHS:
# if root is None:
# continue
# full_path = os.path.join(root, path)
# try:
# checked_paths.append(full_path)
# # os.stat(path)
# # print_warning(f"Permission denied when reading {full_path!r}")
# if os.path.exists(full_path):
# print_note(f"Get {name!r} from path {full_path!r}")
# return Path(full_path)
# except Exception as e:
# print_warning(
# f"Unexpected error occurred while checking path {full_path!r}: {e}"
# )
# raise FileNotFoundError(f"Path for {name!r} not found. Checked {checked_paths}")