mirror of
https://github.com/facebookresearch/blt.git
synced 2025-01-19 00:47:44 +00:00
revert to original patcher style, fix warning
This commit is contained in:
parent
cff0dcb7ab
commit
9e42f5dd1d
|
@ -532,7 +532,7 @@ class Patcher:
|
||||||
if self.log_time:
|
if self.log_time:
|
||||||
s = time.time()
|
s = time.time()
|
||||||
if entropies is not None:
|
if entropies is not None:
|
||||||
scores = torch.tensor(entropies, dtype=torch.float32)
|
scores = entropies.clone().detach().to(dtype=torch.float32)
|
||||||
elif preds is not None:
|
elif preds is not None:
|
||||||
scores = entropy(preds)
|
scores = entropy(preds)
|
||||||
else:
|
else:
|
||||||
|
@ -540,11 +540,7 @@ class Patcher:
|
||||||
scores = calculate_entropies(
|
scores = calculate_entropies(
|
||||||
tokens,
|
tokens,
|
||||||
self.entropy_model,
|
self.entropy_model,
|
||||||
(
|
self.patching_batch_size,
|
||||||
patching_batch_size
|
|
||||||
if patching_batch_size is not None
|
|
||||||
else self.patching_batch_size
|
|
||||||
),
|
|
||||||
self.device,
|
self.device,
|
||||||
)
|
)
|
||||||
if self.log_time:
|
if self.log_time:
|
||||||
|
|
Loading…
Reference in a new issue