mirror of
https://github.com/ostris/ai-toolkit.git
synced 2026-03-11 05:29:48 +00:00
Add support for threshold, ratio, and quantile on traditional LoRa
This commit is contained in:
@@ -35,7 +35,7 @@ class ExtractLoconProcess(BaseExtractProcess):
|
||||
self.disable_cp = self.get_conf('disable_cp', False)
|
||||
|
||||
# set modes
|
||||
if self.mode not in ['fixed', 'threshold', 'ratio', 'quantile']:
|
||||
if self.mode not in list(mode_dict.keys()):
|
||||
raise ValueError(f"Unknown mode: {self.mode}")
|
||||
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'])
|
||||
|
||||
@@ -2,10 +2,23 @@ from collections import OrderedDict
|
||||
from toolkit.lycoris_utils import extract_diff
|
||||
from .BaseExtractProcess import BaseExtractProcess
|
||||
|
||||
|
||||
mode_dict = {
|
||||
'fixed': {
|
||||
'dim': 4,
|
||||
'dim': 64,
|
||||
'type': int
|
||||
},
|
||||
'threshold': {
|
||||
'dim': 0,
|
||||
'type': float
|
||||
},
|
||||
'ratio': {
|
||||
'dim': 0.5,
|
||||
'type': float
|
||||
},
|
||||
'quantile': {
|
||||
'dim': 0.5,
|
||||
'type': float
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +33,7 @@ class ExtractLoraProcess(BaseExtractProcess):
|
||||
self.mode = self.get_conf('mode', 'fixed')
|
||||
|
||||
# set modes
|
||||
if self.mode not in ['fixed']:
|
||||
if self.mode not in list(mode_dict.keys()):
|
||||
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.use_sparse_bias = self.get_conf('use_sparse_bias', False)
|
||||
|
||||
Reference in New Issue
Block a user