karl
commited on
Commit
·
629637c
1
Parent(s):
3e84e1e
provide to configure storing weights
Browse files- run_test.py +2 -1
run_test.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
#!/usr/bin/env python3
|
2 |
import os, sys
|
3 |
|
|
|
4 |
model_id, revision = sys.argv[1:]
|
5 |
user, model = model_id.split('/')
|
6 |
fn = f'{user}_{model}_{revision}.logits.safetensors'
|
@@ -50,7 +51,7 @@ def hook(module, inputs, outputs):
|
|
50 |
for idx, output in enumerate(outputs):
|
51 |
if isinstance(output, torch.Tensor):
|
52 |
store_tensor(f'{name}.output.{idx}', output);
|
53 |
-
if not list(module.children())
|
54 |
for wtname, wt in list(module.named_parameters()) + list(module.named_buffers()):
|
55 |
store_tensor(f'{name}.{wtname}', wt)
|
56 |
IDX += 1
|
|
|
1 |
#!/usr/bin/env python3
|
2 |
import os, sys
|
3 |
|
4 |
+
STORE_WEIGHTS = False
|
5 |
model_id, revision = sys.argv[1:]
|
6 |
user, model = model_id.split('/')
|
7 |
fn = f'{user}_{model}_{revision}.logits.safetensors'
|
|
|
51 |
for idx, output in enumerate(outputs):
|
52 |
if isinstance(output, torch.Tensor):
|
53 |
store_tensor(f'{name}.output.{idx}', output);
|
54 |
+
if STORE_WEIGHTS and not list(module.children()):
|
55 |
for wtname, wt in list(module.named_parameters()) + list(module.named_buffers()):
|
56 |
store_tensor(f'{name}.{wtname}', wt)
|
57 |
IDX += 1
|