File size: 535 Bytes
f39a53d
 
 
 
 
 
0a47523
 
 
f39a53d
 
 
 
 
2ad643a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""Optional stack diagnostics for the isolated inference interpreters."""
import os

if os.environ.get('SUPRATEX_TRACE_CHILDREN') == '1':
    import faulthandler
    import sys
    import resource

    resource.setrlimit(resource.RLIMIT_CORE, (0, 0))

    faulthandler.enable()
    faulthandler.dump_traceback_later(90, repeat=True)
    print(f'[inference-diagnostics] pid={os.getpid()} entry={sys.argv[0]}: stack snapshots every 90s',
          file=sys.stderr, flush=True)
    from hf_space.weight_cache import install
    install()