Add kaggle/train_grpo.py
Browse files- kaggle/train_grpo.py +25 -12
kaggle/train_grpo.py
CHANGED
|
@@ -18,7 +18,6 @@ import re
|
|
| 18 |
import subprocess
|
| 19 |
import sys
|
| 20 |
import traceback
|
| 21 |
-
from dataclasses import dataclass
|
| 22 |
from pathlib import Path
|
| 23 |
from typing import Any
|
| 24 |
|
|
@@ -396,18 +395,32 @@ def make_eval_before_save_callback(
|
|
| 396 |
# ---------------------------------------------------------------------------
|
| 397 |
|
| 398 |
|
| 399 |
-
@dataclass
|
| 400 |
class Cfg:
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
|
| 412 |
|
| 413 |
def main(cfg: Cfg | None = None) -> None:
|
|
|
|
| 18 |
import subprocess
|
| 19 |
import sys
|
| 20 |
import traceback
|
|
|
|
| 21 |
from pathlib import Path
|
| 22 |
from typing import Any
|
| 23 |
|
|
|
|
| 395 |
# ---------------------------------------------------------------------------
|
| 396 |
|
| 397 |
|
|
|
|
| 398 |
class Cfg:
|
| 399 |
+
"""Plain class (not dataclass) — safe under importlib.exec_module on Py3.13."""
|
| 400 |
+
|
| 401 |
+
def __init__(
|
| 402 |
+
self,
|
| 403 |
+
dataset_id: str = "vanishingradient/deepagents-rl-mbpp",
|
| 404 |
+
hub_model_id: str = "vanishingradient/deepagents-rl-coding",
|
| 405 |
+
max_steps: int = 40,
|
| 406 |
+
save_steps: int = 5,
|
| 407 |
+
num_generations: int = 4,
|
| 408 |
+
learning_rate: float = 1e-6,
|
| 409 |
+
max_completion_length: int = 512,
|
| 410 |
+
max_seq_length: int = 2048,
|
| 411 |
+
n_eval: int = 16,
|
| 412 |
+
lora_r: int = 16,
|
| 413 |
+
) -> None:
|
| 414 |
+
self.dataset_id = dataset_id
|
| 415 |
+
self.hub_model_id = hub_model_id
|
| 416 |
+
self.max_steps = max_steps
|
| 417 |
+
self.save_steps = save_steps
|
| 418 |
+
self.num_generations = num_generations
|
| 419 |
+
self.learning_rate = learning_rate
|
| 420 |
+
self.max_completion_length = max_completion_length
|
| 421 |
+
self.max_seq_length = max_seq_length
|
| 422 |
+
self.n_eval = n_eval
|
| 423 |
+
self.lora_r = lora_r
|
| 424 |
|
| 425 |
|
| 426 |
def main(cfg: Cfg | None = None) -> None:
|