Skip to content
Snippets Groups Projects

pytorch-nightly-checker.py

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Thomas H. Espe

    Python script to check if one is affected by the PyTorch-nightly dependency-chain attack

    Edited
    pytorch-nightly-checker.py 278 B
    import pathlib
    import importlib.util
    
    s=importlib.util.find_spec('triton')
    affected=any(x.name == 'triton' for x in (pathlib.Path(s.submodule_search_locations[0] if s is not None else '/' ) / 'runtime').glob('*'))
    print('You are {}affected'.format('' if affected else 'not '))
    
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment