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.
File size: 2,997 Bytes
4ad9219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
"""监控 post_r0_preparation.json,当进入 supervising_fixed-writer 时自动启动 mid 与 rev 两个四卡辅助 Worker,将 80GB H100 的 fixed-writer 吞吐提升 ~3 倍并在汇合时干净退出。"""
import json
import os
from pathlib import Path
import subprocess
import time

ROOT = Path(__file__).resolve().parents[1]
PREP_FILE = ROOT / 'coordination/post_r0_preparation.json'
TORCHRUN = str(ROOT / '.venv/bin/torchrun')
HELPER = str(ROOT / 'scripts/writer_helper.py')


def log(msg: str):
    ts = time.strftime('%Y-%m-%d %H:%M:%S')
    print(f'[{ts}] {msg}', flush=True)


def main():
    log('Waiting for post_r0_preparation.json to enter supervising_fixed-writer...')
    while True:
        if PREP_FILE.exists():
            try:
                data = json.loads(PREP_FILE.read_text())
                if data.get('stage') == 'supervising_fixed-writer':
                    break
                if data.get('stage') == 'post_r0_preparation_completed':
                    log('post_r0_preparation already completed, exiting.')
                    return
            except Exception:
                pass
        time.sleep(10)

    log('Detected supervising_fixed-writer! Waiting 20s for main fixed-writer worker to load models...')
    time.sleep(20)

    vis = os.environ.get('CUDA_VISIBLE_DEVICES', '').strip()
    if not vis:
        gpu_lines = subprocess.check_output(['nvidia-smi', '--query-gpu=index', '--format=csv,noheader,nounits'], text=True).splitlines()
        vis = ','.join(line.strip() for line in gpu_lines if line.strip())
    nproc = int(os.environ.get('CGVM_NPROC_PER_NODE', str(len([x for x in vis.split(',') if x.strip()]))))
    env = dict(os.environ, CUDA_VISIBLE_DEVICES=vis, PYTHONUNBUFFERED='1')
    mid_log = (ROOT / 'logs/writer_helper_mid.log').open('a', buffering=1)
    rev_log = (ROOT / 'logs/writer_helper_rev.log').open('a', buffering=1)

    log(f'Launching writer_helper.py --mode mid on GPUs {vis} (nproc={nproc})...')
    mid_proc = subprocess.Popen(
        [TORCHRUN, '--standalone', f'--nproc_per_node={nproc}', HELPER, '--mode', 'mid', '--domain', 'training'],
        cwd=str(ROOT),
        env=env,
        stdout=mid_log,
        stderr=subprocess.STDOUT,
    )
    time.sleep(15)
    log(f'Launching writer_helper.py --mode rev on GPUs {vis} (nproc={nproc})...')
    rev_proc = subprocess.Popen(
        [TORCHRUN, '--standalone', f'--nproc_per_node={nproc}', HELPER, '--mode', 'rev', '--domain', 'training'],
        cwd=str(ROOT),
        env=env,
        stdout=rev_log,
        stderr=subprocess.STDOUT,
    )

    log(f'Both helpers running: mid_pid={mid_proc.pid}, rev_pid={rev_proc.pid}. Waiting for completion...')
    mid_rc = mid_proc.wait()
    log(f'mid_proc finished with rc={mid_rc}')
    rev_rc = rev_proc.wait()
    log(f'rev_proc finished with rc={rev_rc}')
    mid_log.close()
    rev_log.close()
    log('All writer helpers exited cleanly.')


if __name__ == '__main__':
    main()