xhluca commited on
Commit
444dff9
1 Parent(s): 8ad4dc9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md CHANGED
@@ -32,6 +32,37 @@ license: llama2
32
  </div>
33
 
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  ## Original Model
36
 
37
  This model is finetuned on WebLINX using checkpoints previously published on Huggingface Hub.\
 
32
  </div>
33
 
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-7b-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
 
68
  This model is finetuned on WebLINX using checkpoints previously published on Huggingface Hub.\