lbx511 commited on
Commit
bc888c2
·
verified ·
1 Parent(s): 5fe0db6

Add files using upload-large-folder tool

Browse files
scripts/__pycache__/inference.cpython-311.pyc CHANGED
Binary files a/scripts/__pycache__/inference.cpython-311.pyc and b/scripts/__pycache__/inference.cpython-311.pyc differ
 
scripts/__pycache__/robobrain_runner.cpython-311.pyc CHANGED
Binary files a/scripts/__pycache__/robobrain_runner.cpython-311.pyc and b/scripts/__pycache__/robobrain_runner.cpython-311.pyc differ
 
scripts/inference.py CHANGED
@@ -11,7 +11,6 @@ if _SUBMIT_ROOT not in sys.path:
11
 
12
  _LM_PATH = os.path.join(_SUBMIT_ROOT, "model", "LM")
13
  _VL_B_PATH = os.path.join(_SUBMIT_ROOT, "model", "VL-B")
14
- _VL_F_PATH = os.path.join(_SUBMIT_ROOT, "model", "VL-F")
15
  _DIRECTION_MAP_PATH = os.path.join(_SCRIPTS_DIR, "object_direction_map.yaml")
16
 
17
 
@@ -33,7 +32,6 @@ def load_robospatialBrain_models(low_memory=False):
33
  "direction_map": direction_map,
34
  "low_memory": True,
35
  "_vl_b_path": _VL_B_PATH,
36
- "_vl_f_path": _VL_F_PATH,
37
  "_current_vl": None,
38
  "_current_vl_type": None,
39
  }
@@ -41,13 +39,9 @@ def load_robospatialBrain_models(low_memory=False):
41
  vl_b = load_robobrain(_VL_B_PATH)
42
  torch.cuda.empty_cache()
43
 
44
- vl_f = load_robobrain(_VL_F_PATH)
45
- torch.cuda.empty_cache()
46
-
47
  return {
48
  "lm_clf": lm_clf,
49
  "vl_b": vl_b,
50
- "vl_f": vl_f,
51
  "direction_map": direction_map,
52
  "low_memory": False,
53
  }
@@ -60,17 +54,16 @@ def _swap_vl(kwargs, needed_type, load_robobrain):
60
  kwargs["_current_vl"].clear()
61
  kwargs["_current_vl"] = None
62
  torch.cuda.empty_cache()
63
- path = kwargs["_vl_f_path"] if needed_type == "F" else kwargs["_vl_b_path"]
64
- kwargs["_current_vl"] = load_robobrain(path)
65
  kwargs["_current_vl_type"] = needed_type
66
 
67
 
68
  def _run_compatibility(question, image_path, kwargs, low_memory, run_robobrain, load_robobrain):
69
  if low_memory:
70
- _swap_vl(kwargs, "F", load_robobrain)
71
  return run_robobrain(question, image_path, None, kwargs["_current_vl"], LM_classify="compatibility")
72
  else:
73
- return run_robobrain(question, image_path, None, kwargs["vl_f"], LM_classify="compatibility")
74
 
75
 
76
  def inference_single(question, image_path, kwargs):
 
11
 
12
  _LM_PATH = os.path.join(_SUBMIT_ROOT, "model", "LM")
13
  _VL_B_PATH = os.path.join(_SUBMIT_ROOT, "model", "VL-B")
 
14
  _DIRECTION_MAP_PATH = os.path.join(_SCRIPTS_DIR, "object_direction_map.yaml")
15
 
16
 
 
32
  "direction_map": direction_map,
33
  "low_memory": True,
34
  "_vl_b_path": _VL_B_PATH,
 
35
  "_current_vl": None,
36
  "_current_vl_type": None,
37
  }
 
39
  vl_b = load_robobrain(_VL_B_PATH)
40
  torch.cuda.empty_cache()
41
 
 
 
 
42
  return {
43
  "lm_clf": lm_clf,
44
  "vl_b": vl_b,
 
45
  "direction_map": direction_map,
46
  "low_memory": False,
47
  }
 
54
  kwargs["_current_vl"].clear()
55
  kwargs["_current_vl"] = None
56
  torch.cuda.empty_cache()
57
+ kwargs["_current_vl"] = load_robobrain(kwargs["_vl_b_path"])
 
58
  kwargs["_current_vl_type"] = needed_type
59
 
60
 
61
  def _run_compatibility(question, image_path, kwargs, low_memory, run_robobrain, load_robobrain):
62
  if low_memory:
63
+ _swap_vl(kwargs, "B", load_robobrain)
64
  return run_robobrain(question, image_path, None, kwargs["_current_vl"], LM_classify="compatibility")
65
  else:
66
+ return run_robobrain(question, image_path, None, kwargs["vl_b"], LM_classify="compatibility")
67
 
68
 
69
  def inference_single(question, image_path, kwargs):
scripts/robobrain_runner.py CHANGED
@@ -122,6 +122,11 @@ def run_robobrain(question, image_path, depth_path, kwargs, return_thinking=Fals
122
  "Answer: yes or no\n\n"
123
  "Do not include additional text after this line.\n"
124
  )
 
 
 
 
 
125
 
126
  if LM_classify is not None:
127
  if LM_classify == "context":
@@ -129,7 +134,7 @@ def run_robobrain(question, image_path, depth_path, kwargs, return_thinking=Fals
129
  add_think = True
130
  q_type = "pointing"
131
  elif LM_classify == "compatibility":
132
- post_prompt = _BINARY_POST_PROMPT
133
  add_think = True
134
  q_type = "binary"
135
  else:
 
122
  "Answer: yes or no\n\n"
123
  "Do not include additional text after this line.\n"
124
  )
125
+ _COMPATIBILITY_POST_PROMPT = (
126
+ "\nLook at the spatial positions and relationships of objects in the image."
127
+ " Based on your visual analysis, answer yes or no.\n"
128
+ "Your final line must be: Answer: yes or no"
129
+ )
130
 
131
  if LM_classify is not None:
132
  if LM_classify == "context":
 
134
  add_think = True
135
  q_type = "pointing"
136
  elif LM_classify == "compatibility":
137
+ post_prompt = _COMPATIBILITY_POST_PROMPT
138
  add_think = True
139
  q_type = "binary"
140
  else: