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
2d947175
Commit
2d947175
authored
Oct 01, 2023
by
superhero-7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix linter issues
parent
f8f4ff2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
modules/sd_hijack.py
modules/sd_hijack.py
+2
-2
modules/sd_models_config.py
modules/sd_models_config.py
+1
-2
modules/xlmr_m18.py
modules/xlmr_m18.py
+6
-6
No files found.
modules/sd_hijack.py
View file @
2d947175
...
...
@@ -212,7 +212,7 @@ class StableDiffusionModelHijack:
model_embeddings
=
m
.
cond_stage_model
.
roberta
.
embeddings
model_embeddings
.
token_embedding
=
EmbeddingsWithFixes
(
model_embeddings
.
word_embeddings
,
self
)
m
.
cond_stage_model
=
sd_hijack_xlmr
.
FrozenXLMREmbedderWithCustomWords
(
m
.
cond_stage_model
,
self
)
elif
type
(
m
.
cond_stage_model
)
==
ldm
.
modules
.
encoders
.
modules
.
FrozenCLIPEmbedder
:
model_embeddings
=
m
.
cond_stage_model
.
transformer
.
text_model
.
embeddings
model_embeddings
.
token_embedding
=
EmbeddingsWithFixes
(
model_embeddings
.
token_embedding
,
self
)
...
...
@@ -258,7 +258,7 @@ class StableDiffusionModelHijack:
if
hasattr
(
m
,
'cond_stage_model'
):
delattr
(
m
,
'cond_stage_model'
)
elif
type
(
m
.
cond_stage_model
)
==
sd_hijack_xlmr
.
FrozenXLMREmbedderWithCustomWords
:
m
.
cond_stage_model
=
m
.
cond_stage_model
.
wrapped
...
...
modules/sd_models_config.py
View file @
2d947175
...
...
@@ -95,8 +95,7 @@ def guess_model_config_from_state_dict(sd, filename):
if
diffusion_model_input
.
shape
[
1
]
==
8
:
return
config_instruct_pix2pix
# import pdb; pdb.set_trace()
if
sd
.
get
(
'cond_stage_model.roberta.embeddings.word_embeddings.weight'
,
None
)
is
not
None
:
if
sd
.
get
(
'cond_stage_model.transformation.weight'
)
.
size
()[
0
]
==
1024
:
return
config_alt_diffusion_m18
...
...
modules/xlmr_m18.py
View file @
2d947175
from
transformers
import
BertPreTrainedModel
,
Bert
Model
,
Bert
Config
from
transformers
import
BertPreTrainedModel
,
BertConfig
import
torch.nn
as
nn
import
torch
from
transformers.models.xlm_roberta.configuration_xlm_roberta
import
XLMRobertaConfig
...
...
@@ -28,7 +28,7 @@ class BertSeriesModelWithTransformation(BertPreTrainedModel):
config_class
=
BertSeriesConfig
def
__init__
(
self
,
config
=
None
,
**
kargs
):
# modify initialization for autoloading
# modify initialization for autoloading
if
config
is
None
:
config
=
XLMRobertaConfig
()
config
.
attention_probs_dropout_prob
=
0.1
...
...
@@ -80,7 +80,7 @@ class BertSeriesModelWithTransformation(BertPreTrainedModel):
text
[
"attention_mask"
]
=
torch
.
tensor
(
text
[
'attention_mask'
])
.
to
(
device
)
features
=
self
(
**
text
)
return
features
[
'projection_state'
]
return
features
[
'projection_state'
]
def
forward
(
self
,
...
...
@@ -147,8 +147,8 @@ class BertSeriesModelWithTransformation(BertPreTrainedModel):
"hidden_states"
:
outputs
.
hidden_states
,
"attentions"
:
outputs
.
attentions
,
}
# return {
# 'pooler_output':pooler_output,
# 'last_hidden_state':outputs.last_hidden_state,
...
...
@@ -161,4 +161,4 @@ class BertSeriesModelWithTransformation(BertPreTrainedModel):
class
RobertaSeriesModelWithTransformation
(
BertSeriesModelWithTransformation
):
base_model_prefix
=
'roberta'
config_class
=
RobertaSeriesConfig
\ No newline at end of file
config_class
=
RobertaSeriesConfig
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