WASasquatch / ComfyUI_Preset_Merger

Merge models by preset

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It just needs a max abs selection to be perfect! :)

Extraltodeus opened this issue · comments

I used to do this:

def furthest_from_zero(tensors):
	shape = tensors.shape
	tensors = tensors.reshape(shape[0], -1)
	tensors_abs = torch.abs(tensors)
	max_abs_idx = torch.argmax(tensors_abs, dim=0)
	result = tensors[max_abs_idx, torch.arange(tensors.shape[1])]
	return result.reshape(shape[1:]) 

With .ckpt files to select the maximum absolute values from each models/layers. Now I'm a bit lost because I don't know how to do this with safetensors (I'm a self learner). Would you be able to integrate such merging method in your node? This would be really nice :)

edit: hey I just noticed that you made the WAS suite, that explains why this node is so elegantly written. Thank you for everything!

commented

Thanks you.

Also I am just sending the ratios to ModelMergeBlocksNumber which does the merging. I think this would be something to bring up in base ConfyUI as a option for merging.

Thank you so much for your answer.

I guess I will have to find a way to make it happen :)