MCPcopy Create free account
hub / github.com/RL-Align/RL-Kernel / StatelessForwardConfig

Class StatelessForwardConfig

rl_engine/executors/stateless_executor.py:23–49  ·  view source on GitHub ↗

Configuration for no-cache reference/reward model scoring.

Source from the content-addressed store, hash-verified

21
22
23@dataclass(frozen=True)
24class StatelessForwardConfig:
25 """Configuration for no-cache reference/reward model scoring."""
26
27 mode: StatelessForwardMode = "both"
28 use_cache: bool = False
29 attention_backend: StatelessAttentionBackend = "flash_attention_2"
30 reject_kv_cache_outputs: bool = True
31 detach_outputs: bool = True
32 return_token_scores: bool = False
33 max_batch_size: Optional[int] = None
34 temperature: float = 1.0
35 output_dtype: torch.dtype = torch.float32
36
37 def __post_init__(self) -> None:
38 if self.mode not in {"reference", "reward", "both"}:
39 raise ValueError("mode must be 'reference', 'reward', or 'both'")
40 if self.use_cache:
41 raise ValueError("StatelessForwardConfig.use_cache must be False")
42 if self.attention_backend not in {"flash_attention_2", "sdpa", "eager", "model_default"}:
43 raise ValueError(
44 "attention_backend must be 'flash_attention_2', 'sdpa', 'eager', "
45 "or 'model_default'"
46 )
47 if self.max_batch_size is not None and self.max_batch_size <= 0:
48 raise ValueError("max_batch_size must be greater than zero")
49 if self.temperature <= 0.0:
50 raise ValueError("temperature must be greater than zero")
51
52

Calls

no outgoing calls