renpas22 commited on
Commit
464ac9b
·
1 Parent(s): 3024a91

Fix SPECIAL_TOKENS usage - import at module level and use string literals

Browse files
Files changed (1) hide show
  1. src/reasoning/step_level_cot.py +4 -4
src/reasoning/step_level_cot.py CHANGED
@@ -17,7 +17,7 @@ from diffusers import QwenImagePipeline, QwenImageTransformer2DModel
17
  from omegaconf import OmegaConf
18
  from tqdm.auto import tqdm
19
 
20
- from .step_data import StepDataset, ReasoningChain
21
  from .prm import ProcessRewardModel, PRMTrainer
22
  from .rl_trainer import RLReasoningTrainer, RLConfig
23
  from .inference_scaling import InferenceTimeScaling, InferenceConfig
@@ -390,10 +390,10 @@ class StepLevelCoTTrainer:
390
  for chain in batch:
391
  # Format: question + reasoning steps + answer
392
  text = f"Question: {chain.prompt}\n"
393
- text += f"{SPECIAL_TOKENS['reasoning_start']}\n"
394
  for step in chain.steps:
395
- text += f"{SPECIAL_TOKENS['step_start']}{step.content}{SPECIAL_TOKENS['step_end']}\n"
396
- text += f"{SPECIAL_TOKENS['reasoning_end']}\n"
397
  text += f"Answer: {chain.final_answer}"
398
 
399
  texts.append(text)
 
17
  from omegaconf import OmegaConf
18
  from tqdm.auto import tqdm
19
 
20
+ from .step_data import StepDataset, ReasoningChain, SPECIAL_TOKENS
21
  from .prm import ProcessRewardModel, PRMTrainer
22
  from .rl_trainer import RLReasoningTrainer, RLConfig
23
  from .inference_scaling import InferenceTimeScaling, InferenceConfig
 
390
  for chain in batch:
391
  # Format: question + reasoning steps + answer
392
  text = f"Question: {chain.prompt}\n"
393
+ text += "<|reasoning_start|>\n"
394
  for step in chain.steps:
395
+ text += f"<|step_start|>{step.content}<|step_end|>\n"
396
+ text += "<|reasoning_end|>\n"
397
  text += f"Answer: {chain.final_answer}"
398
 
399
  texts.append(text)