Download train.py from sup2ch/wex-v0.1: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/sup2ch/wex-v0.1/resolve/main/train.py
- Command line
-
hf download hf://sup2ch/wex-v0.1/train.py
-
curl -L -o train.py https://huggingface.co/sup2ch/wex-v0.1/resolve/main/train.py
1.22 kB
| """Optional reproduction of the fixed TRAIN-only V21 recipe; never run implicitly.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from release_runtime import load_predictor | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--encoder", required=True) | |
| parser.add_argument("--train", required=True, help="Published train.jsonl only") | |
| parser.add_argument("--output", required=True, help="New output archive; existing files refused") | |
| args = parser.parse_args() | |
| if Path(args.output).exists(): | |
| raise ValueError("Output already exists") | |
| predictor = load_predictor(args.encoder) | |
| from subllm.action_v21_retained_semantic_fields import train | |
| requests, labels = [], [] | |
| with open(args.train, encoding="utf-8") as handle: | |
| for line in handle: | |
| if line.strip(): | |
| row = json.loads(line) | |
| requests.append(json.loads(row["request_json"])) | |
| labels.append(json.loads(row["label_json"])) | |
| model = train(requests, labels, feature_provider=predictor.features, mode="relational", | |
| seed=101, l2=1e-4, max_evaluations=500, gradient_tolerance=1e-5) | |
| model.save(args.output) | |
| print(json.dumps(model.metadata["optimizer_receipt"], ensure_ascii=False)) | |