Skip to content

Commit

Permalink
Improve transformers-cli env reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
ji-huazhong committed May 24, 2024
1 parent 21e259d commit 843e025
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/transformers/commands/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
is_safetensors_available,
is_tf_available,
is_torch_available,
is_torch_npu_available,
)
from . import BaseTransformersCLICommand

Expand Down Expand Up @@ -88,6 +89,7 @@ def run(self):

pt_version = torch.__version__
pt_cuda_available = torch.cuda.is_available()
pt_npu_available = is_torch_npu_available()

tf_version = "not installed"
tf_cuda_available = "NA"
Expand Down Expand Up @@ -132,6 +134,11 @@ def run(self):
"Using GPU in script?": "<fill in>",
"Using distributed or parallel set-up in script?": "<fill in>",
}
if pt_cuda_available:
info["GPU type"] = torch.cuda.get_device_name()
elif pt_npu_available:
info["NPU type"] = torch.npu.get_device_name()
info["CANN version"] = torch.version.cann

print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n")
print(self.format_dict(info))
Expand Down

0 comments on commit 843e025

Please sign in to comment.