"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "b0d539ccad090c8949c1740a9758b4152fad5f72"
Unverified Commit 97a58a5d authored by Matt's avatar Matt Committed by GitHub
Browse files

Fix env.py in cases where torch is not present (#31113)

* Fix env.py in cases where torch is not present

* Simplify the fix (and avoid some issues)
parent c8861376
...@@ -133,13 +133,14 @@ class EnvironmentCommand(BaseTransformersCLICommand): ...@@ -133,13 +133,14 @@ class EnvironmentCommand(BaseTransformersCLICommand):
"JaxLib version": f"{jaxlib_version}", "JaxLib version": f"{jaxlib_version}",
"Using distributed or parallel set-up in script?": "<fill in>", "Using distributed or parallel set-up in script?": "<fill in>",
} }
if pt_cuda_available: if is_torch_available():
info["Using GPU in script?"] = "<fill in>" if pt_cuda_available:
info["GPU type"] = torch.cuda.get_device_name() info["Using GPU in script?"] = "<fill in>"
elif pt_npu_available: info["GPU type"] = torch.cuda.get_device_name()
info["Using NPU in script?"] = "<fill in>" elif pt_npu_available:
info["NPU type"] = torch.npu.get_device_name() info["Using NPU in script?"] = "<fill in>"
info["CANN version"] = torch.version.cann 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("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n")
print(self.format_dict(info)) print(self.format_dict(info))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment