better main-thread detection
This commit is contained in:
parent
50a71e63b6
commit
86a5004098
3
train.py
3
train.py
|
@ -677,7 +677,8 @@ def main(args):
|
||||||
"""
|
"""
|
||||||
handles sigterm
|
handles sigterm
|
||||||
"""
|
"""
|
||||||
if threading.current_thread().__class__.__name__ == '_MainThread':
|
is_main_thread = (torch.utils.data.get_worker_info() == None)
|
||||||
|
if is_main_thread:
|
||||||
global interrupted
|
global interrupted
|
||||||
if not interrupted:
|
if not interrupted:
|
||||||
interrupted=True
|
interrupted=True
|
||||||
|
|
Loading…
Reference in New Issue