auto-sync 2026-07-03T16:06:56Z workspace (part 6)
Browse files
workspace/scripts/eval_ctt_generated_rollout.py
CHANGED
|
@@ -75,6 +75,15 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 75 |
parser.add_argument("--restore-tolerance", type=float, default=1.0e-5)
|
| 76 |
parser.add_argument("--delta-scale", type=float, default=1.0)
|
| 77 |
parser.add_argument("--include-targets-without-positives", action="store_true")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
parser.add_argument("--skip-metrics", action="store_true")
|
| 79 |
parser.add_argument("--bootstrap-samples", type=int, default=200)
|
| 80 |
args = parser.parse_args(argv)
|
|
@@ -131,7 +140,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 131 |
max_charts=None,
|
| 132 |
require_positive=True,
|
| 133 |
include_hidden=False,
|
| 134 |
-
include_metadata=
|
| 135 |
chart_feature_mode=chart_feature_mode,
|
| 136 |
)
|
| 137 |
target_charts, target_index = load_chart_items(
|
|
@@ -175,6 +184,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 175 |
pool_size=max(pool_size, args.k),
|
| 176 |
k=args.k,
|
| 177 |
delta_scale=args.delta_scale,
|
|
|
|
| 178 |
),
|
| 179 |
)
|
| 180 |
for target in target_charts
|
|
@@ -211,6 +221,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 211 |
"k": args.k,
|
| 212 |
"neighbors": args.neighbors,
|
| 213 |
"pool_size": max(pool_size, args.k),
|
|
|
|
| 214 |
"decoder": {
|
| 215 |
"name": "linear_keyframe_decode",
|
| 216 |
"source_code": "spline_tangent_code stores start/mid/end residual keyframes",
|
|
@@ -383,8 +394,15 @@ def generate_proposals(
|
|
| 383 |
pool_size: int,
|
| 384 |
k: int,
|
| 385 |
delta_scale: float,
|
|
|
|
| 386 |
) -> list[Proposal]:
|
| 387 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
target_feature = torch.as_tensor(target.feature, dtype=torch.float32, device=device)
|
| 389 |
ranked_sources = sorted(
|
| 390 |
pool,
|
|
@@ -435,6 +453,26 @@ def generate_proposals(
|
|
| 435 |
return proposals[:k]
|
| 436 |
|
| 437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
def decode_linear_keyframe_tangent(
|
| 439 |
tangent_code: np.ndarray,
|
| 440 |
*,
|
|
|
|
| 75 |
parser.add_argument("--restore-tolerance", type=float, default=1.0e-5)
|
| 76 |
parser.add_argument("--delta-scale", type=float, default=1.0)
|
| 77 |
parser.add_argument("--include-targets-without-positives", action="store_true")
|
| 78 |
+
parser.add_argument(
|
| 79 |
+
"--exclude-self-source",
|
| 80 |
+
action="store_true",
|
| 81 |
+
help=(
|
| 82 |
+
"When source and target indexes overlap, exclude source charts with the "
|
| 83 |
+
"same chart_id or state_hash as the target. Use this for train-split "
|
| 84 |
+
"calibration rollouts so retrieval cannot copy the target chart's own positives."
|
| 85 |
+
),
|
| 86 |
+
)
|
| 87 |
parser.add_argument("--skip-metrics", action="store_true")
|
| 88 |
parser.add_argument("--bootstrap-samples", type=int, default=200)
|
| 89 |
args = parser.parse_args(argv)
|
|
|
|
| 140 |
max_charts=None,
|
| 141 |
require_positive=True,
|
| 142 |
include_hidden=False,
|
| 143 |
+
include_metadata=True,
|
| 144 |
chart_feature_mode=chart_feature_mode,
|
| 145 |
)
|
| 146 |
target_charts, target_index = load_chart_items(
|
|
|
|
| 184 |
pool_size=max(pool_size, args.k),
|
| 185 |
k=args.k,
|
| 186 |
delta_scale=args.delta_scale,
|
| 187 |
+
exclude_self_source=args.exclude_self_source,
|
| 188 |
),
|
| 189 |
)
|
| 190 |
for target in target_charts
|
|
|
|
| 221 |
"k": args.k,
|
| 222 |
"neighbors": args.neighbors,
|
| 223 |
"pool_size": max(pool_size, args.k),
|
| 224 |
+
"exclude_self_source": bool(args.exclude_self_source),
|
| 225 |
"decoder": {
|
| 226 |
"name": "linear_keyframe_decode",
|
| 227 |
"source_code": "spline_tangent_code stores start/mid/end residual keyframes",
|
|
|
|
| 394 |
pool_size: int,
|
| 395 |
k: int,
|
| 396 |
delta_scale: float,
|
| 397 |
+
exclude_self_source: bool = False,
|
| 398 |
) -> list[Proposal]:
|
| 399 |
+
task_pool = source_by_task.get(target.task_id) or source_charts
|
| 400 |
+
pool = _source_pool_for_target(
|
| 401 |
+
target,
|
| 402 |
+
task_pool=task_pool,
|
| 403 |
+
source_charts=source_charts,
|
| 404 |
+
exclude_self_source=exclude_self_source,
|
| 405 |
+
)
|
| 406 |
target_feature = torch.as_tensor(target.feature, dtype=torch.float32, device=device)
|
| 407 |
ranked_sources = sorted(
|
| 408 |
pool,
|
|
|
|
| 453 |
return proposals[:k]
|
| 454 |
|
| 455 |
|
| 456 |
+
def _source_pool_for_target(
|
| 457 |
+
target: ChartItem,
|
| 458 |
+
*,
|
| 459 |
+
task_pool: list[ChartItem],
|
| 460 |
+
source_charts: list[ChartItem],
|
| 461 |
+
exclude_self_source: bool,
|
| 462 |
+
) -> list[ChartItem]:
|
| 463 |
+
if not exclude_self_source:
|
| 464 |
+
return task_pool
|
| 465 |
+
|
| 466 |
+
def is_not_self(source: ChartItem) -> bool:
|
| 467 |
+
return source.chart_id != target.chart_id and source.state_hash != target.state_hash
|
| 468 |
+
|
| 469 |
+
filtered = [source for source in task_pool if is_not_self(source)]
|
| 470 |
+
if filtered:
|
| 471 |
+
return filtered
|
| 472 |
+
fallback = [source for source in source_charts if is_not_self(source)]
|
| 473 |
+
return fallback or task_pool
|
| 474 |
+
|
| 475 |
+
|
| 476 |
def decode_linear_keyframe_tangent(
|
| 477 |
tangent_code: np.ndarray,
|
| 478 |
*,
|
workspace/scripts/slurm/eval_ctt_generated_rollout.sbatch
CHANGED
|
@@ -38,6 +38,7 @@ RESTORE_TOLERANCE="${RESTORE_TOLERANCE:-1e-5}"
|
|
| 38 |
DELTA_SCALE="${DELTA_SCALE:-1.0}"
|
| 39 |
BOOTSTRAP_SAMPLES="${BOOTSTRAP_SAMPLES:-200}"
|
| 40 |
INCLUDE_TARGETS_WITHOUT_POSITIVES="${INCLUDE_TARGETS_WITHOUT_POSITIVES:-0}"
|
|
|
|
| 41 |
SKIP_METRICS="${SKIP_METRICS:-0}"
|
| 42 |
|
| 43 |
module load StdEnv/2023 apptainer/1.4.5
|
|
@@ -58,6 +59,9 @@ EXTRA_ARGS=()
|
|
| 58 |
if [[ "$INCLUDE_TARGETS_WITHOUT_POSITIVES" == "1" ]]; then
|
| 59 |
EXTRA_ARGS+=(--include-targets-without-positives)
|
| 60 |
fi
|
|
|
|
|
|
|
|
|
|
| 61 |
if [[ "$SKIP_METRICS" == "1" ]]; then
|
| 62 |
EXTRA_ARGS+=(--skip-metrics)
|
| 63 |
fi
|
|
|
|
| 38 |
DELTA_SCALE="${DELTA_SCALE:-1.0}"
|
| 39 |
BOOTSTRAP_SAMPLES="${BOOTSTRAP_SAMPLES:-200}"
|
| 40 |
INCLUDE_TARGETS_WITHOUT_POSITIVES="${INCLUDE_TARGETS_WITHOUT_POSITIVES:-0}"
|
| 41 |
+
EXCLUDE_SELF_SOURCE="${EXCLUDE_SELF_SOURCE:-0}"
|
| 42 |
SKIP_METRICS="${SKIP_METRICS:-0}"
|
| 43 |
|
| 44 |
module load StdEnv/2023 apptainer/1.4.5
|
|
|
|
| 59 |
if [[ "$INCLUDE_TARGETS_WITHOUT_POSITIVES" == "1" ]]; then
|
| 60 |
EXTRA_ARGS+=(--include-targets-without-positives)
|
| 61 |
fi
|
| 62 |
+
if [[ "$EXCLUDE_SELF_SOURCE" == "1" ]]; then
|
| 63 |
+
EXTRA_ARGS+=(--exclude-self-source)
|
| 64 |
+
fi
|
| 65 |
if [[ "$SKIP_METRICS" == "1" ]]; then
|
| 66 |
EXTRA_ARGS+=(--skip-metrics)
|
| 67 |
fi
|