Detect the last index of the file containing the target value. Args: target (int): Target index. cumulative_lengths (list): List of cumulative lengths. Returns: 0 if the target value is in the first file, the last index of the file containing the target value ot
(
target: int, cumulative_lengths: list[int]
)
| 341 | |
| 342 | |
| 343 | def detect_changing_points( |
| 344 | target: int, cumulative_lengths: list[int] |
| 345 | ) -> Union[int, None]: |
| 346 | """ |
| 347 | Detect the last index of the file containing the target value. |
| 348 | Args: |
| 349 | target (int): Target index. |
| 350 | cumulative_lengths (list): List of cumulative lengths. |
| 351 | |
| 352 | Returns: |
| 353 | 0 if the target value is in the first file, the last index of the file containing the target value otherwise. |
| 354 | """ |
| 355 | for i, length in enumerate(cumulative_lengths): |
| 356 | if target <= length: |
| 357 | if i == 0: |
| 358 | return 0 |
| 359 | else: |
| 360 | return cumulative_lengths[i - 1] |
| 361 | return None |
| 362 | |
| 363 | |
| 364 | def wandb_hyperparameters_saving( |