Spaces:
Running
Running
Update src/JacobianScopes.py
Browse files- src/JacobianScopes.py +2 -2
src/JacobianScopes.py
CHANGED
|
@@ -57,7 +57,7 @@ def fisher_scope_scores(
|
|
| 57 |
lm_head,
|
| 58 |
method="full",
|
| 59 |
batch_size=16,
|
| 60 |
-
k=
|
| 61 |
n_hutchinson_samples=8,
|
| 62 |
eps_finite_diff=1e-5,
|
| 63 |
progress=False,
|
|
@@ -285,7 +285,7 @@ def gradient_x_input_scores(forward_pass, residual, loss_position, embedding_lay
|
|
| 285 |
return scores, logits
|
| 286 |
|
| 287 |
|
| 288 |
-
def setup_scope_context(model, tokenizer, string, front_pad=
|
| 289 |
"""
|
| 290 |
Build input_ids, attention_mask, grad_idx, decoded_tokens, residual, presence, forward_pass, d_model, embed_device
|
| 291 |
for use with scope functions. Caller must still set model.eval() and pass loss_position.
|
|
|
|
| 57 |
lm_head,
|
| 58 |
method="full",
|
| 59 |
batch_size=16,
|
| 60 |
+
k=1,
|
| 61 |
n_hutchinson_samples=8,
|
| 62 |
eps_finite_diff=1e-5,
|
| 63 |
progress=False,
|
|
|
|
| 285 |
return scores, logits
|
| 286 |
|
| 287 |
|
| 288 |
+
def setup_scope_context(model, tokenizer, string, front_pad=2, back_pad=0, front_strip=0, eos_token_id=None):
|
| 289 |
"""
|
| 290 |
Build input_ids, attention_mask, grad_idx, decoded_tokens, residual, presence, forward_pass, d_model, embed_device
|
| 291 |
for use with scope functions. Caller must still set model.eval() and pass loss_position.
|