Update README.md
Browse files
README.md
CHANGED
@@ -31,6 +31,37 @@ license: llama2
|
|
31 |
<div><a href="https://github.com/McGill-NLP/weblinx">💾Code</a></div>
|
32 |
</div>
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
## Original Model
|
35 |
|
36 |
This model is finetuned on WebLINX using checkpoints previously published on Huggingface Hub.\
|
|
|
31 |
<div><a href="https://github.com/McGill-NLP/weblinx">💾Code</a></div>
|
32 |
</div>
|
33 |
|
34 |
+
## Quickstart
|
35 |
+
|
36 |
+
```python
|
37 |
+
from datasets import load_dataset
|
38 |
+
from huggingface_hub import snapshot_download
|
39 |
+
from transformers import pipeline
|
40 |
+
|
41 |
+
# Load validation split
|
42 |
+
valid = load_dataset("McGill-NLP/weblinx", split="validation")
|
43 |
+
|
44 |
+
# Download and load the templates
|
45 |
+
snapshot_download(
|
46 |
+
"McGill-NLP/WebLINX", repo_type="dataset", allow_patterns="templates/*.txt", local_dir="./"
|
47 |
+
)
|
48 |
+
with open('templates/llama.txt') as f:
|
49 |
+
template = f.read()
|
50 |
+
|
51 |
+
turn = valid[0]
|
52 |
+
turn_text = template.format(**turn)
|
53 |
+
|
54 |
+
# Load action model and input the text to get prediction
|
55 |
+
action_model = pipeline(
|
56 |
+
model="McGill-NLP/Sheared-LLaMA-1.3B-weblinx", device=0, torch_dtype='auto'
|
57 |
+
)
|
58 |
+
out = action_model(turn_text, return_full_text=False, max_new_tokens=64, truncation=True)
|
59 |
+
pred = out[0]['generated_text']
|
60 |
+
|
61 |
+
print("Ref:", turn["action"])
|
62 |
+
print("Pred:", pred)
|
63 |
+
```
|
64 |
+
|
65 |
## Original Model
|
66 |
|
67 |
This model is finetuned on WebLINX using checkpoints previously published on Huggingface Hub.\
|