forked from luopingyi/xc_agent_platform_demo
24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
|
|
"""Bake the local pending pool without network access."""
|
||
|
|
import json
|
||
|
|
import sys
|
||
|
|
from collections import Counter
|
||
|
|
from pathlib import Path
|
||
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||
|
|
from src.pending_pool import build_ordered_candidates
|
||
|
|
from src.banned import banned_rule
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
rows = build_ordered_candidates('/workspace/modelhub-adapt/pending-submit.md', '/workspace/modelhub-adapt/pending-submit.txt')
|
||
|
|
print('input', dict(Counter(r['section'] for r in rows)))
|
||
|
|
rows = [dict(model_address=r['model_address'], section=r['section'], foothold_class=r['foothold_class'], try_next_gpus=r['try_next_gpus'], framework='vllm') for r in rows if not r['skip_reason'] and not banned_rule(r['model_address'])]
|
||
|
|
rows.sort(key=lambda r: (r['section'] != 'A', r['foothold_class'] != 'verified_reuse'))
|
||
|
|
output = Path(__file__).resolve().parents[1] / 'src/data/candidates.json'
|
||
|
|
output.parent.mkdir(exist_ok=True)
|
||
|
|
output.write_text(json.dumps(rows, ensure_ascii=False, indent=2) + '\n')
|
||
|
|
print('baked', dict(Counter(r['section'] for r in rows)), 'total', len(rows))
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
main()
|