Update README.md
Browse files
README.md
CHANGED
@@ -138,9 +138,14 @@ print(pruned_html)
|
|
138 |
|
139 |
```python
|
140 |
from htmlrag import GenHTMLPruner
|
|
|
141 |
|
142 |
ckpt_path = "zstanjj/HTML-Pruner-Llama-1B"
|
143 |
-
|
|
|
|
|
|
|
|
|
144 |
block_rankings = gen_embed_pruner.calculate_block_rankings(question, pruned_html)
|
145 |
print(block_rankings)
|
146 |
|
|
|
138 |
|
139 |
```python
|
140 |
from htmlrag import GenHTMLPruner
|
141 |
+
import torch
|
142 |
|
143 |
ckpt_path = "zstanjj/HTML-Pruner-Llama-1B"
|
144 |
+
if torch.cuda.is_available():
|
145 |
+
device="cuda"
|
146 |
+
else:
|
147 |
+
device="cpu"
|
148 |
+
gen_embed_pruner = GenHTMLPruner(gen_model=ckpt_path, max_node_words=5, device=device)
|
149 |
block_rankings = gen_embed_pruner.calculate_block_rankings(question, pruned_html)
|
150 |
print(block_rankings)
|
151 |
|