Datasets:
Download code/evaluation-code/ent400-a06a1576/tests/prover_gpu/cmp_required.py from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/ent400-a06a1576/tests/prover_gpu/cmp_required.py
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/ent400-a06a1576/tests/prover_gpu/cmp_required.py
-
curl -L -o cmp_required.py https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/ent400-a06a1576/tests/prover_gpu/cmp_required.py
1.97 kB
| """必需约束新旧对照:python3 cmp_required.py <旧.json> <新.json> <标签>。""" | |
| import json | |
| import sys | |
| def main(): | |
| old, new = (json.load(open(path)) for path in sys.argv[1:3]) | |
| keys = sorted(set(old) | set(new)) | |
| def done(row): | |
| return (isinstance(row, list) and len(row) == 4 | |
| and isinstance(row[0], (int, float)) and isinstance(row[1], (int, float)) | |
| and isinstance(row[2], dict)) | |
| both = [v for v in keys if done(old.get(v)) and done(new.get(v))] | |
| def numbers(row): | |
| return [row[0], row[1], sum(n for reason, n in row[2].items() if reason.startswith('blocked:check_missing:'))] | |
| universal = ('cross_view_link', 'single_view_insufficient', 'state_recoverable:asked') | |
| def gained(v): # 新版被出包口通用检查(S1 起)拒掉的数;拒绝只记第一条没过的检查,通用检查排在最后 | |
| return sum(n for reason, n in new[v][2].items() if reason.startswith(universal)) | |
| # 可发布+缺检挡住:新版只会因通用检查变少,少的数不超过新版通用检查拒掉的数 | |
| different = [v for v in both if old[v][0] != new[v][0] | |
| or not 0 <= sum(numbers(old[v])[1:]) - sum(numbers(new[v])[1:]) <= gained(v)] | |
| unfinished = [v for v in keys if v not in both] | |
| print(sys.argv[3], '版本', len(keys), '相等', len(both)-len(different), '不等', len(different), different, | |
| '没跑完', len(unfinished), '旧没跑完', sum(not done(old.get(v)) for v in keys), | |
| '新没跑完', sum(not done(new.get(v)) for v in keys)) | |
| for v in different[:4]: | |
| print(' 不等', v, '旧 [候选, 可发布, 缺检查拒绝]', numbers(old[v]), '新', numbers(new[v]), '新增通用拒绝', gained(v)) | |
| for v in unfinished: | |
| print(' 没跑完', v, '旧', old.get(v, ['MISSING']), '新', new.get(v, ['MISSING'])) | |
| return int(bool(different) or not both) | |
| if __name__ == '__main__': | |
| sys.exit(main()) | |