Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -66,27 +66,33 @@ To get started, simply install `datasets` with `pip install datasets` and load t
|
|
| 66 |
|
| 67 |
```python
|
| 68 |
from datasets import load_dataset
|
|
|
|
| 69 |
|
| 70 |
-
# Load the training, validation and test (IID) splits
|
| 71 |
-
train = load_dataset("McGill-NLP/weblinx", split="train")
|
| 72 |
valid = load_dataset("McGill-NLP/weblinx", split="validation")
|
| 73 |
-
test = load_dataset("McGill-NLP/weblinx", split="test")
|
| 74 |
-
|
| 75 |
-
# Load one of the 4 out-of-domain splits (test_web, test_vis, test_geo, test_cat)
|
| 76 |
-
test_web = load_dataset("McGill-NLP/weblinx", split="test_web")
|
| 77 |
|
| 78 |
-
# Download and read template
|
| 79 |
snapshot_download(
|
| 80 |
-
|
| 81 |
)
|
| 82 |
-
with open('
|
| 83 |
template = f.read()
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
-
|
|
|
|
| 90 |
```
|
| 91 |
|
| 92 |
## Raw Data
|
|
|
|
| 66 |
|
| 67 |
```python
|
| 68 |
from datasets import load_dataset
|
| 69 |
+
from huggingface_hub import snapshot_download
|
| 70 |
|
|
|
|
|
|
|
| 71 |
valid = load_dataset("McGill-NLP/weblinx", split="validation")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
|
|
|
| 73 |
snapshot_download(
|
| 74 |
+
"McGill-NLP/WebLINX", repo_type="dataset", allow_patterns="templates/llama.txt", local_dir="./"
|
| 75 |
)
|
| 76 |
+
with open('llama.txt') as f:
|
| 77 |
template = f.read()
|
| 78 |
|
| 79 |
+
turn = valid[0]
|
| 80 |
+
turn_text = template.format(**turn)
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
You can now use `turn_text` as an input to LLaMA-style models. For example, you can use Sheared-LLaMA:
|
| 84 |
+
```python
|
| 85 |
+
|
| 86 |
+
from transformers import pipeline
|
| 87 |
+
|
| 88 |
+
action_model = pipeline(
|
| 89 |
+
model="McGill-NLP/Sheared-LLaMA-2.7B-weblinx", device=0, torch_dtype='auto'
|
| 90 |
+
)
|
| 91 |
+
out = action_model(turn_text, return_full_text=False, max_new_tokens=64, truncation=True)
|
| 92 |
+
pred = out[0]['generated_text']
|
| 93 |
|
| 94 |
+
print("Ref:", turn["action"])
|
| 95 |
+
print("Pred:", pred)
|
| 96 |
```
|
| 97 |
|
| 98 |
## Raw Data
|