Bturtel commited on
Commit
eb0d703
verified
1 Parent(s): db9ac85

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +42 -17
README.md CHANGED
@@ -2,7 +2,7 @@
2
  language:
3
  - en
4
  license: apache-2.0
5
- library_name: transformers
6
  tags:
7
  - forecasting
8
  - prediction
@@ -40,7 +40,9 @@ model-index:
40
 
41
  ### RL-Tuned gpt-oss-120b for Predicting Trump Administration Actions
42
 
43
- We fine-tuned [gpt-oss-120b](https://huggingface.co/openai/gpt-oss-120b) with reinforcement learning to predict Trump administration actions. Trained on the [WWTD-2025](https://huggingface.co/datasets/LightningRodLabs/WWTD-2025) dataset of 2,108 binary forecasting questions generated with the [Lightning Rod SDK](https://github.com/lightning-rod-labs/lightningrod-python-sdk), the model beats GPT-5 on held-out forecasting questions.
 
 
44
 
45
  [Dataset](https://huggingface.co/datasets/LightningRodLabs/WWTD-2025) 路 [Lightning Rod SDK](https://github.com/lightning-rod-labs/lightningrod-python-sdk) 路 [Future-as-Label paper](https://arxiv.org/abs/2601.06336) 路 [Outcome-based RL paper](https://arxiv.org/abs/2505.17989)
46
 
@@ -53,8 +55,8 @@ Evaluated on 682 held-out test questions under two conditions: with news context
53
  | Model | Brier (With Context) | BSS | Brier (No Context) | BSS | ECE (With Context) | ECE (No Context) |
54
  |-------|:---:|:---:|:---:|:---:|:---:|:---:|
55
  | GPT-5 | 0.200 | +0.14 | 0.258 | -0.11 | 0.091 | 0.191 |
56
- | gpt-oss-120b | 0.213 | +0.08 | 0.260 | -0.12 | 0.111 | 0.190 |
57
- | **gpt-oss-120b RL (this model)** | **0.194** | **+0.16** | **0.242** | **-0.04** | **0.079** | **0.164** |
58
 
59
  ![Brier Skill Score](https://huggingface.co/datasets/LightningRodLabs/WWTD-2025/resolve/main/brier_skill_score.png)
60
 
@@ -83,16 +85,31 @@ Evaluated on 682 held-out test questions under two conditions: with news context
83
 
84
  ## Usage
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  ```python
87
- from transformers import AutoModelForCausalLM, AutoTokenizer
88
 
89
- model = AutoModelForCausalLM.from_pretrained(
90
- "LightningRodLabs/Trump-Forecaster",
91
- torch_dtype="auto",
92
- device_map="auto",
93
  trust_remote_code=True,
 
 
94
  )
95
- tokenizer = AutoTokenizer.from_pretrained("LightningRodLabs/Trump-Forecaster", trust_remote_code=True)
96
 
97
  prompt = """You are a forecasting expert. Given the question and context below, predict the probability that the answer is "Yes".
98
 
@@ -100,18 +117,26 @@ Question: Will Trump impose 25% tariffs on all goods from Canada by February 1,
100
 
101
  Respond with your reasoning, then give your final answer as a probability between 0 and 1 inside <answer></answer> tags."""
102
 
103
- inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
104
- outputs = model.generate(**inputs, max_new_tokens=4096, do_sample=True, temperature=0.7)
105
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
106
  ```
107
 
108
- For faster inference with the MoE architecture, use [SGLang](https://github.com/sgl-project/sglang):
109
 
110
  ```python
111
- import sglang as sgl
112
 
113
- engine = sgl.Engine(model_path="LightningRodLabs/Trump-Forecaster", trust_remote_code=True, dtype="bfloat16")
114
- output = engine.generate(prompt, sampling_params={"max_new_tokens": 4096, "stop": ["</answer>"]})
 
 
 
 
 
 
 
 
 
115
  ```
116
 
117
  ---
 
2
  language:
3
  - en
4
  license: apache-2.0
5
+ library_name: peft
6
  tags:
7
  - forecasting
8
  - prediction
 
40
 
41
  ### RL-Tuned gpt-oss-120b for Predicting Trump Administration Actions
42
 
43
+ We fine-tuned [gpt-oss-120b](https://huggingface.co/openai/gpt-oss-120b) with reinforcement learning to predict Trump administration actions. Trained on the [WWTD-2025](https://huggingface.co/datasets/LightningRodLabs/WWTD-2025) dataset of 2,108 binary forecasting questions generated with the [Lightning Rod SDK](https://github.com/lightning-rod-labs/lightningrod-python-sdk), Trump-Forecaster beats GPT-5 on held-out forecasting questions.
44
+
45
+ This repo contains a **LoRA adapter** (5.3 GB) for gpt-oss-120b. A standalone `merge.py` script is included to produce a full merged model if needed.
46
 
47
  [Dataset](https://huggingface.co/datasets/LightningRodLabs/WWTD-2025) 路 [Lightning Rod SDK](https://github.com/lightning-rod-labs/lightningrod-python-sdk) 路 [Future-as-Label paper](https://arxiv.org/abs/2601.06336) 路 [Outcome-based RL paper](https://arxiv.org/abs/2505.17989)
48
 
 
55
  | Model | Brier (With Context) | BSS | Brier (No Context) | BSS | ECE (With Context) | ECE (No Context) |
56
  |-------|:---:|:---:|:---:|:---:|:---:|:---:|
57
  | GPT-5 | 0.200 | +0.14 | 0.258 | -0.11 | 0.091 | 0.191 |
58
+ | gpt-oss-120b (base) | 0.213 | +0.08 | 0.260 | -0.12 | 0.111 | 0.190 |
59
+ | **Trump-Forecaster** | **0.194** | **+0.16** | **0.242** | **-0.04** | **0.079** | **0.164** |
60
 
61
  ![Brier Skill Score](https://huggingface.co/datasets/LightningRodLabs/WWTD-2025/resolve/main/brier_skill_score.png)
62
 
 
85
 
86
  ## Usage
87
 
88
+ This repo contains a LoRA adapter trained with [Tinker](https://tinker.computer). The adapter uses Tinker's module naming convention, so it requires a merge step before inference. A standalone `merge.py` script is included.
89
+
90
+ ### Merge into full model
91
+
92
+ ```bash
93
+ pip install torch transformers safetensors tqdm huggingface-hub
94
+ python merge.py --output ./trump-forecaster-merged
95
+ ```
96
+
97
+ This downloads the base model (MXFP4, ~30 GB), dequantizes to bf16, applies the LoRA adapter, and saves the merged model (~300 GB bf16). Requires ~300 GB RAM, no GPU needed.
98
+
99
+ ### Inference with the merged model
100
+
101
+ With [SGLang](https://github.com/sgl-project/sglang) (recommended for MoE):
102
+
103
  ```python
104
+ import sglang as sgl
105
 
106
+ engine = sgl.Engine(
107
+ model_path="./trump-forecaster-merged",
108
+ tokenizer_path="openai/gpt-oss-120b",
 
109
  trust_remote_code=True,
110
+ dtype="bfloat16",
111
+ tp_size=2, # needs 2x 80GB GPUs for bf16
112
  )
 
113
 
114
  prompt = """You are a forecasting expert. Given the question and context below, predict the probability that the answer is "Yes".
115
 
 
117
 
118
  Respond with your reasoning, then give your final answer as a probability between 0 and 1 inside <answer></answer> tags."""
119
 
120
+ output = engine.generate(prompt, sampling_params={"max_new_tokens": 4096, "stop": ["</answer>"]})
121
+ print(output["text"])
 
122
  ```
123
 
124
+ Or with transformers:
125
 
126
  ```python
127
+ from transformers import AutoModelForCausalLM, AutoTokenizer
128
 
129
+ model = AutoModelForCausalLM.from_pretrained(
130
+ "./trump-forecaster-merged",
131
+ torch_dtype="auto",
132
+ device_map="auto",
133
+ trust_remote_code=True,
134
+ )
135
+ tokenizer = AutoTokenizer.from_pretrained("openai/gpt-oss-120b", trust_remote_code=True)
136
+
137
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
138
+ outputs = model.generate(**inputs, max_new_tokens=4096, do_sample=True, temperature=0.7)
139
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
140
  ```
141
 
142
  ---