Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
ce80e69f
Commit
ce80e69f
authored
Jul 24, 2024
by
comfyanonymous
Browse files
Avoid loading the dll when it's not necessary.
parent
19944ad2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
fix_torch.py
fix_torch.py
+9
-1
No files found.
fix_torch.py
View file @
ce80e69f
...
@@ -9,8 +9,16 @@ torch_spec = importlib.util.find_spec("torch")
...
@@ -9,8 +9,16 @@ torch_spec = importlib.util.find_spec("torch")
for
folder
in
torch_spec
.
submodule_search_locations
:
for
folder
in
torch_spec
.
submodule_search_locations
:
lib_folder
=
os
.
path
.
join
(
folder
,
"lib"
)
lib_folder
=
os
.
path
.
join
(
folder
,
"lib"
)
test_file
=
os
.
path
.
join
(
lib_folder
,
"fbgemm.dll"
)
test_file
=
os
.
path
.
join
(
lib_folder
,
"fbgemm.dll"
)
dest
=
os
.
path
.
join
(
lib_folder
,
"libomp140.x86_64.dll"
)
if
os
.
path
.
exists
(
dest
):
break
with
open
(
test_file
,
'rb'
)
as
f
:
contents
=
f
.
read
()
if
b
"libomp140.x86_64.dll"
not
in
contents
:
break
try
:
try
:
mydll
=
ctypes
.
cdll
.
LoadLibrary
(
test_file
)
mydll
=
ctypes
.
cdll
.
LoadLibrary
(
test_file
)
except
FileNotFoundError
as
e
:
except
FileNotFoundError
as
e
:
logging
.
warning
(
"Detected pytorch version with libomp issue, patching."
)
logging
.
warning
(
"Detected pytorch version with libomp issue, patching."
)
shutil
.
copyfile
(
os
.
path
.
join
(
lib_folder
,
"libiomp5md.dll"
),
os
.
path
.
join
(
lib_folder
,
"libomp140.x86_64.dll"
)
)
shutil
.
copyfile
(
os
.
path
.
join
(
lib_folder
,
"libiomp5md.dll"
),
dest
)
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