Skip to content

Commit a9ca217

Browse files
author
root
committed
resolved comments
1 parent 7f8fd47 commit a9ca217

6 files changed

Lines changed: 17 additions & 18 deletions

File tree

examples/EarlyStopping/game24_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_model_short_name(model_name: str) -> str:
2525
short_name = short_name.replace(" ", "_").replace(":", "-")
2626
return short_name
2727

28-
def get_output_dirs(main_model: str, base_dir: str = "../../Outputs_SANITY_FULL/Gameof24_results"):
28+
def get_output_dirs(main_model: str, base_dir: str = "../../Outputs/Gameof24_results"):
2929
"""Create and return output directory paths based on model name."""
3030
model_short_name = get_model_short_name(main_model)
3131
output_base = os.path.join(base_dir, model_short_name)
@@ -42,14 +42,14 @@ def get_output_dirs(main_model: str, base_dir: str = "../../Outputs_SANITY_FULL/
4242

4343
return dirs
4444

45-
def get_log_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs_SANITY_FULL/Gameof24_results") -> str:
45+
def get_log_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs/Gameof24_results") -> str:
4646
"""Generate log filename based on model name."""
4747
model_short_name = get_model_short_name(main_model)
4848
output_base = os.path.join(base_dir, model_short_name)
4949
os.makedirs(output_base, exist_ok=True)
5050
return os.path.join(output_base, f"EAT_{num_examples}examples.log")
5151

52-
def get_token_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs_SANITY_FULL/Gameof24_results") -> str:
52+
def get_token_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs/Gameof24_results") -> str:
5353
"""Generate token CSV filename based on model name."""
5454
model_short_name = get_model_short_name(main_model)
5555
output_base = os.path.join(base_dir, model_short_name)

examples/EarlyStopping/maze_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_model_short_name(model_name: str) -> str:
2828
short_name = short_name.replace(" ", "_").replace(":", "-")
2929
return short_name
3030

31-
def get_output_dirs(main_model: str, base_dir: str = "../../Outputs_SANITY_FULL/MazeResults"):
31+
def get_output_dirs(main_model: str, base_dir: str = "../Outputs/MazeResults"):
3232
"""Create and return output directory paths based on model name."""
3333
model_short_name = get_model_short_name(main_model)
3434
output_base = os.path.join(base_dir, model_short_name)
@@ -46,14 +46,14 @@ def get_output_dirs(main_model: str, base_dir: str = "../../Outputs_SANITY_FULL/
4646

4747
return dirs
4848

49-
def get_log_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs_SANITY_FULL/MazeResults") -> str:
49+
def get_log_filename(main_model: str, num_examples: int, base_dir: str = "../Outputs/MazeResults") -> str:
5050
"""Generate log filename based on model name."""
5151
model_short_name = get_model_short_name(main_model)
5252
output_base = os.path.join(base_dir, model_short_name)
5353
os.makedirs(output_base, exist_ok=True)
5454
return os.path.join(output_base, f"EAT_{num_examples}examples.log")
5555

56-
def get_token_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs_SANITY_FULL/MazeResults") -> str:
56+
def get_token_filename(main_model: str, num_examples: int, base_dir: str = "../Outputs/MazeResults") -> str:
5757
"""Generate token CSV filename based on model name."""
5858
model_short_name = get_model_short_name(main_model)
5959
output_base = os.path.join(base_dir, model_short_name)

examples/EarlyStopping/spatialmap_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_model_short_name(model_name: str) -> str:
2828
short_name = short_name.replace(" ", "_").replace(":", "-")
2929
return short_name
3030

31-
def get_output_dirs(main_model: str, base_dir: str = "../../Outputs_SANITY_FULL/SpatialMap_results"):
31+
def get_output_dirs(main_model: str, base_dir: str = "../Outputs/SpatialMap_results"):
3232
"""Create and return output directory paths based on model name."""
3333
model_short_name = get_model_short_name(main_model)
3434
output_base = os.path.join(base_dir, model_short_name)
@@ -46,14 +46,14 @@ def get_output_dirs(main_model: str, base_dir: str = "../../Outputs_SANITY_FULL/
4646

4747
return dirs
4848

49-
def get_log_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs_SANITY_FULL/SpatialMap_results") -> str:
49+
def get_log_filename(main_model: str, num_examples: int, base_dir: str = "../Outputs/SpatialMap_results") -> str:
5050
"""Generate log filename based on model name."""
5151
model_short_name = get_model_short_name(main_model)
5252
output_base = os.path.join(base_dir, model_short_name)
5353
os.makedirs(output_base, exist_ok=True)
5454
return os.path.join(output_base, f"EAT_{num_examples}examples.log")
5555

56-
def get_token_filename(main_model: str, num_examples: int, base_dir: str = "../../Outputs_SANITY_FULL/SpatialMap_results") -> str:
56+
def get_token_filename(main_model: str, num_examples: int, base_dir: str = "../Outputs/SpatialMap_results") -> str:
5757
"""Generate token CSV filename based on model name."""
5858
model_short_name = get_model_short_name(main_model)
5959
output_base = os.path.join(base_dir, model_short_name)

examples/TTSwithVerification/mazemeta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def evaluate_maze_answer(answer, options, ground_truth):
377377
answer = asyncio.run(stream_completion(
378378
full_prompt,
379379
llm_server=llm_server,
380-
monitors=(),
380+
monitors=(monitor),
381381
add_delay=False,
382382
termination_requires_validation=False,
383383
async_execution=True

examples/TTSwithVerification/spatialmeta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def evaluate_spatialmap_answer(answer, options, ground_truth):
439439
answer = asyncio.run(stream_completion(
440440
full_prompt,
441441
llm_server=llm_server,
442-
monitors=(),
442+
monitors=(monitor,),
443443
add_delay=False,
444444
termination_requires_validation=False,
445445
async_execution=True

interwhen/utils/spatialmap_verifier.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import re
1515
from typing import Dict, List, Tuple, Optional, Set
16-
from z3 import Solver, Real, And, sat
16+
from z3 import Solver, Real, And, Not, sat, unsat
1717

1818

1919
class SpatialMapZ3Solver:
@@ -259,9 +259,8 @@ def count_objects_in_direction(
259259
# Check if this entity MUST be in that direction
260260
# (i.e. the negation is unsatisfiable)
261261
self.solver.push()
262-
from z3 import Not
263262
self.solver.add(Not(constraint))
264-
must_be = self.solver.check() != sat
263+
must_be = self.solver.check() == unsat
265264
self.solver.pop()
266265

267266
if must_be:
@@ -487,7 +486,7 @@ def verify_spatialmap_step(
487486
Returns:
488487
(is_valid, errors)
489488
"""
490-
from z3 import Not as Z3Not, sat as z3sat
489+
from z3 import Not as Z3Not, unsat as z3unsat
491490

492491
errors = []
493492

@@ -508,7 +507,7 @@ def verify_spatialmap_step(
508507
if compiled is not None:
509508
z3_solver.solver.push()
510509
z3_solver.solver.add(Z3Not(compiled))
511-
is_entailed = z3_solver.solver.check() != z3sat
510+
is_entailed = z3_solver.solver.check() == z3unsat
512511
z3_solver.solver.pop()
513512
if is_entailed:
514513
z3_solver.apply_ir(claim)
@@ -725,7 +724,7 @@ def get_possible_count_range(
725724
726725
Returns ``None`` if the reference entity cannot be found.
727726
"""
728-
from z3 import And as Z3And, Not as Z3Not, sat as z3sat
727+
from z3 import And as Z3And, Not as Z3Not, sat as z3sat, unsat as z3unsat
729728

730729
direction = direction.lower().strip()
731730
if direction in ('north', 'south', 'east', 'west'):
@@ -782,7 +781,7 @@ def _find(name):
782781
# Must it be?
783782
solver.solver.push()
784783
solver.solver.add(Z3Not(c))
785-
must_be = solver.solver.check() != z3sat
784+
must_be = solver.solver.check() == z3unsat
786785
solver.solver.pop()
787786

788787
if must_be:

0 commit comments

Comments
 (0)