Skip to content

Commit 370146e

Browse files
authored
Use freedesktop_os_release() in diffusers cli for Python >=3.10 (huggingface#8235)
* update * update
1 parent 5cd45c2 commit 370146e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/diffusers/commands/env.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
is_transformers_available,
3232
is_xformers_available,
3333
)
34+
from ..utils.testing_utils import get_python_version
3435
from . import BaseDiffusersCLICommand
3536

3637

@@ -105,6 +106,11 @@ def run(self) -> dict:
105106

106107
xformers_version = xformers.__version__
107108

109+
if get_python_version() >= (3, 10):
110+
platform_info = f"{platform.freedesktop_os_release().get('PRETTY_NAME', None)} - {platform.platform()}"
111+
else:
112+
platform_info = platform.platform()
113+
108114
is_notebook_str = "Yes" if is_notebook() else "No"
109115

110116
is_google_colab_str = "Yes" if is_google_colab() else "No"
@@ -152,7 +158,7 @@ def run(self) -> dict:
152158

153159
info = {
154160
"🤗 Diffusers version": version,
155-
"Platform": f"{platform.freedesktop_os_release().get('PRETTY_NAME', None)} - {platform.platform()}",
161+
"Platform": platform_info,
156162
"Running on a notebook?": is_notebook_str,
157163
"Running on Google Colab?": is_google_colab_str,
158164
"Python version": platform.python_version(),

0 commit comments

Comments
 (0)