Storage Config for trainer input experience buffer.
| 296 | |
| 297 | @dataclass |
| 298 | class ExperienceBufferConfig: |
| 299 | """Storage Config for trainer input experience buffer.""" |
| 300 | |
| 301 | name: str = "" |
| 302 | storage_type: str = StorageType.QUEUE.value |
| 303 | path: Optional[str] = None |
| 304 | |
| 305 | # used for StorageType.QUEUE |
| 306 | capacity: int = 10000 |
| 307 | max_read_timeout: float = 1800 |
| 308 | replay_buffer: Optional[ReplayBufferConfig] = field(default_factory=ReplayBufferConfig) |
| 309 | |
| 310 | # used for StorageType.SQL |
| 311 | max_retry_times: int = 3 |
| 312 | max_retry_interval: int = 1 |
| 313 | |
| 314 | # used for StorageType.FILE |
| 315 | split: str = "train" |
| 316 | subset_name: Optional[str] = None |
| 317 | format: FormatConfig = field(default_factory=FormatConfig) |
| 318 | enable_progress_bar: Optional[bool] = False |
| 319 | data_selector: DataSelectorConfig = field(default_factory=DataSelectorConfig) |
| 320 | |
| 321 | # ! DO NOT SET, automatically set |
| 322 | schema_type: Optional[str] = None |
| 323 | # ! DO NOT SET |
| 324 | index: int = 0 |
| 325 | # ! DO NOT SET, automatically set from buffer.batch_size |
| 326 | batch_size: int = 0 |
| 327 | # ! DO NOT SET, automatically set from model.model_path |
| 328 | tokenizer_path: Optional[str] = None |
| 329 | # ! DO NOT SET, automatically set from buffer.total_epochs |
| 330 | total_epochs: int = 1 # automatically set |
| 331 | # ! DO NOT SET, automatically set from buffer.total_steps |
| 332 | total_steps: Optional[int] = None # automatically set |
| 333 | # ! DO NOT SET, automatically set from ray_namespace |
| 334 | ray_namespace: Optional[str] = None |
| 335 | |
| 336 | def to_storage_config(self) -> StorageConfig: |
| 337 | storage_config = StorageConfig( |
| 338 | name=self.name, |
| 339 | storage_type=self.storage_type, |
| 340 | path=self.path, |
| 341 | data_selector=self.data_selector, |
| 342 | capacity=self.capacity, |
| 343 | max_read_timeout=self.max_read_timeout, |
| 344 | replay_buffer=self.replay_buffer, |
| 345 | max_retry_times=self.max_retry_times, |
| 346 | max_retry_interval=self.max_retry_interval, |
| 347 | split=self.split, |
| 348 | subset_name=self.subset_name, |
| 349 | format=self.format, |
| 350 | enable_progress_bar=self.enable_progress_bar, |
| 351 | schema_type=self.schema_type, |
| 352 | index=self.index, |
| 353 | batch_size=self.batch_size, |
| 354 | tokenizer_path=self.tokenizer_path, |
| 355 | total_epochs=self.total_epochs, |
no outgoing calls