Added support for 3cleir, not fully tested
This commit is contained in:
1 parent
9df7af1720
commit
78b59c5e99
2 files changed
+25
-8
No files matched your search
@@ -29,6 +29,17 @@
|
|||||||
"mode": "quantile",
|
"mode": "quantile",
|
||||||
"linear": 0.5,
|
"linear": 0.5,
|
||||||
"conv": 0.5
|
"conv": 0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "lora",
|
||||||
|
"mode": "fixed",
|
||||||
|
"linear": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "lora",
|
||||||
|
"mode": "fixed",
|
||||||
|
"linear": 64,
|
||||||
|
"conv": 32
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,19 +5,23 @@ from .BaseExtractProcess import BaseExtractProcess
|
|||||||
|
|
||||||
mode_dict = {
|
mode_dict = {
|
||||||
'fixed': {
|
'fixed': {
|
||||||
'dim': 64,
|
'linear': 4,
|
||||||
|
'conv': 0,
|
||||||
'type': int
|
'type': int
|
||||||
},
|
},
|
||||||
'threshold': {
|
'threshold': {
|
||||||
'dim': 0,
|
'linear': 0,
|
||||||
|
'conv': 0,
|
||||||
'type': float
|
'type': float
|
||||||
},
|
},
|
||||||
'ratio': {
|
'ratio': {
|
||||||
'dim': 0.5,
|
'linear': 0.5,
|
||||||
|
'conv': 0,
|
||||||
'type': float
|
'type': float
|
||||||
},
|
},
|
||||||
'quantile': {
|
'quantile': {
|
||||||
'dim': 0.5,
|
'linear': 0.5,
|
||||||
|
'conv': 0,
|
||||||
'type': float
|
'type': float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,7 +39,9 @@ class ExtractLoraProcess(BaseExtractProcess):
|
|||||||
# set modes
|
# set modes
|
||||||
if self.mode not in list(mode_dict.keys()):
|
if self.mode not in list(mode_dict.keys()):
|
||||||
raise ValueError(f"Unknown mode: {self.mode}")
|
raise ValueError(f"Unknown mode: {self.mode}")
|
||||||
self.dim = self.get_conf('dim', mode_dict[self.mode]['dim'], as_type=mode_dict[self.mode]['type'])
|
self.linear = self.get_conf('linear', mode_dict[self.mode]['linear'], as_type=mode_dict[self.mode]['type'])
|
||||||
|
self.linear_param = self.get_conf('linear', mode_dict[self.mode]['linear'], as_type=mode_dict[self.mode]['type'])
|
||||||
|
self.conv_param = self.get_conf('conv', mode_dict[self.mode]['conv'], as_type=mode_dict[self.mode]['type'])
|
||||||
self.use_sparse_bias = self.get_conf('use_sparse_bias', False)
|
self.use_sparse_bias = self.get_conf('use_sparse_bias', False)
|
||||||
self.sparsity = self.get_conf('sparsity', 0.98)
|
self.sparsity = self.get_conf('sparsity', 0.98)
|
||||||
|
|
||||||
@@ -47,13 +53,13 @@ class ExtractLoraProcess(BaseExtractProcess):
|
|||||||
self.job.model_base,
|
self.job.model_base,
|
||||||
self.job.model_extract,
|
self.job.model_extract,
|
||||||
self.mode,
|
self.mode,
|
||||||
self.dim,
|
self.linear_param,
|
||||||
0,
|
self.conv_param,
|
||||||
self.job.device,
|
self.job.device,
|
||||||
self.use_sparse_bias,
|
self.use_sparse_bias,
|
||||||
self.sparsity,
|
self.sparsity,
|
||||||
small_conv=False,
|
small_conv=False,
|
||||||
linear_only=True,
|
linear_only=self.conv_param > 0.0000000001,
|
||||||
extract_unet=self.extract_unet,
|
extract_unet=self.extract_unet,
|
||||||
extract_text_encoder=self.extract_text_encoder
|
extract_text_encoder=self.extract_text_encoder
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user