- 2023/06/14 lots of new things, I lost track...join the discord server for discussion and future updates
- 2023/05/30 introducing
meh
engine - 2023/05/17 add
scorer_device
; removeaes
andcafe_*
scorers; addscore_weight
to payload.yaml
- 2023/05/16
latin-hypercube-sampling
forbayes
optimiser - 2023/05/15
adaptive-tpe
optimiser - 2023/05/03
tensor_sum
merging method - 2023/04/25
weighted_subtraction
merging method - 2023/04/22
manual
scoring method - 2023/04/18
group
parameters - 2023/04/17
freeze
parameters or set custom optimisationranges
An opinionated take on stable-diffusion models-merging automatic-optimisation.
The main idea is to treat models-merging procedure as a black-box model with 26 parameters: one for each block plus base_alpha
.
We can then try to apply black-box optimisation techniques, in particular we focus on Bayesian optimisation with a Gaussian Process emulator.
Read more here, here and here.
The optimisation process is split in two phases:
- exploration: here we sample (at random for now, with some heuristic in the future) the 26-parameter hyperspace, our block-weights. The number of samples is set by the
--init_points
argument. We use each set of weights to merge the two models we use the merged model to generatebatch_size * number of payloads
images which are then scored. - exploitation: based on the exploratory phase, the optimiser makes an idea of where (i.e. which set of weights) the optimal merge is.
This information is used to sample more set of weights
--n_iters
number of times. This time we don't sample all of them in one go. Instead, we sample once, merge the models, generate and score the images and update the optimiser knowledge about the merging space. This way the optimiser can adapt the strategy step-by-step.
At the end of the exploitation phase, the set of weights scoring the highest score are deemed to be the optimal ones.
Head to the wiki for all the instructions to get you started.