Spaces:
Running
Running
fix: disable AMP for quantized models to avoid gradient scaler issues in GRPO training
Browse files
scripts/gridmind_grpo_colab.ipynb
CHANGED
|
@@ -391,6 +391,7 @@
|
|
| 391 |
")\n",
|
| 392 |
"\n",
|
| 393 |
"# Configure GRPO training\n",
|
|
|
|
| 394 |
"grpo_config_dict = {\n",
|
| 395 |
" \"output_dir\": \"./gridmind-grpo-output\",\n",
|
| 396 |
" \"num_train_epochs\": 1,\n",
|
|
@@ -401,7 +402,7 @@
|
|
| 401 |
" \"max_completion_length\": 80,\n",
|
| 402 |
" \"num_generations\": 4,\n",
|
| 403 |
" \"learning_rate\": 5e-5,\n",
|
| 404 |
-
" \"fp16\":
|
| 405 |
" \"bf16\": False,\n",
|
| 406 |
" \"max_grad_norm\": 0.0,\n",
|
| 407 |
" \"logging_steps\": 1,\n",
|
|
@@ -424,7 +425,7 @@
|
|
| 424 |
"print(f\" Batch size: {getattr(grpo_config, 'per_device_train_batch_size', 1)}\")\n",
|
| 425 |
"print(f\" Generations: {getattr(grpo_config, 'num_generations', 4)}\")\n",
|
| 426 |
"print(f\" Learning rate: {getattr(grpo_config, 'learning_rate', 5e-5)}\")\n",
|
| 427 |
-
"print(f\" Precision:
|
| 428 |
"\n",
|
| 429 |
"trainer = GRPOTrainer(\n",
|
| 430 |
" model=model,\n",
|
|
|
|
| 391 |
")\n",
|
| 392 |
"\n",
|
| 393 |
"# Configure GRPO training\n",
|
| 394 |
+
"# Note: Disable AMP (fp16/bf16) when using quantized models to avoid gradient scaler issues\n",
|
| 395 |
"grpo_config_dict = {\n",
|
| 396 |
" \"output_dir\": \"./gridmind-grpo-output\",\n",
|
| 397 |
" \"num_train_epochs\": 1,\n",
|
|
|
|
| 402 |
" \"max_completion_length\": 80,\n",
|
| 403 |
" \"num_generations\": 4,\n",
|
| 404 |
" \"learning_rate\": 5e-5,\n",
|
| 405 |
+
" \"fp16\": False,\n",
|
| 406 |
" \"bf16\": False,\n",
|
| 407 |
" \"max_grad_norm\": 0.0,\n",
|
| 408 |
" \"logging_steps\": 1,\n",
|
|
|
|
| 425 |
"print(f\" Batch size: {getattr(grpo_config, 'per_device_train_batch_size', 1)}\")\n",
|
| 426 |
"print(f\" Generations: {getattr(grpo_config, 'num_generations', 4)}\")\n",
|
| 427 |
"print(f\" Learning rate: {getattr(grpo_config, 'learning_rate', 5e-5)}\")\n",
|
| 428 |
+
"print(f\" Precision: Native (FP32, quantized to INT4)\")\n",
|
| 429 |
"\n",
|
| 430 |
"trainer = GRPOTrainer(\n",
|
| 431 |
" model=model,\n",
|
scripts/train_unsloth.py
CHANGED
|
@@ -687,8 +687,8 @@ def main():
|
|
| 687 |
"log_completions": True, # Enable completion metrics in table
|
| 688 |
"num_completions_to_print": 1, # Print 1 completion per step
|
| 689 |
"save_steps": 100,
|
| 690 |
-
"fp16":
|
| 691 |
-
"bf16":
|
| 692 |
"max_grad_norm": 0.0,
|
| 693 |
"report_to": "none",
|
| 694 |
"seed": 42,
|
|
|
|
| 687 |
"log_completions": True, # Enable completion metrics in table
|
| 688 |
"num_completions_to_print": 1, # Print 1 completion per step
|
| 689 |
"save_steps": 100,
|
| 690 |
+
"fp16": False, # Disable AMP with quantized models (avoid grad scaler issues)
|
| 691 |
+
"bf16": False,
|
| 692 |
"max_grad_norm": 0.0,
|
| 693 |
"report_to": "none",
|
| 694 |
"seed": 42,
|