Run this model with HF Jobs

Run XiangnanW/CGVM-R2.6-Qwen3VL-8B-step600 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/XiangnanW/CGVM-R2.6-Qwen3VL-8B-step600. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/XiangnanW/CGVM-R2.6-Qwen3VL-8B-step600 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
CGVM-R2.6-Qwen3VL-8B-step600 / src /scripts /post_r0_preparation.py
XiangnanW's picture
Upload CGVM R2.6 step-000600 checkpoint, R2.6 source bundle (cgvm-r26-src-v1.tar.gz), and 4-round audit report
4ad9219 verified
Raw History Blame Contribute Delete
6.23 kB
#!/usr/bin/env python3
"""在R0完整覆盖后执行已授权的真实32条梯度检查及可恢复建库,等待时释放GPU。"""
import fcntl
import hashlib
import json
import os
from pathlib import Path
import subprocess
import sys
import time
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'scripts'))
from download_assets import atomic, safe_flock
def record(stage,**fields):
row=dict(stage=stage,pid=os.getpid(),updated_at=time.time(),goal_complete=False,**fields)
atomic(ROOT/'coordination/post_r0_preparation.json',row);print(json.dumps(row,ensure_ascii=False),flush=True)
def gpu(name,script,*arguments):
command=[str(ROOT/'.venv/bin/python'),str(ROOT/'scripts/gpu_job.py'),'--name',name,'scripts/'+script,*arguments]
record('queued_'+name,command=command)
child=subprocess.Popen(command,cwd=ROOT)
record('supervising_'+name,job_supervisor_pid=child.pid,command=command)
result=child.wait()
if result:raise RuntimeError(name+'失败;保持所有日志/可恢复checkpoint,等待主goal修复')
def smoke_audit():
root=ROOT/'checkpoints/R1/reader_smoke';epoch=json.loads((root/'exact_epoch_audit.json').read_text())
if not epoch['passed'] or epoch['unique_qa']!=32 or epoch['total_updates']!=1 or epoch['rank_counts']!=[8]*4:
raise ValueError('32条真实QA四rank更新不完整')
details=[]
for rank in range(4):
reload=json.loads((root/f'save_reload.rank{rank}.json').read_text())
if not reload['passed']:raise ValueError('实际保存重载未通过')
entries=[]
for path in (ROOT/'logs').glob(f'R1_S2_smoke_rank{rank}_*.jsonl'):
entries.extend(json.loads(line) for line in path.open() if json.loads(line).get('event')=='optimizer_update')
row=entries[-1]
if row['gradient']['gradient_norm']<=0 or not row['gradient']['finite']:raise ValueError('rank无真实有限梯度')
for module in ('q_proj','k_proj','v_proj','o_proj','gate_proj','up_proj','down_proj'):
updates=[value for name,value in row['parameter_update_l2_sample'].items() if '.'+module+'.' in name]
if not updates or max(updates)<=0:raise ValueError('attention/MLP实际更新缺失:'+module)
details.append(dict(rank=rank,gradient=row['gradient'],actual_first_layer_attention_MLP_update=row['parameter_update_l2_sample'],
real_QA_ids=row['qa_ids'],save_reload=reload))
proof=dict(passed=True,scope='32_actual_training_QA_interface_gradient_and_serialization_not_formal_training',
variants='shared_Reader_architecture; original_MEMO_diagnostic_packs_not_formal_R1_or_R2',
total_unique_QA=32,world_size=4,updates=1,rank_details=details,probe_weights_not_formal=True)
atomic(ROOT/'provenance/reader_32_four_rank_gradient_reload_audit.json',proof)
def main():
record('waiting_R0_all_core_coverage')
while True:
marker=ROOT/'coordination/R0_full_question_coverage.json'
if marker.exists() and json.loads(marker.read_text()).get('passed'):break
time.sleep(30)
proof=ROOT/'provenance/reader_32_four_rank_gradient_reload_audit.json'
if not proof.exists():
state=ROOT/'checkpoints/R1/reader_smoke/state.json'
if not state.exists() or json.loads(state.read_text()).get('status')!='completed':
args=['--variant','R1','--mode','smoke','--packs','manifests/reader_input_contract32.jsonl']
if (ROOT/'checkpoints/R1/reader_smoke/latest.json').exists():args+=['--resume']
gpu('reader-gradient-smoke','train_reader.py',*args)
smoke_audit()
# 全量评测感知与Writer也独立计费;按域顺序执行,不在一张卡上挤多个重型模型。
for domain in ('ovobench','streamingbench'):
cache_audit=ROOT/'provenance'/('eval_cache_vs_R0.'+domain+'.json')
if not (cache_audit.exists() and json.loads(cache_audit.read_text()).get('passed')):
gpu('cache-'+domain,'cache_causal_memory.py','--domain',domain)
command=[str(ROOT/'.venv/bin/python'),str(ROOT/'scripts/audit_eval_cache_against_r0.py'),'--benchmark',domain]
subprocess.run(command,cwd=ROOT,check=True)
writer_audit=ROOT/'provenance'/('change_bank_audit.'+domain+'.json')
if not (writer_audit.exists() and json.loads(writer_audit.read_text()).get('passed')):
gpu('writer-'+domain,'cache_writer_memory.py','--domain',domain)
command=[str(ROOT/'.venv/bin/python'),str(ROOT/'scripts/audit_change_banks.py'),'--domain',domain]
subprocess.run(command,cwd=ROOT,check=True)
videos=json.loads((ROOT/'manifests/training_videos.candidate.json').read_text())
while True:
available=[]
for video in videos:
marker=ROOT/'provenance'/('training_media_extracted_'+video.split('/')[0]+'.json')
if marker.exists():available.append(video)
needed_cache=[v for v in available if not (ROOT/'data/frozen_causal_cache'/(hashlib.sha256(v.encode()).hexdigest()[:24]+'.json')).exists()]
if needed_cache:gpu('causal-cache','cache_causal_memory.py')
needed_writer=[v for v in available if (ROOT/'data/frozen_causal_cache'/(hashlib.sha256(v.encode()).hexdigest()[:24]+'.json')).exists()
and not (ROOT/'data/change_banks'/(hashlib.sha256(v.encode()).hexdigest()[:24]+'.json')).exists()]
if needed_writer:gpu('fixed-writer','cache_writer_memory.py')
if len(available)==len(videos):break
record('waiting_training_sources_GPU_released',available=len(available),required=len(videos))
time.sleep(60)
record('preparation_processes_exited_requires_final_source_content_audit_and_training',
remaining='full_fingerprints_joint_freeze_S1_packs_probes_S2_R1_R2_full_eval_statistics_report_cloud')
if __name__=='__main__':
with (ROOT/'coordination/post_r0_preparation.lock').open('w') as lock:
safe_flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB);lock.write(str(os.getpid()));lock.flush()
try:main()
except BaseException as exc:
record('requires_infrastructure_repair',error=type(exc).__name__+':'+str(exc));raise