xhluca commited on
Commit
ec1d5ac
1 Parent(s): b81902f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -13
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
- repo_id="McGill-NLP/WebLINX", repo_type="dataset", allow_patterns="template.txt", local_dir="./"
81
  )
82
- with open('template.txt') as f:
83
  template = f.read()
84
 
85
- # Get the input text for a model by formatting the template with the correct
86
- turn_data = valid[0]
87
- input_text = template.format(**turn_data)
 
 
 
 
 
 
 
 
 
 
 
88
 
89
- # input_text can be given to a model
 
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