xhluca commited on
Commit
b5f46cb
1 Parent(s): 213704e

Update README.md

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