Abstention mix + decode fix + eval-only
Browse filesFiles changed (2)
- prepare_data.py+11-3
- train_eval.py+2-2
19 unmodified lines2021222324252627211 unmodified lines23924024124024124224224324424524624724824925025125225319 unmodified linesOUT = Path(sys.argv[2] if len(sys.argv) > 2 else "data_native")SEED = 42N_TRAIN, N_VAL, N_TEST, N_TEST_NEG = 6500, 400, 400, 100# Abstention ("no tool needed") examples mixed into train/val so the model learns when NOT to call.N_TRAIN_NEG, N_VAL_NEG = 1100, 120TOOLS_MARKER = "Here is a list of functions in JSON format that you can invoke:"MODEL_ID = "openbmb/MiniCPM5-1B"
211 unmodified lines need = N_TRAIN + N_VAL + N_TEST if len(keep) < need: raise SystemExit(f"not enough examples: {len(keep)} < {need}") train, val, test = keep[:N_TRAIN], keep[N_TRAIN : N_TRAIN + N_VAL], keep[N_TRAIN + N_VAL : need] test = test + negatives[:N_TEST_NEG] rng.shuffle(test) if len(negatives) < N_TRAIN_NEG + N_VAL_NEG + N_TEST_NEG: raise SystemExit("not enough abstention examples")
train = keep[:N_TRAIN] + negatives[:N_TRAIN_NEG] val = keep[N_TRAIN : N_TRAIN + N_VAL] + negatives[N_TRAIN_NEG : N_TRAIN_NEG + N_VAL_NEG] off = N_TRAIN_NEG + N_VAL_NEG test = keep[N_TRAIN + N_VAL : need] + negatives[off : off + N_TEST_NEG] for rows in (train, val, test): rng.shuffle(rows)
OUT.mkdir(parents=True, exist_ok=True) for name, rows in (("train", train), ("val", val), ("test", test)):214 unmodified lines215216217218219218219220221222214 unmodified linesits native XML format `<function name="..."><param name="...">...</param></function>`.
Trained on [`{dataset_id}`](https://huggingface.co/datasets/{dataset_id})(derived from ToolACE, Apache-2.0): 6,500 single-turn examples, 3 epochs, LoRA r=16 on alllinear layers, completion-only loss, max 1,600 tokens.(derived from ToolACE, Apache-2.0): 6,500 single-turn call examples plus 1,100 abstentionexamples, 3 epochs, LoRA r=16 on all linear layers, completion-only loss, max 1,024 tokens.
## Results
prepare_data.py+11-3
train_eval.py+2-2