xhluca commited on
Commit
d554b80
1 Parent(s): fca5b4d

Update README.md

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