junaid0600 commited on
Commit
8ff689d
Β·
verified Β·
1 Parent(s): 9a30866

Update training/train_agent.py

Browse files
Files changed (1) hide show
  1. training/train_agent.py +19 -0
training/train_agent.py CHANGED
@@ -13,6 +13,7 @@ FIXES applied:
13
  import os
14
  import re
15
  import json
 
16
  import requests
17
  from datasets import Dataset
18
 
@@ -25,6 +26,21 @@ except ImportError:
25
  UNSLOTH_AVAILABLE = False
26
  print("⚠️ Unsloth not available. Run: pip install unsloth trl")
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  # ─────────────────────────────────────────────
29
  # CONFIG
30
  # ─────────────────────────────────────────────
@@ -374,6 +390,9 @@ def train():
374
  # Avoid generation warnings from simultaneously using max_length and max_new_tokens.
375
  if hasattr(model, "generation_config"):
376
  model.generation_config.max_length = None
 
 
 
377
 
378
  config = GRPOConfig(
379
  output_dir = OUTPUT_DIR,
 
13
  import os
14
  import re
15
  import json
16
+ import warnings
17
  import requests
18
  from datasets import Dataset
19
 
 
26
  UNSLOTH_AVAILABLE = False
27
  print("⚠️ Unsloth not available. Run: pip install unsloth trl")
28
 
29
+ # Keep demo/training logs readable by silencing known upstream deprecation noise.
30
+ warnings.filterwarnings(
31
+ "ignore",
32
+ message=r".*Both `max_new_tokens`.*and `max_length`.*",
33
+ )
34
+ warnings.filterwarnings(
35
+ "ignore",
36
+ message=r".*AttentionMaskConverter.*deprecated.*",
37
+ category=FutureWarning,
38
+ )
39
+ warnings.filterwarnings(
40
+ "ignore",
41
+ message=r".*use_return_dict.*deprecated.*",
42
+ )
43
+
44
  # ─────────────────────────────────────────────
45
  # CONFIG
46
  # ─────────────────────────────────────────────
 
390
  # Avoid generation warnings from simultaneously using max_length and max_new_tokens.
391
  if hasattr(model, "generation_config"):
392
  model.generation_config.max_length = None
393
+ if hasattr(model, "config"):
394
+ # Some stacks still read generation defaults from model.config.
395
+ model.config.max_length = None
396
 
397
  config = GRPOConfig(
398
  output_dir = OUTPUT_DIR,