Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
5096c163
Commit
5096c163
authored
Jul 20, 2024
by
AUTOMATIC1111
Committed by
GitHub
Jul 20, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16173 from AUTOMATIC1111/robust-sysinfo
Robust sysinfo
parents
7b99e14a
5a5fe749
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
37 deletions
+92
-37
.gitignore
.gitignore
+1
-0
modules/launch_utils.py
modules/launch_utils.py
+0
-1
modules/sysinfo.py
modules/sysinfo.py
+91
-36
No files found.
.gitignore
View file @
5096c163
...
@@ -40,3 +40,4 @@ notification.mp3
...
@@ -40,3 +40,4 @@ notification.mp3
/test/test_outputs
/test/test_outputs
/cache
/cache
trace.json
trace.json
/sysinfo-????-??-??-??-??.json
modules/launch_utils.py
View file @
5096c163
...
@@ -446,7 +446,6 @@ def prepare_environment():
...
@@ -446,7 +446,6 @@ def prepare_environment():
exit
(
0
)
exit
(
0
)
def
configure_for_tests
():
def
configure_for_tests
():
if
"--api"
not
in
sys
.
argv
:
if
"--api"
not
in
sys
.
argv
:
sys
.
argv
.
append
(
"--api"
)
sys
.
argv
.
append
(
"--api"
)
...
...
modules/sysinfo.py
View file @
5096c163
import
json
import
json
import
os
import
os
import
sys
import
sys
import
subprocess
import
platform
import
platform
import
hashlib
import
hashlib
import
pkg_resources
import
psutil
import
re
import
re
from
pathlib
import
Path
import
launch
from
modules
import
paths_internal
,
timer
,
shared_cmd_options
,
errors
,
launch_utils
from
modules
import
paths_internal
,
timer
,
shared
,
extensions
,
errors
checksum_token
=
"DontStealMyGamePlz__WINNERS_DONT_USE_DRUGS__DONT_COPY_THAT_FLOPPY"
checksum_token
=
"DontStealMyGamePlz__WINNERS_DONT_USE_DRUGS__DONT_COPY_THAT_FLOPPY"
environment_whitelist
=
{
environment_whitelist
=
{
...
@@ -69,14 +67,46 @@ def check(x):
...
@@ -69,14 +67,46 @@ def check(x):
return
h
.
hexdigest
()
==
m
.
group
(
1
)
return
h
.
hexdigest
()
==
m
.
group
(
1
)
def
get_dict
():
def
get_cpu_info
():
ram
=
psutil
.
virtual_memory
()
cpu_info
=
{
"model"
:
platform
.
processor
()}
try
:
import
psutil
cpu_info
[
"count logical"
]
=
psutil
.
cpu_count
(
logical
=
True
)
cpu_info
[
"count physical"
]
=
psutil
.
cpu_count
(
logical
=
False
)
except
Exception
as
e
:
cpu_info
[
"error"
]
=
str
(
e
)
return
cpu_info
def
get_ram_info
():
try
:
import
psutil
ram
=
psutil
.
virtual_memory
()
return
{
x
:
pretty_bytes
(
getattr
(
ram
,
x
,
0
))
for
x
in
[
"total"
,
"used"
,
"free"
,
"active"
,
"inactive"
,
"buffers"
,
"cached"
,
"shared"
]
if
getattr
(
ram
,
x
,
0
)
!=
0
}
except
Exception
as
e
:
return
str
(
e
)
def
get_packages
():
try
:
return
subprocess
.
check_output
([
sys
.
executable
,
'-m'
,
'pip'
,
'freeze'
,
'--all'
])
.
decode
(
"utf8"
)
.
splitlines
()
except
Exception
as
pip_error
:
try
:
import
importlib.metadata
packages
=
importlib
.
metadata
.
distributions
()
return
sorted
([
f
"{package.metadata['Name']}=={package.version}"
for
package
in
packages
])
except
Exception
as
e2
:
return
{
'error pip'
:
pip_error
,
'error importlib'
:
str
(
e2
)}
def
get_dict
():
config
=
get_config
()
res
=
{
res
=
{
"Platform"
:
platform
.
platform
(),
"Platform"
:
platform
.
platform
(),
"Python"
:
platform
.
python_version
(),
"Python"
:
platform
.
python_version
(),
"Version"
:
launch
.
git_tag
(),
"Version"
:
launch_utils
.
git_tag
(),
"Commit"
:
launch
.
commit_hash
(),
"Commit"
:
launch_utils
.
commit_hash
(),
"Git status"
:
git_status
(
paths_internal
.
script_path
),
"Script path"
:
paths_internal
.
script_path
,
"Script path"
:
paths_internal
.
script_path
,
"Data path"
:
paths_internal
.
data_path
,
"Data path"
:
paths_internal
.
data_path
,
"Extensions dir"
:
paths_internal
.
extensions_dir
,
"Extensions dir"
:
paths_internal
.
extensions_dir
,
...
@@ -84,20 +114,14 @@ def get_dict():
...
@@ -84,20 +114,14 @@ def get_dict():
"Commandline"
:
get_argv
(),
"Commandline"
:
get_argv
(),
"Torch env info"
:
get_torch_sysinfo
(),
"Torch env info"
:
get_torch_sysinfo
(),
"Exceptions"
:
errors
.
get_exceptions
(),
"Exceptions"
:
errors
.
get_exceptions
(),
"CPU"
:
{
"CPU"
:
get_cpu_info
(),
"model"
:
platform
.
processor
(),
"RAM"
:
get_ram_info
(),
"count logical"
:
psutil
.
cpu_count
(
logical
=
True
),
"Extensions"
:
get_extensions
(
enabled
=
True
,
fallback_disabled_extensions
=
config
.
get
(
'disabled_extensions'
,
[])),
"count physical"
:
psutil
.
cpu_count
(
logical
=
False
),
"Inactive extensions"
:
get_extensions
(
enabled
=
False
,
fallback_disabled_extensions
=
config
.
get
(
'disabled_extensions'
,
[])),
},
"RAM"
:
{
x
:
pretty_bytes
(
getattr
(
ram
,
x
,
0
))
for
x
in
[
"total"
,
"used"
,
"free"
,
"active"
,
"inactive"
,
"buffers"
,
"cached"
,
"shared"
]
if
getattr
(
ram
,
x
,
0
)
!=
0
},
"Extensions"
:
get_extensions
(
enabled
=
True
),
"Inactive extensions"
:
get_extensions
(
enabled
=
False
),
"Environment"
:
get_environment
(),
"Environment"
:
get_environment
(),
"Config"
:
get_config
()
,
"Config"
:
config
,
"Startup"
:
timer
.
startup_record
,
"Startup"
:
timer
.
startup_record
,
"Packages"
:
sorted
([
f
"{pkg.key}=={pkg.version}"
for
pkg
in
pkg_resources
.
working_set
]
),
"Packages"
:
get_packages
(
),
}
}
return
res
return
res
...
@@ -111,11 +135,11 @@ def get_argv():
...
@@ -111,11 +135,11 @@ def get_argv():
res
=
[]
res
=
[]
for
v
in
sys
.
argv
:
for
v
in
sys
.
argv
:
if
shared
.
cmd_opts
.
gradio_auth
and
shared
.
cmd_opts
.
gradio_auth
==
v
:
if
shared
_cmd_options
.
cmd_opts
.
gradio_auth
and
shared_cmd_options
.
cmd_opts
.
gradio_auth
==
v
:
res
.
append
(
"<hidden>"
)
res
.
append
(
"<hidden>"
)
continue
continue
if
shared
.
cmd_opts
.
api_auth
and
shared
.
cmd_opts
.
api_auth
==
v
:
if
shared
_cmd_options
.
cmd_opts
.
api_auth
and
shared_cmd_options
.
cmd_opts
.
api_auth
==
v
:
res
.
append
(
"<hidden>"
)
res
.
append
(
"<hidden>"
)
continue
continue
...
@@ -123,6 +147,7 @@ def get_argv():
...
@@ -123,6 +147,7 @@ def get_argv():
return
res
return
res
re_newline
=
re
.
compile
(
r"\r*\n"
)
re_newline
=
re
.
compile
(
r"\r*\n"
)
...
@@ -136,25 +161,55 @@ def get_torch_sysinfo():
...
@@ -136,25 +161,55 @@ def get_torch_sysinfo():
return
str
(
e
)
return
str
(
e
)
def
get_extensions
(
*
,
enabled
):
def
run_git
(
path
,
*
args
):
try
:
return
subprocess
.
check_output
([
launch_utils
.
git
,
'-C'
,
path
,
*
args
],
shell
=
False
,
encoding
=
'utf8'
)
.
strip
()
except
Exception
as
e
:
return
str
(
e
)
def
git_status
(
path
):
if
(
Path
(
path
)
/
'.git'
)
.
is_dir
():
return
run_git
(
paths_internal
.
script_path
,
'status'
)
def
get_info_from_repo_path
(
path
:
Path
):
is_repo
=
(
path
/
'.git'
)
.
is_dir
()
return
{
'name'
:
path
.
name
,
'path'
:
str
(
path
),
'commit'
:
run_git
(
path
,
'rev-parse'
,
'HEAD'
)
if
is_repo
else
None
,
'branch'
:
run_git
(
path
,
'branch'
,
'--show-current'
)
if
is_repo
else
None
,
'remote'
:
run_git
(
path
,
'remote'
,
'get-url'
,
'origin'
)
if
is_repo
else
None
,
}
def
get_extensions
(
*
,
enabled
,
fallback_disabled_extensions
=
None
):
try
:
try
:
def
to_json
(
x
:
extensions
.
Extension
):
from
modules
import
extensions
return
{
if
extensions
.
extensions
:
"name"
:
x
.
name
,
def
to_json
(
x
:
extensions
.
Extension
):
"path"
:
x
.
path
,
return
{
"version"
:
x
.
version
,
"name"
:
x
.
name
,
"branch"
:
x
.
branch
,
"path"
:
x
.
path
,
"remote"
:
x
.
remote
,
"commit"
:
x
.
commit_hash
,
}
"branch"
:
x
.
branch
,
"remote"
:
x
.
remote
,
return
[
to_json
(
x
)
for
x
in
extensions
.
extensions
if
not
x
.
is_builtin
and
x
.
enabled
==
enabled
]
}
return
[
to_json
(
x
)
for
x
in
extensions
.
extensions
if
not
x
.
is_builtin
and
x
.
enabled
==
enabled
]
else
:
return
[
get_info_from_repo_path
(
d
)
for
d
in
Path
(
paths_internal
.
extensions_dir
)
.
iterdir
()
if
d
.
is_dir
()
and
enabled
!=
(
str
(
d
.
name
)
in
fallback_disabled_extensions
)]
except
Exception
as
e
:
except
Exception
as
e
:
return
str
(
e
)
return
str
(
e
)
def
get_config
():
def
get_config
():
try
:
try
:
from
modules
import
shared
return
shared
.
opts
.
data
return
shared
.
opts
.
data
except
Exception
as
e
:
except
Exception
as
_
:
return
str
(
e
)
try
:
with
open
(
shared_cmd_options
.
cmd_opts
.
ui_settings_file
,
'r'
)
as
f
:
return
json
.
load
(
f
)
except
Exception
as
e
:
return
str
(
e
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment