Update collect env details and issue template (#14017)

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
This commit is contained in:
Luca Medeiros 2022-08-10 09:38:18 +09:00 committed by GitHub
parent 975a4fc2f1
commit 8fa9e8651d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 27 deletions

View File

@ -41,8 +41,16 @@ You can get the script and run it with:
```bash
wget https://raw.githubusercontent.com/Lightning-AI/lightning/master/requirements/collect_env_details.py
python collect_env_details.py
```
<details>
<summary>Details</summary>
Paste the output here and move this toggle outside of the comment block.
</details>
You can also fill out the list below manually.
-->

View File

@ -20,27 +20,17 @@ import os
import platform
import sys
import numpy
import pkg_resources
import torch
import tqdm
sys.path += [os.path.abspath(".."), os.path.abspath("")]
import pytorch_lightning # noqa: E402
try:
import lightning
except ModuleNotFoundError:
pass
try:
import lightning_app
except ModuleNotFoundError:
pass
LEVEL_OFFSET = "\t"
KEY_PADDING = 20
def info_system():
def info_system() -> dict:
return {
"OS": platform.system(),
"architecture": platform.architecture(),
@ -50,28 +40,24 @@ def info_system():
}
def info_cuda():
def info_cuda() -> dict:
return {
"GPU": [torch.cuda.get_device_name(i) for i in range(torch.cuda.device_count())],
# 'nvidia_driver': get_nvidia_driver_version(run_lambda),
"GPU": [torch.cuda.get_device_name(i) for i in range(torch.cuda.device_count())] or None,
"available": torch.cuda.is_available(),
"version": torch.version.cuda,
}
def info_packages():
return {
"numpy": numpy.__version__,
"pyTorch_version": torch.__version__,
"pyTorch_debug": torch.version.debug,
"pytorch-lightning": pytorch_lightning.__version__,
"lightning": lightning.__version__ if "lightning" in sys.modules else None,
"lightning_app": lightning_app.__version__ if "lightning_app" in sys.modules else None,
"tqdm": tqdm.__version__,
}
def info_packages() -> dict:
"""Get name and version of all installed packages."""
packages = {}
for dist in pkg_resources.working_set:
package = dist.as_requirement()
packages[package.key] = package.specs[0][1]
return packages
def nice_print(details, level=0):
def nice_print(details: dict, level: int = 0) -> list:
lines = []
for k in sorted(details):
key = f"* {k}:" if level == 0 else f"- {k}:"
@ -88,8 +74,9 @@ def nice_print(details, level=0):
return lines
def main():
def main() -> None:
details = {"System": info_system(), "CUDA": info_cuda(), "Packages": info_packages()}
details["Lightning"] = {k: v for k, v in details["Packages"].items() if "torch" in k or "lightning" in k}
lines = nice_print(details)
text = os.linesep.join(lines)
print(text)