Feature Extraction
Transformers
TensorBoard
Safetensors
English
captionbert_structured_rotary
sentence-similarity
consensus-distillation
rotary-embeddings
custom_code
Instructions to use AbstractPhil/captionbert-8192-rotary with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbstractPhil/captionbert-8192-rotary with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="AbstractPhil/captionbert-8192-rotary", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AbstractPhil/captionbert-8192-rotary", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Preserve larger-stage lane A console and locked selection
Browse files- campaigns/structured-20261106/operations/lane-A/20261106T200940Z/console.log +0 -0
- campaigns/structured-20261106/operations/lane-A/20261106T200940Z/locked-selection.json +0 -0
- campaigns/structured-20261106/operations/lane-A/20261106T200940Z/operation.json +22 -0
- campaigns/structured-20261106/operations/lane-A/20261106T200940Z/orchestration-source.py +116 -0
campaigns/structured-20261106/operations/lane-A/20261106T200940Z/console.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
campaigns/structured-20261106/operations/lane-A/20261106T200940Z/locked-selection.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
campaigns/structured-20261106/operations/lane-A/20261106T200940Z/operation.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"lane": "A",
|
| 3 |
+
"jobs": [
|
| 4 |
+
[
|
| 5 |
+
"full4m",
|
| 6 |
+
"H16",
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
[
|
| 10 |
+
"full4m",
|
| 11 |
+
"N16",
|
| 12 |
+
1
|
| 13 |
+
],
|
| 14 |
+
[
|
| 15 |
+
"exposure1m",
|
| 16 |
+
"H16",
|
| 17 |
+
1
|
| 18 |
+
]
|
| 19 |
+
],
|
| 20 |
+
"time_utc": "20261106T200940Z",
|
| 21 |
+
"training_release": "0.3.0"
|
| 22 |
+
}
|
campaigns/structured-20261106/operations/lane-A/20261106T200940Z/orchestration-source.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Execute the locked six-model larger experiment on two existing G4s.
|
| 2 |
+
|
| 3 |
+
This orchestrator imports the original installed training release; it does not
|
| 4 |
+
replace it. Each lane owns one weight seed for all three registered recipes.
|
| 5 |
+
"""
|
| 6 |
+
import argparse
|
| 7 |
+
from datetime import datetime, timezone
|
| 8 |
+
import hashlib
|
| 9 |
+
import inspect
|
| 10 |
+
import json
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
import shutil
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
TRAIN_VERSION = "0.3.0"
|
| 16 |
+
TRAIN_SOURCE_SHA256 = "094bf61ef954c61a2b200e5e8760348160b76a5fbfd186602dd992e4b62ccfa6"
|
| 17 |
+
SCREEN_ID = "dc37215529c188be7b93804c4a21f125afa353e037b1a2a8fc11e5b2fc817d3a"
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def read_selection(path):
|
| 21 |
+
value = json.loads(Path(path).read_text(encoding="utf8"))
|
| 22 |
+
analysis = value["analysis"]
|
| 23 |
+
if analysis["status"] != "selected" or analysis["config_id"] != SCREEN_ID:
|
| 24 |
+
raise ValueError("Finish the registered screen and lock a complete development-only selection first")
|
| 25 |
+
selection = analysis["selection"]
|
| 26 |
+
if selection["seeds"] != [1, 2]:
|
| 27 |
+
raise ValueError("The larger experiment must preserve both registered seeds")
|
| 28 |
+
if selection["relative"] not in ("R8", "N16"):
|
| 29 |
+
raise ValueError("Invalid relative reference")
|
| 30 |
+
if selection["structured"] not in ("H16", "KEND", "KALL", "KALLP", "KALLP_N0", "KALLP_L8"):
|
| 31 |
+
raise ValueError("Invalid structured option")
|
| 32 |
+
if not value.get("source_revision") or value.get("complete_runs", 0) < 18:
|
| 33 |
+
raise ValueError("The selection needs a revision-pinned complete result census")
|
| 34 |
+
revisions = value.get("final_benchmark_revisions", {})
|
| 35 |
+
if len(revisions) != 8 or any(len(rev) != 40 for rev in revisions.values()):
|
| 36 |
+
raise ValueError("Lock the same eight benchmark dataset revisions before running either final lane")
|
| 37 |
+
return value
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def jobs(selection, lane):
|
| 41 |
+
selected = selection["analysis"]["selection"]
|
| 42 |
+
seed = {"A": 1, "B": 2}[lane]
|
| 43 |
+
return [("full4m", selected["structured"], seed),
|
| 44 |
+
("full4m", selected["relative"], seed),
|
| 45 |
+
("exposure1m", selected["structured"], seed)]
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def main():
|
| 49 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 50 |
+
p.add_argument("--lane", choices=("A", "B"), required=True)
|
| 51 |
+
p.add_argument("--selection", required=True)
|
| 52 |
+
p.add_argument("--root", default="/content/captionbert-structured")
|
| 53 |
+
p.add_argument("--data", default="/content/captionbert-data")
|
| 54 |
+
p.add_argument("--dry-run", action="store_true")
|
| 55 |
+
p.add_argument("--ship-only", action="store_true")
|
| 56 |
+
p.add_argument("--console")
|
| 57 |
+
args = p.parse_args()
|
| 58 |
+
selection = read_selection(args.selection)
|
| 59 |
+
work = jobs(selection, args.lane)
|
| 60 |
+
root = Path(args.root)
|
| 61 |
+
if args.dry_run:
|
| 62 |
+
print(json.dumps(dict(lane=args.lane, jobs=work, training_release=TRAIN_VERSION,
|
| 63 |
+
selection=selection["analysis"]["selection"]), indent=2))
|
| 64 |
+
return
|
| 65 |
+
if args.ship_only:
|
| 66 |
+
from huggingface_hub import HfApi
|
| 67 |
+
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
| 68 |
+
folder = root / f"final-operation-{args.lane}-{stamp}"
|
| 69 |
+
folder.mkdir(parents=True, exist_ok=False)
|
| 70 |
+
shutil.copyfile(args.selection, folder / "locked-selection.json")
|
| 71 |
+
shutil.copyfile(__file__, folder / "orchestration-source.py")
|
| 72 |
+
if args.console:
|
| 73 |
+
console = Path(args.console)
|
| 74 |
+
if not console.resolve().is_relative_to(root.resolve()):
|
| 75 |
+
raise ValueError("Console must belong to this campaign")
|
| 76 |
+
shutil.copyfile(console, folder / "console.log")
|
| 77 |
+
(folder / "operation.json").write_text(json.dumps(dict(
|
| 78 |
+
lane=args.lane, jobs=work, time_utc=stamp, training_release=TRAIN_VERSION
|
| 79 |
+
), indent=2) + "\n", encoding="utf8")
|
| 80 |
+
HfApi().upload_folder(repo_id="AbstractPhil/captionbert-8192-rotary",
|
| 81 |
+
folder_path=folder, path_in_repo=f"campaigns/structured-20261106/operations/lane-{args.lane}/{stamp}",
|
| 82 |
+
commit_message=f"Preserve larger-stage lane {args.lane} console and locked selection")
|
| 83 |
+
print("Full larger-stage console and operation source uploaded", flush=True)
|
| 84 |
+
return
|
| 85 |
+
import captionbert_rotary
|
| 86 |
+
from captionbert_rotary.modeling_captionbert import CaptionBertModel
|
| 87 |
+
from captionbert_rotary.structured_campaign import CampaignConfig, FOUR_MILLION_CHUNKS, run_campaign
|
| 88 |
+
source = Path(inspect.getsourcefile(CaptionBertModel))
|
| 89 |
+
if captionbert_rotary.__version__ != TRAIN_VERSION or hashlib.sha256(source.read_bytes()).hexdigest() != TRAIN_SOURCE_SHA256:
|
| 90 |
+
raise RuntimeError("Restore the original v0.3.0 isolated environment with the tagged notebook setup cell")
|
| 91 |
+
root.mkdir(parents=True, exist_ok=True)
|
| 92 |
+
free = shutil.disk_usage(root).free / 1e9
|
| 93 |
+
print(f"Larger-stage disk free: {free:.1f} GB; seed-owned jobs {work}", flush=True)
|
| 94 |
+
if free < 25:
|
| 95 |
+
raise RuntimeError("Less than25GB free: preserve uploaded screen artifacts and use a fresh G4 runtime with the original setup cell")
|
| 96 |
+
for stage, arm, seed in work:
|
| 97 |
+
directory = root / stage
|
| 98 |
+
directory.mkdir(parents=True, exist_ok=True)
|
| 99 |
+
cfg = CampaignConfig(stage=stage, arms=(arm,), seeds=(seed,),
|
| 100 |
+
train_chunks=FOUR_MILLION_CHUNKS if stage == "full4m" else (0, 1),
|
| 101 |
+
epochs=4 if stage == "full4m" else 16, warmup_steps=400,
|
| 102 |
+
max_steps=7808, final_test=True, output_dir=str(directory), data_dir=args.data)
|
| 103 |
+
if cfg.code_revision != "v0.3.0":
|
| 104 |
+
raise RuntimeError("Training identity changed; restore the original v0.3.0 environment")
|
| 105 |
+
pins = directory / "benchmark_revisions.json"
|
| 106 |
+
expected = selection["final_benchmark_revisions"]
|
| 107 |
+
if pins.exists() and json.loads(pins.read_text()) != expected:
|
| 108 |
+
raise ValueError("Existing benchmark revisions differ; do not overwrite another run's pins")
|
| 109 |
+
pins.write_text(json.dumps(expected, indent=2, sort_keys=True) + "\n", encoding="utf8")
|
| 110 |
+
shutil.copyfile(args.selection, directory / "locked-selection.json")
|
| 111 |
+
print(f"LOCKED larger experiment: {stage}/{arm}-seed{seed}, {cfg.fingerprint()}", flush=True)
|
| 112 |
+
run_campaign(cfg)
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
main()
|