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
14196548
Commit
14196548
authored
Jun 27, 2023
by
AUTOMATIC1111
Committed by
GitHub
Jun 27, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11260 from dhwz/dev
fix very slow loading speed of .safetensors files
parents
d35e2461
41363e0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
modules/sd_models.py
modules/sd_models.py
+5
-2
modules/shared.py
modules/shared.py
+1
-0
No files found.
modules/sd_models.py
View file @
14196548
...
...
@@ -246,8 +246,11 @@ def read_metadata_from_safetensors(filename):
def
read_state_dict
(
checkpoint_file
,
print_global_state
=
False
,
map_location
=
None
):
_
,
extension
=
os
.
path
.
splitext
(
checkpoint_file
)
if
extension
.
lower
()
==
".safetensors"
:
device
=
map_location
or
shared
.
weight_load_location
or
devices
.
get_optimal_device_name
()
pl_sd
=
safetensors
.
torch
.
load_file
(
checkpoint_file
,
device
=
device
)
if
not
shared
.
opts
.
disable_mmap_load_safetensors
:
device
=
map_location
or
shared
.
weight_load_location
or
devices
.
get_optimal_device_name
()
pl_sd
=
safetensors
.
torch
.
load_file
(
checkpoint_file
,
device
=
device
)
else
:
pl_sd
=
safetensors
.
torch
.
load
(
open
(
checkpoint_file
,
'rb'
)
.
read
())
else
:
pl_sd
=
torch
.
load
(
checkpoint_file
,
map_location
=
map_location
or
shared
.
weight_load_location
)
...
...
modules/shared.py
View file @
14196548
...
...
@@ -376,6 +376,7 @@ options_templates.update(options_section(('system', "System"), {
"multiple_tqdm"
:
OptionInfo
(
True
,
"Add a second progress bar to the console that shows progress for an entire job."
),
"print_hypernet_extra"
:
OptionInfo
(
False
,
"Print extra hypernetwork information to console."
),
"list_hidden_files"
:
OptionInfo
(
True
,
"Load models/files in hidden directories"
)
.
info
(
"directory is hidden if its name starts with
\"
.
\"
"
),
"disable_mmap_load_safetensors"
:
OptionInfo
(
False
,
"Disable memmapping for loading .safetensors files (fixes very slow loading speed in some cases)."
),
}))
options_templates
.
update
(
options_section
((
'training'
,
"Training"
),
{
...
...
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