From 02d1298f0f86f103a903ed5fe386281c476c408f Mon Sep 17 00:00:00 2001 From: EvolveAegis Date: Tue, 4 Aug 2026 21:38:57 +0800 Subject: [PATCH] Guard the only torch.load with weights_only=True experiments/crosswords/evaluate.py loads an edge-logits checkpoint with torch.load and no weights_only. pyproject.toml pins torch >=2.1.0, <=2.2.2, where weights_only defaults to False, so the call resolves through pickle's Unpickler and honors REDUCE/GLOBAL opcodes. Pass weights_only=True (and map_location=cpu) so a checkpoint sourced from elsewhere can't trigger arbitrary code at load time. Co-Authored-By: Claude --- experiments/crosswords/evaluate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experiments/crosswords/evaluate.py b/experiments/crosswords/evaluate.py index 8c9a4e2..8f03ed2 100644 --- a/experiments/crosswords/evaluate.py +++ b/experiments/crosswords/evaluate.py @@ -36,7 +36,7 @@ def batched_evaluator(evaluator, batch_size, graph, loop): swarm = Swarm(["CrosswordsReflection", "CrosswordsToT"], "crosswords", "gpt-4-1106-preview", #"gpt-3.5-turbo-1106", final_node_class="ReturnAll", final_node_kwargs={}, edge_optimize=True, init_connection_probability=init_connection_probability, connect_output_nodes_to_final_node=True) - swarm.connection_dist.load_state_dict(torch.load(f"result/crosswords_Jan15/{experiment_id}_edge_logits_{int(epochs * len(test_data) / batch_size) - 1}.pkl")) + swarm.connection_dist.load_state_dict(torch.load(f"result/crosswords_Jan15/{experiment_id}_edge_logits_{int(epochs * len(test_data) / batch_size) - 1}.pkl", weights_only=True, map_location="cpu")) num_edges = [] for _ in range(100):