From 8859ac29e9105cfd00823804b93dc6da16e2c5da Mon Sep 17 00:00:00 2001 From: Extraltodeus Date: Wed, 28 Aug 2024 07:29:07 +0200 Subject: [PATCH] Update nodes.py --- nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes.py b/nodes.py index cd06afa..7389800 100644 --- a/nodes.py +++ b/nodes.py @@ -59,13 +59,13 @@ def refine_token_weight(token_id, all_weights, sculptor_method, sculptor_multipl if sculptor_method == "maximum_absolute": concurrent_weights = torch.stack([ini_w/torch.norm(ini_w)]+[t/torch.norm(t) for i, t in enumerate(tmp_weights)]) initial_weight = maximum_absolute_values(concurrent_weights) - initial_weight *= pre_mag / torch.norm(initial_weight) + initial_weight = initial_weight * pre_mag / torch.norm(initial_weight) return initial_weight.cpu(), len(s) elif sculptor_method == "add_minimum_absolute": concurrent_weights = torch.stack([ini_w/torch.norm(ini_w)]+[t/torch.norm(t) for i, t in enumerate(tmp_weights)]) initial_weight_min = maximum_absolute_values(concurrent_weights, sculptor_method == "minimum_absolute") initial_weight = ini_w + initial_weight_min * sculptor_multiplier - initial_weight *= pre_mag / torch.norm(initial_weight) + initial_weight = initial_weight * pre_mag / torch.norm(initial_weight) return initial_weight.cpu(), len(s) concurrent_weights = torch.sum(torch.stack([t * s[i]**2 for i, t in enumerate(tmp_weights)]), dim=0)