ManthanKulakarni
commited on
Commit
•
f87f3aa
1
Parent(s):
27376d1
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
## Model in Action 🚀
|
4 |
+
|
5 |
+
```python
|
6 |
+
from transformers import AutoModelWithLMHead, AutoTokenizer
|
7 |
+
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("ManthanKulakarni/Text2JQLBuilder_v2")
|
9 |
+
model = AutoModelWithLMHead.from_pretrained("ManthanKulakarni/Text2JQLBuilder_v2")
|
10 |
+
|
11 |
+
def gen_sentence(words, max_length=32):
|
12 |
+
input_text = words
|
13 |
+
features = tokenizer([input_text], return_tensors='pt')
|
14 |
+
|
15 |
+
output = model.generate(input_ids=features['input_ids'],
|
16 |
+
attention_mask=features['attention_mask'],
|
17 |
+
max_length=max_length)
|
18 |
+
|
19 |
+
return tokenizer.decode(output[0], skip_special_tokens=True)
|
20 |
+
|
21 |
+
words = "JQL: all story under project ACM"
|
22 |
+
|
23 |
+
gen_sentence(words)
|
24 |
+
|
25 |
+
# output: 'JQL: project = ACM'
|
26 |
+
```
|