File size: 2,192 Bytes
bb34dc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Remote read-only inventory for the old 256-pair release.

Run via `ssh 6000D ... python -B - < this_script > evidence/file.json`.
It does not edit the training machine, and does not claim an index is usable data.
"""
import json
import pathlib
import re
import sys

base = pathlib.Path('/root/autodl-tmp/LampEditTraining/data_v2')
bbox = base/'bbox_conditions_v003_20261021'
index = json.loads((bbox/'INDEX.json').read_text())
sources = [base/'train_manifest.mixed256.json', base/'train_manifest.new118.json']
groups = index['groups']
sources.extend(pathlib.Path(g['manifest']) for g in groups)
pat_data = re.compile(rb'data_v2/assets/([0-9a-f]{32})')
pat_bbox = re.compile(rb'bbox_v3/assets/([0-9a-f]{32})')
data_ids, bbox_ids = set(), set()
missing = []
for p in sources:
    if not p.is_file():
        missing.append(str(p))
        continue
    with p.open('rb') as f:
        for line in f:
            data_ids.update(x.decode('ascii') for x in pat_data.findall(line))
            bbox_ids.update(x.decode('ascii') for x in pat_bbox.findall(line))

# Each factored render can itself point to base data assets and bbox assets.
recipes = 0
for asset in sorted(bbox_ids):
    path = bbox/'assets'/asset
    if not path.is_dir():
        missing.append(str(path))
        continue
    for recipe in path.rglob('RENDER.json'):
        b = recipe.read_bytes()
        data_ids.update(x.decode('ascii') for x in pat_data.findall(b))
        bbox_ids.update(x.decode('ascii') for x in pat_bbox.findall(b))
        recipes += 1

output = {
    'scope': 'old 256 manifest and indexed bbox resources; additional dependencies may exist',
    'index_groups': len(groups), 'pair_count_in_bbox_index': index.get('pairs'),
    'mixed_and_new118_manifests': [str(p) for p in sources[:2]],
    'data_asset_ids': sorted(data_ids), 'bbox_asset_ids': sorted(bbox_ids),
    'bbox_group_paths': sorted(str(pathlib.Path(g['manifest']).parent.relative_to(base)) for g in groups),
    'factored_render_recipes_scanned': recipes, 'missing_source_paths': missing,
    'no_512_data_included_by_design': True, 'remote_mutations': False,
}
json.dump(output, sys.stdout, ensure_ascii=False)
sys.stdout.write('\n')