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
0c7cad40
"vscode:/vscode.git/clone" did not exist on "ee9bf6c5a59008285c559d659090055b5ecee0a3"
Commit
0c7cad40
authored
Jun 14, 2023
by
comfyanonymous
Browse files
Don't initialize clip weights to default values.
parent
6971646b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
comfy/sd1_clip.py
comfy/sd1_clip.py
+3
-2
No files found.
comfy/sd1_clip.py
View file @
0c7cad40
import
os
from
transformers
import
CLIPTokenizer
,
CLIPTextModel
,
CLIPTextConfig
from
transformers
import
CLIPTokenizer
,
CLIPTextModel
,
CLIPTextConfig
,
modeling_utils
import
torch
import
traceback
import
zipfile
...
...
@@ -38,7 +38,8 @@ class SD1ClipModel(torch.nn.Module, ClipTokenWeightEncoder):
if
textmodel_json_config
is
None
:
textmodel_json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"sd1_clip_config.json"
)
config
=
CLIPTextConfig
.
from_json_file
(
textmodel_json_config
)
self
.
transformer
=
CLIPTextModel
(
config
)
with
modeling_utils
.
no_init_weights
():
self
.
transformer
=
CLIPTextModel
(
config
)
self
.
device
=
device
self
.
max_length
=
max_length
...
...
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