Add a model trained on wikidata, freebase and dbpedia
Browse files- README.md +40 -0
- config.json +1 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +15 -0
- tokenizer.json +0 -0
- tokenizer_config.json +16 -0
- vocab.json +0 -0
README.md
CHANGED
@@ -1,3 +1,43 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
|
5 |
+
# SRTK Scorer
|
6 |
+
|
7 |
+
This model is a trained scorer for [SRTK](https://github.com/happen2me/subgraph-retrieval-toolkit). It is used to compare the similarity between a query and the expansion path at the time of subgraph retrieval.
|
8 |
+
|
9 |
+
## Training Information
|
10 |
+
|
11 |
+
It is initialized with `roberta-base`. It is trained jointly on the following datasets:
|
12 |
+
|
13 |
+
- [WebQSP for Freebase](https://www.microsoft.com/en-us/download/details.aspx?id=52763)
|
14 |
+
- [SimpleQuestionsWikidata for Wikidata](https://github.com/askplatypus/wikidata-simplequestions)
|
15 |
+
- [SimpleDBpediaQA](https://github.com/castorini/SimpleDBpediaQA)
|
16 |
+
|
17 |
+
It achieves a coverage rate of 0.9728 on SimpleQuestionsWikidata (depth 1) 0.8501 on WebQSP test set (depth 2) with a beam width of only 2!
|
18 |
+
|
19 |
+
## Usage Example
|
20 |
+
|
21 |
+
First install the package:
|
22 |
+
|
23 |
+
```bash
|
24 |
+
pip install srtk
|
25 |
+
```
|
26 |
+
|
27 |
+
Then you can retrieve subgraphs with the help of this scorer:
|
28 |
+
|
29 |
+
```bash
|
30 |
+
srtk retrieve -i data/wikidata-simplequestions/intermediate/scores_test.jsonl \
|
31 |
+
-o artifacts/subgraphs/wikidata-simple-contrast \
|
32 |
+
-e http://localhost:1234/api/endpoint/sparql \
|
33 |
+
--scorer-model-path drt/srtk-scorer \
|
34 |
+
--scorer --beam-width 2 --max-depth 1 --evaluate
|
35 |
+
```
|
36 |
+
|
37 |
+
## Limitations
|
38 |
+
|
39 |
+
As both SimpleQuestionsWikidata and SimpleDBpediaQA contain only one-hop relations, the model tends to stop at one-hop when you retrieve subgraphs on Wikidata and DBpedia. We will release a updated version of the model that is trained on a more diverse dataset in the future.
|
40 |
+
|
41 |
+
## License
|
42 |
+
|
43 |
+
MIT
|
config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"return_dict": true, "output_hidden_states": false, "output_attentions": false, "torchscript": false, "torch_dtype": null, "use_bfloat16": false, "tf_legacy_loss": false, "pruned_heads": {}, "tie_word_embeddings": true, "is_encoder_decoder": false, "is_decoder": false, "cross_attention_hidden_size": null, "add_cross_attention": false, "tie_encoder_decoder": false, "max_length": 20, "min_length": 0, "do_sample": false, "early_stopping": false, "num_beams": 1, "num_beam_groups": 1, "diversity_penalty": 0.0, "temperature": 1.0, "top_k": 50, "top_p": 1.0, "typical_p": 1.0, "repetition_penalty": 1.0, "length_penalty": 1.0, "no_repeat_ngram_size": 0, "encoder_no_repeat_ngram_size": 0, "bad_words_ids": null, "num_return_sequences": 1, "chunk_size_feed_forward": 0, "output_scores": false, "return_dict_in_generate": false, "forced_bos_token_id": null, "forced_eos_token_id": null, "remove_invalid_values": false, "exponential_decay_length_penalty": null, "suppress_tokens": null, "begin_suppress_tokens": null, "architectures": ["RobertaForMaskedLM"], "finetuning_task": null, "id2label": {"0": "LABEL_0", "1": "LABEL_1"}, "label2id": {"LABEL_0": 0, "LABEL_1": 1}, "tokenizer_class": null, "prefix": null, "bos_token_id": 0, "pad_token_id": 1, "eos_token_id": 2, "sep_token_id": null, "decoder_start_token_id": null, "task_specific_params": null, "problem_type": null, "_name_or_path": "roberta-base", "transformers_version": "4.26.0", "model_type": "roberta", "vocab_size": 50265, "hidden_size": 768, "num_hidden_layers": 12, "num_attention_heads": 12, "hidden_act": "gelu", "intermediate_size": 3072, "hidden_dropout_prob": 0.1, "attention_probs_dropout_prob": 0.1, "max_position_embeddings": 514, "type_vocab_size": 1, "initializer_range": 0.02, "layer_norm_eps": 1e-05, "position_embedding_type": "absolute", "use_cache": true, "classifier_dropout": null}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:47efaf4afa2de3c4466e4dd6f890b310a6bcd0cb8446905bf16769a703b86a34
|
3 |
+
size 498662001
|
special_tokens_map.json
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"cls_token": "<s>",
|
4 |
+
"eos_token": "</s>",
|
5 |
+
"mask_token": {
|
6 |
+
"content": "<mask>",
|
7 |
+
"lstrip": true,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"pad_token": "<pad>",
|
13 |
+
"sep_token": "</s>",
|
14 |
+
"unk_token": "<unk>"
|
15 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"bos_token": "<s>",
|
4 |
+
"cls_token": "<s>",
|
5 |
+
"eos_token": "</s>",
|
6 |
+
"errors": "replace",
|
7 |
+
"mask_token": "<mask>",
|
8 |
+
"model_max_length": 512,
|
9 |
+
"name_or_path": "roberta-base",
|
10 |
+
"pad_token": "<pad>",
|
11 |
+
"sep_token": "</s>",
|
12 |
+
"special_tokens_map_file": null,
|
13 |
+
"tokenizer_class": "RobertaTokenizer",
|
14 |
+
"trim_offsets": true,
|
15 |
+
"unk_token": "<unk>"
|
16 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|