Download package.py from maxffarrell/d3-lite-CoreAI: direct link, hf CLI and curl.
- Browser
- Download file 2.29 kB
-
https://huggingface.co/maxffarrell/d3-lite-CoreAI/resolve/main/package.py
- Command line
-
hf download hf://maxffarrell/d3-lite-CoreAI/package.py
-
curl -L -o package.py https://huggingface.co/maxffarrell/d3-lite-CoreAI/resolve/main/package.py
2.29 kB
| """Assemble a reproducible, attributed model bundle before validation/upload.""" | |
| import argparse | |
| import json | |
| import shutil | |
| from pathlib import Path | |
| p = argparse.ArgumentParser() | |
| p.add_argument("name") | |
| p.add_argument("--bundle") | |
| a = p.parse_args() | |
| source = Path("upstream") / a.name | |
| bundle = Path(a.bundle) if a.bundle else Path("bundles") / (a.name + "-CoreAI") | |
| manifest = json.loads((bundle / "manifest.json").read_text()) | |
| record = next( | |
| x | |
| for x in json.loads(Path("sources.json").read_text()) | |
| if x["id"] == "vllm-sr/" + a.name | |
| ) | |
| manifest.update( | |
| source=record["id"], | |
| revision=record["revision"], | |
| format="Apple Core AI .aimodel", | |
| attention_mode="noncausal_full_attention", | |
| function="main", | |
| ) | |
| (bundle / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n") | |
| for name in [ | |
| "LICENSE", | |
| "NOTICE", | |
| "config.json", | |
| "decision_config.json", | |
| "tokenizer.json", | |
| "tokenizer_config.json", | |
| "vocab.json", | |
| "merges.txt", | |
| "chat_template.jinja", | |
| "preprocessor_config.json", | |
| "video_preprocessor_config.json", | |
| "MODEL_MANIFEST.json", | |
| ]: | |
| if (source / name).exists(): | |
| shutil.copy2( | |
| source / name, | |
| bundle / name | |
| if name != "MODEL_MANIFEST.json" | |
| else "UPSTREAM_MANIFEST.json", | |
| ) | |
| for name in [ | |
| "convert.py", | |
| "coreai_d3.py", | |
| "validate_mm.py", | |
| "validation_cases.py", | |
| "package.py", | |
| "sources.json", | |
| "smoke_runtime.py", | |
| "finalize_bundle.py", | |
| ]: | |
| shutil.copy2(name, bundle / name) | |
| shutil.copy2(source / "d3_format.py", bundle / "d3_format.py") | |
| shutil.copy2(source / "d3_runtime.py", bundle / "d3_runtime.py") | |
| shutil.copy2(source / "NOTICE", bundle / "UPSTREAM_NOTICE") | |
| (bundle / "requirements.txt").write_text( | |
| "coreai-core==1.0.0b3\ncoreai-torch==0.4.3\ntorch==2.14.0\ntorchvision==0.29.1\ntransformers==5.17.0\nnumpy==2.4.6\nPillow==12.3.0\nopencv-python-headless==5.0.0.93\nhuggingface-hub==1.33.0\naccelerate==1.15.0\nsafetensors==0.8.0\n" | |
| ) | |
| (bundle / "NOTICE").write_text( | |
| (source / "NOTICE").read_text() | |
| + "\nCore AI conversion and host adapter by Max Farrell, 2026.\nConverted from " | |
| + record["id"] | |
| + " at " | |
| + record["revision"] | |
| + ".\nUpstream prompt formatting retained in d3_format.py.\n" | |
| ) | |