vikp commited on
Commit
bd87267
·
1 Parent(s): 4fdce78

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +34 -0
README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc
3
+ datasets:
4
+ - vikp/reverse_instruct
5
+ ---
6
+ This model will generate instructions given some text. It is useful for labelling unlabeled datasets. It's based on a llama 7B model with 32k context length (togethercomputer/LLaMA-2-7B-32K).
7
+
8
+ It was trained across the [reverse-instruct](https://huggingface.co/vikp/reverse_instruct) dataset for 2 epochs. Final validation loss was .72, with rouge-l of .66 .
9
+
10
+ Here is an inference example:
11
+
12
+ ```
13
+ from transformers import AutoModelForCausalLM, AutoTokenizer
14
+
15
+ model = AutoModelForCausalLM.from_pretrained("vikp/reverse_instruct")
16
+ tokenizer = AutoTokenizer.from_pretrained("vikp/reverse_instruct")
17
+
18
+ prompt = """
19
+ Output
20
+
21
+ int i,j; for (i=0;i<numbers.size();i++) for (j=i+1;j<numbers.size();j++) if (abs(numbers[i]-numbers[j])<threshold) return true; return false; }
22
+
23
+ ======
24
+ Instruction
25
+
26
+ """.strip()
27
+
28
+ inputs = tokenizer(prompt, return_tensors="pt")
29
+ outputs = model.generate(**inputs, max_new_tokens=512)
30
+ texts = tokenizer.batch_decode(outputs, skip_special_tokens=True)
31
+ print(texts)
32
+ ```
33
+
34
+ And the output instruction for the above example would be `Write a C++ program to find the closest pair of numbers in an array.`.