| """ | |
| 修复 nemo-toolkit 中的 SIGKILL 问题 | |
| File "C:/Users/o/.conda/envs/NeMo/Lib/site-packages/nemo/utils/exp_manager.py", line 176, in FaultToleranceParams | |
| rank_termination_signal: signal.Signals = signal.SIGKILL | |
| ^^^^^^^^^^^^^^ | |
| AttributeError: module 'signal' has no attribute 'SIGKILL'. Did you mean: 'SIGILL'? 是不是 signal 版本不对,conda activate NeMo 再安装正确版本? | |
| """ | |
| import os | |
| import re | |
| file_path = r"C:\Users\o\.conda\envs\NeMo\Lib\site-packages\nemo\utils\exp_manager.py" | |
| with open(file_path, "r", encoding="utf-8") as f: | |
| content = f.read() | |
| # Replace signal.SIGKILL with getattr(signal, 'SIGKILL', signal.SIGTERM) | |
| new_content = content.replace( | |
| "rank_termination_signal: signal.Signals = signal.SIGKILL", | |
| "rank_termination_signal: signal.Signals = getattr(signal, 'SIGKILL', signal.SIGTERM)" | |
| ) | |
| with open(file_path, "w", encoding="utf-8") as f: | |
| f.write(new_content) | |
| print("Patch applied successfully.") | |