razent commited on
Commit
e088da8
1 Parent(s): 8ea7d53

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -0
README.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPBERT MLM (Scratch)
2
+
3
+ ## Introduction
4
+ Paper: [SPBERT: An Efficient Pre-training BERT on SPARQL Queries for Question Answering over Knowledge Graphs](https://arxiv.org/abs/2106.09997)
5
+
6
+ Authors: _Hieu Tran, Long Phan, James Anibal, Binh T. Nguyen, Truong-Son Nguyen_
7
+
8
+ ## How to use
9
+ For more details, do check out [our Github repo](https://github.com/heraclex12/NLP2SPARQL).
10
+
11
+ Here is an example in Pytorch:
12
+ ```python
13
+ from transformers import AutoTokenizer, AutoModel
14
+ tokenizer = AutoTokenizer.from_pretrained('razent/spbert-mlm-zero')
15
+ model = AutoModel.from_pretrained("razent/spbert-mlm-zero")
16
+ text = "select * where brack_open var_a var_b var_c sep_dot brack_close"
17
+ encoded_input = tokenizer(text, return_tensors='pt')
18
+ output = model(**encoded_input)
19
+ ```
20
+ or Tensorflow
21
+ ```python
22
+ from transformers import AutoTokenizer, TFAutoModel
23
+ tokenizer = AutoTokenizer.from_pretrained('razent/spbert-mlm-zero')
24
+ model = TFAutoModel.from_pretrained("razent/spbert-mlm-zero")
25
+ text = "select * where brack_open var_a var_b var_c sep_dot brack_close"
26
+ encoded_input = tokenizer(text, return_tensors='tf')
27
+ output = model(encoded_input)
28
+ ```
29
+
30
+ ## Citation
31
+ ```
32
+ @misc{tran2021spbert,
33
+ title={SPBERT: An Efficient Pre-training BERT on SPARQL Queries for Question Answering over Knowledge Graphs},
34
+ author={Hieu Tran and Long Phan and James Anibal and Binh T. Nguyen and Truong-Son Nguyen},
35
+ year={2021},
36
+ eprint={2106.09997},
37
+ archivePrefix={arXiv},
38
+ primaryClass={cs.CL}
39
+ }
40
+ ```