"""Reproduce the released Base93 file from its immutable FP32 source and plan.""" import argparse,hashlib,json from pathlib import Path from semantic_model import load_semantic from base93_codec import encode_state ROOT=Path(__file__).resolve().parent p=argparse.ArgumentParser();p.add_argument('--source',required=True,help='Directory containing production v3 model.safetensors and config.json');p.add_argument('--output',default=str(ROOT));args=p.parse_args() source=Path(args.source);out=Path(args.output);out.mkdir(parents=True,exist_ok=True) provenance={'repo':'User-2468/mini-unet-colorizer','revision':'1a9eb8af2754ad2329a24cfe50d388cb559441d0','sha256':hashlib.sha256((source/'model.safetensors').read_bytes()).hexdigest()} if provenance['sha256']!='ec1f27d74533adc83f7ab3639a091fc4d8738a434dafc7d172c7873c28a9e715':raise ValueError('Source is not the selected production v3 checkpoint') model=load_semantic(source) plan=json.loads((ROOT/'precision_plan.json').read_text()) text,manifest=encode_state(model.state_dict(),set(dict(model.named_parameters())),model.config,provenance,plan) assert manifest['json_string_bytes']<5_000_000 (out/'weights_base93.txt').write_bytes(text.encode('ascii')) (out/'manifest.json').write_text(json.dumps(manifest,indent=2)) print(json.dumps({'text_bytes':manifest['text_bytes'],'json_string_bytes':manifest['json_string_bytes'],'sha256':hashlib.sha256(text.encode('ascii')).hexdigest()}))