Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -29,14 +29,12 @@ def main():
|
|
| 29 |
probe.load_state_dict(torch.load('probe.pt'))
|
| 30 |
|
| 31 |
runner = PairwiseExtractionRunner.from_pretrained('mistralai/Mistral-7B-Instruct-v0.1', optimize=False, torch_dtype=torch.float16, max_memory=mdict, device_map=dmap, low_cpu_mem_usage=True)
|
| 32 |
-
device = "cpu" if args.no_cuda else "cuda"
|
| 33 |
-
lock = Lock()
|
| 34 |
|
| 35 |
@torch.no_grad()
|
| 36 |
def run_extraction(prompt):
|
| 37 |
builder = SimplePairPromptBuilder(criterion='more positive')
|
| 38 |
lst = [x.strip() for x in prompt.lower()[:300].split(',')][:100]
|
| 39 |
-
exp = runner.run_extraction(lst, lst, layers=[15], num_repeat=
|
| 40 |
test_ds = exp.make_dataset(15)
|
| 41 |
|
| 42 |
import torch
|
|
|
|
| 29 |
probe.load_state_dict(torch.load('probe.pt'))
|
| 30 |
|
| 31 |
runner = PairwiseExtractionRunner.from_pretrained('mistralai/Mistral-7B-Instruct-v0.1', optimize=False, torch_dtype=torch.float16, max_memory=mdict, device_map=dmap, low_cpu_mem_usage=True)
|
|
|
|
|
|
|
| 32 |
|
| 33 |
@torch.no_grad()
|
| 34 |
def run_extraction(prompt):
|
| 35 |
builder = SimplePairPromptBuilder(criterion='more positive')
|
| 36 |
lst = [x.strip() for x in prompt.lower()[:300].split(',')][:100]
|
| 37 |
+
exp = runner.run_extraction(lst, lst, layers=[15], num_repeat=50, builder=builder, parallel=False, run_inference=True, debug=True, max_new_tokens=2)
|
| 38 |
test_ds = exp.make_dataset(15)
|
| 39 |
|
| 40 |
import torch
|