Datasets:
Refresh verified six-GPU manifest: 11 tuples
Browse files- metadata.jsonl +1 -0
- pipeline/sixgpu_publish.py +41 -0
- pipeline/sixgpu_run.py +111 -0
- pipeline/workers.py +1 -1
- progress/sixgpu-status.json +63 -0
metadata.jsonl
CHANGED
|
@@ -6,5 +6,6 @@
|
|
| 6 |
{"id": "7b521be954c0b911ce94653e", "style_id": "ec2035ada05d", "style_label": "Macaron", "instruction": "Animate it with the spirit of the Macaron style.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/record.json"}
|
| 7 |
{"id": "83b4be1a52e27eac49183184", "style_id": "0bee0e7e6dc5", "style_label": "Make it a pencil sketch style.", "instruction": "Make it a pencil sketch style.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/record.json"}
|
| 8 |
{"id": "9dc1bd160c3ddaa349f9f047", "style_id": "305681c6a53f", "style_label": "Make it a Japanese anime style, cel shading.", "instruction": "Make it a Japanese anime style, cel shading.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/record.json"}
|
|
|
|
| 9 |
{"id": "aaf20384bbeadf6101f7a695", "style_id": "0fee9b184beb", "style_label": "Make it sculptured with ranbow candy and biscuits.", "instruction": "Make it sculptured with ranbow candy and biscuits.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/record.json"}
|
| 10 |
{"id": "ce50c519c74a0071a9710e39", "style_id": "0972e1eed1b3", "style_label": "Make it the style of Neon Light Art.", "instruction": "Make it the style of Neon Light Art.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/record.json"}
|
|
|
|
| 6 |
{"id": "7b521be954c0b911ce94653e", "style_id": "ec2035ada05d", "style_label": "Macaron", "instruction": "Animate it with the spirit of the Macaron style.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/ec2035ada05d/7b521be954c0b911ce94653e/record.json"}
|
| 7 |
{"id": "83b4be1a52e27eac49183184", "style_id": "0bee0e7e6dc5", "style_label": "Make it a pencil sketch style.", "instruction": "Make it a pencil sketch style.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0bee0e7e6dc5/83b4be1a52e27eac49183184/record.json"}
|
| 8 |
{"id": "9dc1bd160c3ddaa349f9f047", "style_id": "305681c6a53f", "style_label": "Make it a Japanese anime style, cel shading.", "instruction": "Make it a Japanese anime style, cel shading.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/305681c6a53f/9dc1bd160c3ddaa349f9f047/record.json"}
|
| 9 |
+
{"id": "a65ecfb364136b92e35655a9", "style_id": "182ecc60160c", "style_label": "Make it the style of Frank Miller's Sin City.", "instruction": "Make it the style of Frank Miller's Sin City.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/f0b497ef33aae35109f09934a1117b4feff21183/data/182ecc60160c/a65ecfb364136b92e35655a9/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/f0b497ef33aae35109f09934a1117b4feff21183/data/182ecc60160c/a65ecfb364136b92e35655a9/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/f0b497ef33aae35109f09934a1117b4feff21183/data/182ecc60160c/a65ecfb364136b92e35655a9/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/f0b497ef33aae35109f09934a1117b4feff21183/data/182ecc60160c/a65ecfb364136b92e35655a9/record.json"}
|
| 10 |
{"id": "aaf20384bbeadf6101f7a695", "style_id": "0fee9b184beb", "style_label": "Make it sculptured with ranbow candy and biscuits.", "instruction": "Make it sculptured with ranbow candy and biscuits.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0fee9b184beb/aaf20384bbeadf6101f7a695/record.json"}
|
| 11 |
{"id": "ce50c519c74a0071a9710e39", "style_id": "0972e1eed1b3", "style_label": "Make it the style of Neon Light Art.", "instruction": "Make it the style of Neon Light Art.", "source_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/source.mp4", "source_depth_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/depth.mp4", "style_video": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/edited.mp4", "provenance": "https://huggingface.co/datasets/faraway00/StyleEdit/resolve/47189b79ce68d95b6b54f3b24747346e85db18ac/data/0972e1eed1b3/ce50c519c74a0071a9710e39/record.json"}
|
pipeline/sixgpu_publish.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Refresh HF's consumable manifest from verified shard receipts only."""
|
| 2 |
+
import json, os, sqlite3, time
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from huggingface_hub import HfApi, CommitOperationAdd
|
| 5 |
+
|
| 6 |
+
ROOT=Path('/workspace/styleedit-streaming-20261024/sixgpu-20261024')
|
| 7 |
+
APP=Path('/opt/styleedit-streaming-20261024')
|
| 8 |
+
def publish():
|
| 9 |
+
manifest=[]
|
| 10 |
+
for gpu in range(6):
|
| 11 |
+
path=ROOT/f'gpu{gpu}'/'jobs.sqlite'
|
| 12 |
+
if not path.exists(): return
|
| 13 |
+
db=sqlite3.connect(f'file:{path}?mode=ro',uri=True,timeout=30)
|
| 14 |
+
for (encoded,) in db.execute("SELECT record FROM jobs WHERE status='verified'"):
|
| 15 |
+
receipt=json.loads(encoded); r=receipt['record']; commit=receipt['commit']
|
| 16 |
+
row={k:r[k] for k in ['id','style_id','style_label','instruction']}
|
| 17 |
+
for k in ['source_video','source_depth_video','style_video']:
|
| 18 |
+
row[k]=f'https://huggingface.co/datasets/faraway00/StyleEdit/resolve/{commit}/{r[k]}'
|
| 19 |
+
row['provenance']=f'https://huggingface.co/datasets/faraway00/StyleEdit/resolve/{commit}/data/{r["style_id"]}/{r["id"]}/record.json'
|
| 20 |
+
manifest.append(row)
|
| 21 |
+
db.close()
|
| 22 |
+
if not manifest:return
|
| 23 |
+
manifest.sort(key=lambda r:r['id'])
|
| 24 |
+
assert len({r['id'] for r in manifest})==len(manifest)
|
| 25 |
+
out=Path('/opt/styleedit-sixgpu-manifest.jsonl')
|
| 26 |
+
out.write_text(''.join(json.dumps(r,ensure_ascii=False)+'\n' for r in manifest))
|
| 27 |
+
ops=[CommitOperationAdd(path_in_repo='metadata.jsonl',path_or_fileobj=str(out))]
|
| 28 |
+
status=ROOT/'status.json'
|
| 29 |
+
if status.exists():ops.append(CommitOperationAdd(path_in_repo='progress/sixgpu-status.json',path_or_fileobj=str(status)))
|
| 30 |
+
for name in ['sixgpu_run.py','sixgpu_publish.py','workers.py']:
|
| 31 |
+
ops.append(CommitOperationAdd(path_in_repo='pipeline/'+name,path_or_fileobj=str(APP/name)))
|
| 32 |
+
c=HfApi().create_commit(repo_id='faraway00/StyleEdit',repo_type='dataset',operations=ops,
|
| 33 |
+
commit_message=f'Refresh verified six-GPU manifest: {len(manifest)} tuples')
|
| 34 |
+
(ROOT/'manifest-published.json').write_text(json.dumps({'commit':c.oid,'tuples':len(manifest),'time':time.time()}))
|
| 35 |
+
print('MANIFEST_VERIFIED_ONLY',len(manifest),c.oid,flush=True)
|
| 36 |
+
|
| 37 |
+
if __name__=='__main__':
|
| 38 |
+
while True:
|
| 39 |
+
try:publish()
|
| 40 |
+
except Exception as exc:print('MANIFEST_RETRY',type(exc).__name__,str(exc)[:200],flush=True)
|
| 41 |
+
time.sleep(300)
|
pipeline/sixgpu_run.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Six disjoint style shards; resumable indexes, verified uploads, bounded scratch."""
|
| 2 |
+
import collections, fcntl, json, os, shutil, sqlite3, subprocess, sys, time
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
APP = Path(__file__).resolve().parent
|
| 6 |
+
PERSIST = Path('/workspace/styleedit-streaming-20261024')
|
| 7 |
+
ROOT = PERSIST / 'sixgpu-20261024'
|
| 8 |
+
PY = '/opt/da3-depth-env/bin/python'
|
| 9 |
+
|
| 10 |
+
def save(path, value):
|
| 11 |
+
path = Path(path); path.parent.mkdir(parents=True, exist_ok=True)
|
| 12 |
+
temp = path.with_suffix('.tmp'); temp.write_text(json.dumps(value, indent=2)); os.replace(temp, path)
|
| 13 |
+
|
| 14 |
+
def spawn(args, log, gpu=None):
|
| 15 |
+
env = dict(os.environ, HF_TOKEN_PATH='/root/.styleedit-hf-token', OMP_NUM_THREADS='4', OPENBLAS_NUM_THREADS='2', HF_HUB_DISABLE_PROGRESS_BARS='1')
|
| 16 |
+
if gpu is not None:
|
| 17 |
+
env.update(CUDA_VISIBLE_DEVICES=str(gpu), STYLEEDIT_GPU_LOCK=f'/opt/styleedit-gpu-{gpu}.lock')
|
| 18 |
+
stream = open(log, 'a')
|
| 19 |
+
p = subprocess.Popen([PY, '-u', *map(str, args)], env=env, stdout=stream, stderr=subprocess.STDOUT, start_new_session=True)
|
| 20 |
+
stream.close(); return p
|
| 21 |
+
|
| 22 |
+
def prepare():
|
| 23 |
+
ROOT.mkdir(parents=True, exist_ok=True)
|
| 24 |
+
rows = json.loads((APP/'candidates.json').read_text())
|
| 25 |
+
styles = sorted({r['style_id'] for r in rows})
|
| 26 |
+
# Entire styles belong to one GPU, so the 100-source quota needs no cross-process race.
|
| 27 |
+
assignment = {s:i%6 for i,s in enumerate(styles)}
|
| 28 |
+
prior = sqlite3.connect(f'file:{PERSIST}/state/jobs.sqlite?mode=ro', uri=True)
|
| 29 |
+
old = prior.execute('SELECT id,style_id,source,status,record,verified_at,cleaned FROM jobs').fetchall()
|
| 30 |
+
prior.close()
|
| 31 |
+
pilot = json.loads((APP/'pilot-plan.json').read_text())
|
| 32 |
+
for gpu in range(6):
|
| 33 |
+
state = ROOT/f'gpu{gpu}'; state.mkdir(exist_ok=True)
|
| 34 |
+
db = sqlite3.connect(state/'jobs.sqlite')
|
| 35 |
+
db.execute('CREATE TABLE IF NOT EXISTS jobs(id TEXT PRIMARY KEY,style_id TEXT,source TEXT,status TEXT,record TEXT,verified_at REAL,cleaned INTEGER DEFAULT 0)')
|
| 36 |
+
for row in old:
|
| 37 |
+
if assignment.get(row[1]) == gpu and row[3] in ('verified','reject'):
|
| 38 |
+
db.execute('INSERT OR IGNORE INTO jobs VALUES(?,?,?,?,?,?,?)', row)
|
| 39 |
+
db.commit(); db.close()
|
| 40 |
+
save(APP/f'plan-gpu{gpu}.json', [r for r in rows if assignment[r['style_id']]==gpu])
|
| 41 |
+
save(APP/f'pilot-gpu{gpu}.json', [r for r in pilot if assignment[r['style_id']]==gpu])
|
| 42 |
+
save(ROOT/'assignment.json', assignment)
|
| 43 |
+
|
| 44 |
+
def processing(gpu, pilot=False):
|
| 45 |
+
return spawn([APP/'pipeline.py', '--plan', APP/f'{"pilot" if pilot else "plan"}-gpu{gpu}.json',
|
| 46 |
+
'--state', ROOT/f'gpu{gpu}', '--scratch', f'/opt/styleedit-sixgpu-scratch/gpu{gpu}',
|
| 47 |
+
'--index-state', '/opt/styleedit-exact-index', '--limit','0','--per-style','100',
|
| 48 |
+
'--window','6','--download-workers','4','--upload-workers','1',
|
| 49 |
+
'--scratch-gib','60','--reserve-gib','40','--cleanup-seconds','60',
|
| 50 |
+
*(['--seed-ranges'] if pilot else [])], ROOT/f'gpu{gpu}-{ "pilot" if pilot else "production"}.log', gpu)
|
| 51 |
+
|
| 52 |
+
def aggregate(stage, children):
|
| 53 |
+
counts = collections.Counter(); statuses = collections.Counter(); dirty = 0
|
| 54 |
+
for gpu in range(6):
|
| 55 |
+
db = sqlite3.connect(ROOT/f'gpu{gpu}'/'jobs.sqlite', timeout=30)
|
| 56 |
+
counts.update(dict(db.execute("SELECT style_id,count(*) FROM jobs WHERE status='verified' GROUP BY style_id")))
|
| 57 |
+
statuses.update(dict(db.execute('SELECT status,count(*) FROM jobs GROUP BY status')))
|
| 58 |
+
dirty += db.execute("SELECT count(*) FROM jobs WHERE status='verified' AND cleaned=0").fetchone()[0]
|
| 59 |
+
db.close()
|
| 60 |
+
save(ROOT/'status.json', {'utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()),'stage':stage,
|
| 61 |
+
'verified':sum(counts.values()),'counts':dict(counts),'statuses':dict(statuses),
|
| 62 |
+
'verified_pending_cleanup':dirty,'processes':{k:{'pid':v.pid,'returncode':v.poll()} for k,v in children.items()}})
|
| 63 |
+
|
| 64 |
+
def index_merge():
|
| 65 |
+
target = Path('/opt/styleedit-exact-index'); target.mkdir(exist_ok=True)
|
| 66 |
+
tmp = target/'catalog.sqlite.tmp'
|
| 67 |
+
if tmp.exists(): tmp.unlink()
|
| 68 |
+
db = sqlite3.connect(tmp)
|
| 69 |
+
db.execute('CREATE TABLE members(category TEXT,name TEXT,offset INTEGER,size INTEGER,PRIMARY KEY(category,name))')
|
| 70 |
+
db.execute('CREATE TABLE checkpoints(category TEXT PRIMARY KEY,offset INTEGER,complete INTEGER)')
|
| 71 |
+
for category in ['source','global_style1','global_style2']:
|
| 72 |
+
origin = ROOT/'indexes'/category
|
| 73 |
+
src = sqlite3.connect(origin/'catalog.sqlite')
|
| 74 |
+
if src.execute('SELECT complete FROM checkpoints WHERE category=?',(category,)).fetchone() != (1,):
|
| 75 |
+
raise RuntimeError('Incomplete index '+category)
|
| 76 |
+
db.executemany('INSERT INTO members VALUES(?,?,?,?)',src.execute('SELECT * FROM members'))
|
| 77 |
+
db.executemany('INSERT INTO checkpoints VALUES(?,?,?)',src.execute('SELECT * FROM checkpoints'))
|
| 78 |
+
src.close(); shutil.copyfile(origin/(category+'.gzidx'), target/(category+'.gzidx'))
|
| 79 |
+
db.commit(); db.close(); os.replace(tmp,target/'catalog.sqlite')
|
| 80 |
+
|
| 81 |
+
def main():
|
| 82 |
+
ROOT.mkdir(parents=True,exist_ok=True)
|
| 83 |
+
lock=open(ROOT/'supervisor.lock','a'); fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
|
| 84 |
+
prepare()
|
| 85 |
+
from huggingface_hub import HfApi
|
| 86 |
+
api=HfApi(); print('HF_AUTH',api.whoami()['name'],flush=True)
|
| 87 |
+
api.auth_check('faraway00/StyleEdit', repo_type='dataset')
|
| 88 |
+
children={}
|
| 89 |
+
for category in ['source','global_style1','global_style2']:
|
| 90 |
+
path=ROOT/'indexes'/category
|
| 91 |
+
children['index-'+category]=spawn([APP/'pipeline.py','--index',category,'--index-state',path], ROOT/f'index-{category}.log')
|
| 92 |
+
for gpu in range(6):children[f'pilot-{gpu}']=processing(gpu,True)
|
| 93 |
+
while any(p.poll() is None for p in children.values()):
|
| 94 |
+
aggregate('indexing_and_pilot',children)
|
| 95 |
+
# Failed index is fatal; preserve all checkpoints and media.
|
| 96 |
+
failed=[k for k,p in children.items() if k.startswith('index-') and p.poll() not in (None,0)]
|
| 97 |
+
if failed: raise RuntimeError('Index failed; inspect logs: '+str(failed))
|
| 98 |
+
time.sleep(30)
|
| 99 |
+
aggregate('pilot_complete',children)
|
| 100 |
+
# Pilot's quota deficit gives exit 2 by design. Upload/model errors are not safe to ignore.
|
| 101 |
+
for gpu in range(6):
|
| 102 |
+
summary=json.loads((ROOT/f'gpu{gpu}'/'summary.json').read_text())
|
| 103 |
+
if summary['errors']:raise RuntimeError(f'Pilot GPU {gpu} errors: inspect summary before production')
|
| 104 |
+
index_merge()
|
| 105 |
+
children={f'gpu-{g}':processing(g) for g in range(6)}
|
| 106 |
+
while any(p.poll() is None for p in children.values()):
|
| 107 |
+
aggregate('production',children); time.sleep(30)
|
| 108 |
+
aggregate('complete' if all(p.returncode==0 for p in children.values()) else 'needs_attention',children)
|
| 109 |
+
print('SIX_GPU_FINISHED',flush=True)
|
| 110 |
+
|
| 111 |
+
if __name__=='__main__': main()
|
pipeline/workers.py
CHANGED
|
@@ -14,7 +14,7 @@ import numpy as np,torch
|
|
| 14 |
from PIL import Image
|
| 15 |
import torch.nn.functional as F
|
| 16 |
torch.set_num_threads(4)
|
| 17 |
-
lock=open('/opt/styleedit-gpu.lock','a')
|
| 18 |
t=time.monotonic()
|
| 19 |
if MODE=='filter':
|
| 20 |
sys.path.insert(0,str(CORE));sys.path.insert(0,str(CORE/'code'))
|
|
|
|
| 14 |
from PIL import Image
|
| 15 |
import torch.nn.functional as F
|
| 16 |
torch.set_num_threads(4)
|
| 17 |
+
lock=open(os.environ.get('STYLEEDIT_GPU_LOCK','/opt/styleedit-gpu.lock'),'a')
|
| 18 |
t=time.monotonic()
|
| 19 |
if MODE=='filter':
|
| 20 |
sys.path.insert(0,str(CORE));sys.path.insert(0,str(CORE/'code'))
|
progress/sixgpu-status.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"utc": "2026-10-24T03:26:55Z",
|
| 3 |
+
"stage": "indexing_and_pilot",
|
| 4 |
+
"verified": 10,
|
| 5 |
+
"counts": {
|
| 6 |
+
"4744afcbd909": 1,
|
| 7 |
+
"2cb8a9c29e3c": 1,
|
| 8 |
+
"3ac416bb5d5d": 1,
|
| 9 |
+
"09229cb3538e": 1,
|
| 10 |
+
"9fd740550a13": 1,
|
| 11 |
+
"0972e1eed1b3": 1,
|
| 12 |
+
"305681c6a53f": 1,
|
| 13 |
+
"ec2035ada05d": 1,
|
| 14 |
+
"0bee0e7e6dc5": 1,
|
| 15 |
+
"0fee9b184beb": 1
|
| 16 |
+
},
|
| 17 |
+
"statuses": {
|
| 18 |
+
"downloading": 13,
|
| 19 |
+
"filtering": 4,
|
| 20 |
+
"reject": 2,
|
| 21 |
+
"verified": 10,
|
| 22 |
+
"depth": 1
|
| 23 |
+
},
|
| 24 |
+
"verified_pending_cleanup": 0,
|
| 25 |
+
"processes": {
|
| 26 |
+
"index-source": {
|
| 27 |
+
"pid": 2562,
|
| 28 |
+
"returncode": null
|
| 29 |
+
},
|
| 30 |
+
"index-global_style1": {
|
| 31 |
+
"pid": 2563,
|
| 32 |
+
"returncode": null
|
| 33 |
+
},
|
| 34 |
+
"index-global_style2": {
|
| 35 |
+
"pid": 2564,
|
| 36 |
+
"returncode": null
|
| 37 |
+
},
|
| 38 |
+
"pilot-0": {
|
| 39 |
+
"pid": 2565,
|
| 40 |
+
"returncode": null
|
| 41 |
+
},
|
| 42 |
+
"pilot-1": {
|
| 43 |
+
"pid": 2566,
|
| 44 |
+
"returncode": null
|
| 45 |
+
},
|
| 46 |
+
"pilot-2": {
|
| 47 |
+
"pid": 2567,
|
| 48 |
+
"returncode": null
|
| 49 |
+
},
|
| 50 |
+
"pilot-3": {
|
| 51 |
+
"pid": 2568,
|
| 52 |
+
"returncode": null
|
| 53 |
+
},
|
| 54 |
+
"pilot-4": {
|
| 55 |
+
"pid": 2569,
|
| 56 |
+
"returncode": null
|
| 57 |
+
},
|
| 58 |
+
"pilot-5": {
|
| 59 |
+
"pid": 2570,
|
| 60 |
+
"returncode": null
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|