File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ def _in_wsl():
68
68
return "microsoft-standard" in uname ().release
69
69
70
70
71
+ def _maybe_decode (value ):
72
+ """Decode if bytes instance"""
73
+ return value .decode () if isinstance (value , bytes ) else value
74
+
75
+
71
76
def init_once ():
72
77
"""Idempotent (per-process) initialization of PyNVML
73
78
@@ -104,11 +109,9 @@ def init_once():
104
109
NVML_STATE = NVMLState .DISABLED_LIBRARY_NOT_FOUND
105
110
return
106
111
107
- try :
108
- driver_vsn = pynvml .nvmlSystemGetDriverVersion ().decode ()
109
- except AttributeError :
110
- driver_vsn = pynvml .nvmlSystemGetDriverVersion ()
111
- if _in_wsl () and parse_version (driver_vsn ) < parse_version (MINIMUM_WSL_VERSION ):
112
+ if _in_wsl () and parse_version (
113
+ _maybe_decode (pynvml .nvmlSystemGetDriverVersion ())
114
+ ) < parse_version (MINIMUM_WSL_VERSION ):
112
115
NVML_STATE = NVMLState .DISABLED_WSL_INSUFFICIENT_DRIVER
113
116
return
114
117
else :
You can’t perform that action at this time.
0 commit comments