Datasets:
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Tags:
reinforcement-learning
policy-optimization
klpo
exact-moment-replay
score-centering
stratified-sampling
License:
Download examples/train_tiny_lm.py from PureOne/Celestis-RL: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/datasets/PureOne/Celestis-RL/resolve/main/examples/train_tiny_lm.py
- Command line
-
hf download hf://datasets/PureOne/Celestis-RL/examples/train_tiny_lm.py
-
curl -L -o train_tiny_lm.py https://huggingface.co/datasets/PureOne/Celestis-RL/resolve/main/examples/train_tiny_lm.py
1.07 kB
| import argparse | |
| import json | |
| import torch | |
| from celestis_rl.training import TrainConfig, run_tiny_lm | |
| def main(): | |
| p = argparse.ArgumentParser(description="Offline scratch causal Transformer smoke training") | |
| p.add_argument("--steps", type=int, default=100); p.add_argument("--seed", type=int, default=7) | |
| p.add_argument("--dense", action="store_true"); p.add_argument("--output", default="runs/tiny_lm") | |
| p.add_argument("--mode",default="stratified_safe",choices=["iid","safe","trace","full","stratified_safe"]) | |
| p.add_argument("--head-backend",default="recomputed",choices=["recomputed","legacy","exact_streaming"]) | |
| args = p.parse_args(); torch.set_num_threads(1) | |
| cfg = TrainConfig(seed=args.seed, steps=args.steps, batch_size=16, learning_rate=0.002, | |
| budget=8, replay_capacity=256, mode=args.mode) | |
| r = run_tiny_lm(cfg, selected_backward=not args.dense, head_backend=args.head_backend, output=args.output) | |
| print(json.dumps({k: v for k, v in r.items() if k != "history"}, indent=2)) | |
| if __name__ == "__main__": main() | |