Optimize GPU memory usage for training
()
| 130 | |
| 131 | |
| 132 | def optimize_memory_for_training() -> None: |
| 133 | """Optimize GPU memory usage for training""" |
| 134 | if not get_torch_device().is_available(): |
| 135 | return |
| 136 | |
| 137 | # Set a moderate memory allocation policy |
| 138 | get_torch_device().set_per_process_memory_fraction(0.9) # Use 90% of GPU memory |
| 139 | |
| 140 | # Clear cache |
| 141 | aggressive_empty_cache(force_sync=False) |
| 142 | |
| 143 | logger.info("Optimized GPU memory usage for training") |
| 144 | |
| 145 | |
| 146 | def enable_memory_visualize( |
nothing calls this directly
no test coverage detected