diff --git a/IPAdapterPlus.py b/IPAdapterPlus.py index 905d187..9866bce 100644 --- a/IPAdapterPlus.py +++ b/IPAdapterPlus.py @@ -1458,7 +1458,7 @@ def batch(self, embed1, method, embed2=None, embed3=None, embed4=None, embed5=No elif method == "average": embeds = torch.mean(embeds, dim=0).unsqueeze(0) elif method == "norm average": - embeds = torch.mean(embeds / torch.norm(embeds, dim=0, keepdim=True), dim=0).unsqueeze(0) + embeds = torch.mean(embeds / (torch.norm(embeds, dim=0, keepdim=True) + 1e-10), dim=0).unsqueeze(0) elif method == "max": embeds = torch.max(embeds, dim=0).values.unsqueeze(0) elif method == "min": @@ -2036,4 +2036,4 @@ def combine(self, params_1, params_2, params_3=None, params_4=None, params_5=Non "IPAdapterCombineWeights": "IPAdapter Combine Weights", "IPAdapterRegionalConditioning": "IPAdapter Regional Conditioning", "IPAdapterCombineParams": "IPAdapter Combine Params", -} \ No newline at end of file +}