CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / evidence / FLASH-NEXT-WEIGHT-WASTE-20261118 / inventory.py
| 1 | import json,subprocess,struct,collections,re,sys,hashlib |
| 2 | from concurrent.futures import ThreadPoolExecutor |
| 3 | REV=sys.argv[1] |
| 4 | B=f'https://huggingface.co/Qwen/Qwen3.8-Flash-Next-FP8/resolve/{REV}/' |
| 5 | ix=json.load(open('index.json'))['weight_map'] |
| 6 | shards=sorted(set(ix.values())) |
| 7 | def get(u,*a): |
| 8 | for _ in range(4): |
| 9 | r=subprocess.run(['curl','-sS','-L','-m','180',*a,u],capture_output=True) |
| 10 | if r.returncode==0 and r.stdout: return r.stdout |
| 11 | raise RuntimeError(u) |
| 12 | def hdr(sh): |
| 13 | n=struct.unpack('<Q',get(B+sh,'-r','0-7'))[0] |
| 14 | return sh,get(B+sh,'-r',f'8-{7+n}') |
| 15 | def cat(k): |
| 16 | if k.startswith('model.visual'): return 'vision tower' |
| 17 | if k.startswith('mtp.'): return 'MTP head' |
| 18 | if 'ngram_embedding' in k: return 'n-gram table' |
| 19 | if '.mlp.experts.' in k: return 'routed experts (scales)' if k.endswith('scale_inv') else 'routed experts (weights)' |
| 20 | if k=='lm_head.weight': return 'lm_head' |
| 21 | if k.endswith('embed_tokens.weight'): return 'token embedding' |
| 22 | if '.ple.' in k: return 'PLE projections' |
| 23 | if 'hyper_connection' in k: return 'gated residual' |
| 24 | if '.linear_attn.' in k: return 'GDN' |
| 25 | if '.self_attn.' in k: return 'QSA attention + indexer' |
| 26 | if '.mlp.' in k: return 'router + shared expert' |
| 27 | return 'other' |
| 28 | by=collections.Counter(); dt=collections.defaultdict(collections.Counter); hh=hashlib.sha256(); nt=0 |
| 29 | with ThreadPoolExecutor(8) as ex: |
| 30 | for sh,raw in sorted(ex.map(hdr,shards)): |
| 31 | hh.update(raw) |
| 32 | for k,v in json.loads(raw).items(): |
| 33 | if k=='__metadata__': continue |
| 34 | a,b=v['data_offsets']; c=cat(k); by[c]+=b-a; dt[c][v['dtype']]+=b-a; nt+=1 |
| 35 | print('revision',REV,'shards',len(shards),'tensors',nt,'headers_sha256',hh.hexdigest()) |
| 36 | tot=sum(by.values()) |
| 37 | for c,n in by.most_common(): print(f'{c:28s} {n:>15d} B {n/2**30:8.3f} GiB {dict(dt[c])}') |
| 38 | print(f'{"TOTAL":28s} {tot:>15d} B {tot/2**30:8.3f} GiB') |
| 39 | json.dump({'revision':REV,'bytes':by,'dtypes':dt},open('inventory.json','w'),indent=1) |