faraway00 commited on
Commit
99dca31
·
verified ·
1 Parent(s): 576981b

Refresh verified six-GPU manifest: 26 tuples

Browse files
pipeline/SIXGPU.md CHANGED
@@ -53,3 +53,6 @@ restarting. Root-disk state is ephemeral; verified media and the manifest are
53
  uploaded to HF, while unuploaded media remain local for retries. Do not start
54
  two supervisors, or fall back to the old single state
55
  when resuming this deployment.
 
 
 
 
53
  uploaded to HF, while unuploaded media remain local for retries. Do not start
54
  two supervisors, or fall back to the old single state
55
  when resuming this deployment.
56
+
57
+
58
+ Direct archive download: download_archives.py uses 16 concurrent 64 MiB HTTP ranges, resumable atomic chunks in /opt/styleedit-archive-cache (root disk). streaming.py reads completed chunks locally and otherwise falls back to HTTP. Archives are not fully extracted. Six GPU incremental pair filtering remains active, followed by depth, verified HF upload and 60-second cleanup. Archive chunks are shared by jobs and retained during processing; .part files are never read as complete data. Low disk space pauses new archive requests at 48 GiB free.
pipeline/archive_cache.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Root-disk, immutable range cache; only atomic completed chunks are readable."""
2
+ import os
3
+ from pathlib import Path
4
+ ROOT=Path('/opt/styleedit-archive-cache')
5
+ BLOCK=64*1024**2
6
+
7
+ def cached_range(category,start,length):
8
+ chunks=[]; pos=start; end=start+length
9
+ while pos<end:
10
+ base=pos//BLOCK*BLOCK
11
+ path=ROOT/category/f'{base:012d}.chunk'
12
+ try:
13
+ with path.open('rb') as f:
14
+ f.seek(pos-base); n=min(end-pos,BLOCK-(pos-base)); data=f.read(n)
15
+ except FileNotFoundError:return None
16
+ if len(data)!=n:return None
17
+ chunks.append(data);pos+=n
18
+ return b''.join(chunks)
pipeline/download_archives.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Resume 16 concurrent downloads on root disk, without extracting full archives."""
2
+ import concurrent.futures,fcntl,json,os,shutil,time,threading
3
+ from pathlib import Path
4
+ from archive_cache import ROOT,BLOCK
5
+ from streaming import archive_sizes,http_get_range
6
+ from common import atomic
7
+ STATUS=Path('/opt/styleedit-sixgpu-20261024/download-status.json')
8
+
9
+ def main():
10
+ ROOT.mkdir(parents=True,exist_ok=True)
11
+ lock=(ROOT/'download.lock').open('a');fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
12
+ sizes=archive_sizes();done={c:0 for c in sizes};tasks=[];errors=[];guard=threading.Lock()
13
+ for c,size in sizes.items():
14
+ (ROOT/c).mkdir(exist_ok=True)
15
+ for start in range(0,size,BLOCK):
16
+ n=min(BLOCK,size-start);path=ROOT/c/f'{start:012d}.chunk'
17
+ if path.exists() and path.stat().st_size==n:done[c]+=n
18
+ else:tasks.append((start,c,n,path))
19
+ # All three archive fronts advance together; complete pairs can be processed early.
20
+ tasks.sort(key=lambda t:(t[0],list(sizes).index(t[1])))
21
+ initial=sum(done.values());begin=time.monotonic();last=begin
22
+ def fetch(task):
23
+ start,c,n,path=task
24
+ while shutil.disk_usage(ROOT).free < 48*1024**3:time.sleep(15)
25
+ body=http_get_range(c,start,n)
26
+ tmp=path.with_suffix('.part')
27
+ with tmp.open('wb') as f:f.write(body);f.flush();os.fdatasync(f.fileno())
28
+ os.replace(tmp,path)
29
+ with guard:done[c]+=n
30
+ def report(stage):
31
+ elapsed=time.monotonic()-begin;total=sum(done.values());rate=(total-initial)/max(elapsed,0.001)
32
+ atomic(STATUS,{'stage':stage,'utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()),'workers':16,'cache_root':str(ROOT),'total_bytes':sum(sizes.values()),'downloaded_bytes':total,'downloaded_this_run':total-initial,'elapsed_seconds':elapsed,'bytes_per_second':rate,'eta_seconds':(sum(sizes.values())-total)/rate if rate else None,'categories':{c:{'downloaded_bytes':done[c],'total_bytes':sizes[c]} for c in sizes},'errors':errors[-20:]})
33
+ report('downloading')
34
+ with concurrent.futures.ThreadPoolExecutor(16) as pool:
35
+ pending={};it=iter(tasks)
36
+ def fill():
37
+ while len(pending)<32:
38
+ task=next(it,None)
39
+ if task is None:break
40
+ pending[pool.submit(fetch,task)]=task
41
+ fill()
42
+ while pending:
43
+ finished,_=concurrent.futures.wait(pending,timeout=5,return_when=concurrent.futures.FIRST_COMPLETED)
44
+ for future in finished:
45
+ task=pending.pop(future)
46
+ try:future.result()
47
+ except Exception as e:errors.append({'category':task[1],'start':task[0],'error':str(e)[:250]})
48
+ fill()
49
+ if time.monotonic()-last>=10:report('downloading');last=time.monotonic();print(STATUS.read_text(),flush=True)
50
+ report('complete' if not errors else 'needs_retry')
51
+ if errors:raise RuntimeError(f'{len(errors)} chunks failed; rerun resumes only missing chunks')
52
+ if __name__=='__main__':main()
pipeline/sixgpu_publish.py CHANGED
@@ -27,7 +27,7 @@ def publish():
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','SIXGPU.md','pipeline.py','streaming.py','live_index.py','verify_live.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')
 
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','SIXGPU.md','pipeline.py','streaming.py','live_index.py','verify_live.py','archive_cache.py','download_archives.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')
pipeline/streaming.py CHANGED
@@ -4,7 +4,7 @@ from common import *
4
  import requests
5
  SPLIT=21474836480
6
 
7
- def get_range(category,start,length):
8
  from huggingface_hub import get_token
9
  blocks=[];pos=start;remaining=length
10
  while remaining:
@@ -25,6 +25,11 @@ def get_range(category,start,length):
25
  remaining-=n;pos+=n
26
  return b''.join(blocks)
27
 
 
 
 
 
 
28
  class Remote(io.RawIOBase):
29
  """2 cached 8MiB blocks + 1 asynchronous prefetch. Fresh ranges on retries."""
30
  def __init__(self,category,size,block=8*1024**2):
 
4
  import requests
5
  SPLIT=21474836480
6
 
7
+ def http_get_range(category,start,length):
8
  from huggingface_hub import get_token
9
  blocks=[];pos=start;remaining=length
10
  while remaining:
 
25
  remaining-=n;pos+=n
26
  return b''.join(blocks)
27
 
28
+ def get_range(category,start,length):
29
+ from archive_cache import cached_range
30
+ cached=cached_range(category,start,length)
31
+ return cached if cached is not None else http_get_range(category,start,length)
32
+
33
  class Remote(io.RawIOBase):
34
  """2 cached 8MiB blocks + 1 asynchronous prefetch. Fresh ranges on retries."""
35
  def __init__(self,category,size,block=8*1024**2):
progress/sixgpu-status.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "utc": "2026-10-24T04:16:35Z",
3
  "stage": "indexing_and_production",
4
  "verified": 26,
5
  "counts": {
@@ -37,39 +37,39 @@
37
  "verified_pending_cleanup": 0,
38
  "processes": {
39
  "index-source": {
40
- "pid": 16190,
41
  "returncode": null
42
  },
43
  "index-global_style1": {
44
- "pid": 16191,
45
  "returncode": null
46
  },
47
  "index-global_style2": {
48
- "pid": 16192,
49
  "returncode": null
50
  },
51
  "gpu-0": {
52
- "pid": 16193,
53
  "returncode": null
54
  },
55
  "gpu-1": {
56
- "pid": 16194,
57
  "returncode": null
58
  },
59
  "gpu-2": {
60
- "pid": 16195,
61
  "returncode": null
62
  },
63
  "gpu-3": {
64
- "pid": 16196,
65
  "returncode": null
66
  },
67
  "gpu-4": {
68
- "pid": 16197,
69
  "returncode": null
70
  },
71
  "gpu-5": {
72
- "pid": 16198,
73
  "returncode": null
74
  }
75
  }
 
1
  {
2
+ "utc": "2026-10-24T04:17:20Z",
3
  "stage": "indexing_and_production",
4
  "verified": 26,
5
  "counts": {
 
37
  "verified_pending_cleanup": 0,
38
  "processes": {
39
  "index-source": {
40
+ "pid": 18737,
41
  "returncode": null
42
  },
43
  "index-global_style1": {
44
+ "pid": 18738,
45
  "returncode": null
46
  },
47
  "index-global_style2": {
48
+ "pid": 18739,
49
  "returncode": null
50
  },
51
  "gpu-0": {
52
+ "pid": 18740,
53
  "returncode": null
54
  },
55
  "gpu-1": {
56
+ "pid": 18741,
57
  "returncode": null
58
  },
59
  "gpu-2": {
60
+ "pid": 18742,
61
  "returncode": null
62
  },
63
  "gpu-3": {
64
+ "pid": 18743,
65
  "returncode": null
66
  },
67
  "gpu-4": {
68
+ "pid": 18744,
69
  "returncode": null
70
  },
71
  "gpu-5": {
72
+ "pid": 18745,
73
  "returncode": null
74
  }
75
  }