mirror of
https://github.com/ostris/ai-toolkit.git
synced 2026-04-30 19:21:39 +00:00
Cleanup and small bug fixes
This commit is contained in:
@@ -177,6 +177,14 @@ class BaseSDTrainProcess(BaseTrainProcess):
|
|||||||
)
|
)
|
||||||
o_dict['ss_output_name'] = self.job.name
|
o_dict['ss_output_name'] = self.job.name
|
||||||
|
|
||||||
|
if self.trigger_word is not None:
|
||||||
|
# just so auto1111 will pick it up
|
||||||
|
o_dict['ss_tag_frequency'] = {
|
||||||
|
'actfig': {
|
||||||
|
'actfig': 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.add_meta(o_dict)
|
self.add_meta(o_dict)
|
||||||
|
|
||||||
def get_training_info(self):
|
def get_training_info(self):
|
||||||
|
|||||||
@@ -213,9 +213,12 @@ class LoRAModule(torch.nn.Module):
|
|||||||
device = state_dict['lora_up.weight'].device
|
device = state_dict['lora_up.weight'].device
|
||||||
|
|
||||||
# todo should we do this at fp32?
|
# todo should we do this at fp32?
|
||||||
|
if isinstance(self.normalize_scaler, torch.Tensor):
|
||||||
|
scaler = self.normalize_scaler.clone().detach()
|
||||||
|
else:
|
||||||
|
scaler = torch.tensor(self.normalize_scaler).to(device, dtype=dtype)
|
||||||
|
|
||||||
total_module_scale = torch.tensor(self.normalize_scaler / target_normalize_scaler) \
|
total_module_scale = scaler / target_normalize_scaler
|
||||||
.to(device, dtype=dtype)
|
|
||||||
num_modules_layers = 2 # up and down
|
num_modules_layers = 2 # up and down
|
||||||
up_down_scale = torch.pow(total_module_scale, 1.0 / num_modules_layers) \
|
up_down_scale = torch.pow(total_module_scale, 1.0 / num_modules_layers) \
|
||||||
.to(device, dtype=dtype)
|
.to(device, dtype=dtype)
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ def get_optimizer(
|
|||||||
if use_lr < 0.1:
|
if use_lr < 0.1:
|
||||||
# dadaptation uses different lr that is values of 0.1 to 1.0. default to 1.0
|
# dadaptation uses different lr that is values of 0.1 to 1.0. default to 1.0
|
||||||
use_lr = 1.0
|
use_lr = 1.0
|
||||||
|
|
||||||
|
print(f"Using lr {use_lr}")
|
||||||
# let net be the neural network you want to train
|
# let net be the neural network you want to train
|
||||||
# you can choose weight decay value based on your problem, 0 by default
|
# you can choose weight decay value based on your problem, 0 by default
|
||||||
optimizer = Prodigy(params, lr=use_lr, **optimizer_params)
|
optimizer = Prodigy(params, lr=use_lr, **optimizer_params)
|
||||||
|
|||||||
Reference in New Issue
Block a user