Upload folder using huggingface_hub
Browse files- README.md +64 -0
- config.json +31 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +19 -0
- training_info.json +15 -0
README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model: deepset/roberta-base-squad2
|
| 6 |
+
datasets:
|
| 7 |
+
- rajpurkar/squad_v2
|
| 8 |
+
pipeline_tag: question-answering
|
| 9 |
+
tags:
|
| 10 |
+
- extractive-qa
|
| 11 |
+
- squad2
|
| 12 |
+
- memory
|
| 13 |
+
- recallic
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Recallic reader (case-augmented roberta-base-squad2)
|
| 17 |
+
|
| 18 |
+
The extractive question-answering model that [Recallic](https://github.com/Recallic/Recallic) uses to read recalled
|
| 19 |
+
memories, find the answer span, and decline when no memory answers the question.
|
| 20 |
+
|
| 21 |
+
It is [deepset/roberta-base-squad2](https://huggingface.co/deepset/roberta-base-squad2) trained for one more pass
|
| 22 |
+
on SQuAD 2.0 data shaped like chat messages:
|
| 23 |
+
|
| 24 |
+
* 40,000 SQuAD 2.0 training examples and 39,975 lowercased copies;
|
| 25 |
+
* 30,001 sentence-level examples: the single sentence that holds the answer (answerable), and another sentence of
|
| 26 |
+
the same paragraph that does not (unanswerable, same topic), plus 29,995 lowercased copies.
|
| 27 |
+
|
| 28 |
+
People text an assistant in short, often lowercase messages; the base model was trained on edited Wikipedia
|
| 29 |
+
paragraphs. One epoch, learning rate 1e-5, batch 16, on a Kaggle T4 (42 minutes). Training script:
|
| 30 |
+
[training/reader/train_case_aug.py](https://github.com/Recallic/Recallic/tree/main/training/reader).
|
| 31 |
+
|
| 32 |
+
## Results (Recallic end to end, decline threshold -2.721 on the null-answer margin)
|
| 33 |
+
|
| 34 |
+
Against the base model in the same system and threshold:
|
| 35 |
+
|
| 36 |
+
| | base model | this model |
|
| 37 |
+
|---|---|---|
|
| 38 |
+
| LoCoMo test, trick questions declined | 66 / 209 | **121 / 209** |
|
| 39 |
+
| LoCoMo test, real questions declined | 70 / 778 | 114 / 778 |
|
| 40 |
+
| LoCoMo test, answer token F1 | 0.3449 | **0.3567** |
|
| 41 |
+
| Fact-update scenarios (120, texting style), correct / wrong | 76 / 8 | **92** / 9 |
|
| 42 |
+
|
| 43 |
+
It answers fewer trick questions and gives better answers, at the cost of declining more real questions. All
|
| 44 |
+
figures and how they were produced: `eval/results/reader_case_aug_v2/` in the Recallic repository.
|
| 45 |
+
|
| 46 |
+
## Use
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import pipeline
|
| 50 |
+
qa = pipeline("question-answering", model="Recallic/recallic-reader")
|
| 51 |
+
qa(question="where do i work now?", context="moved to infosys last month, left tcs finally",
|
| 52 |
+
handle_impossible_answer=True)
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## Limitations
|
| 56 |
+
|
| 57 |
+
Trained on English Wikipedia question answering only. Within Recallic it can still pick a value about someone else
|
| 58 |
+
when the message says whose it is only implicitly (an extra wrong answer of this kind appeared on the fact-update
|
| 59 |
+
scenarios). Thresholds should be checked on the deployment's own data.
|
| 60 |
+
|
| 61 |
+
## Licence and attribution
|
| 62 |
+
|
| 63 |
+
CC BY 4.0, as the base model. Base model by deepset (CC BY 4.0); training data from SQuAD 2.0 by Rajpurkar et al.
|
| 64 |
+
(CC BY-SA 4.0).
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"RobertaForQuestionAnswering"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_dropout_prob": 0.1,
|
| 14 |
+
"hidden_size": 768,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 3072,
|
| 17 |
+
"is_decoder": false,
|
| 18 |
+
"language": "english",
|
| 19 |
+
"layer_norm_eps": 1e-05,
|
| 20 |
+
"max_position_embeddings": 514,
|
| 21 |
+
"model_type": "roberta",
|
| 22 |
+
"name": "Roberta",
|
| 23 |
+
"num_attention_heads": 12,
|
| 24 |
+
"num_hidden_layers": 12,
|
| 25 |
+
"pad_token_id": 1,
|
| 26 |
+
"tie_word_embeddings": true,
|
| 27 |
+
"transformers_version": "5.24.1",
|
| 28 |
+
"type_vocab_size": 1,
|
| 29 |
+
"use_cache": true,
|
| 30 |
+
"vocab_size": 50265
|
| 31 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ca3f7e17966db913a7b7fcb457f6b8dbc0b738169f0d8f16faa251b78490321e
|
| 3 |
+
size 496250232
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"cls_token": "<s>",
|
| 6 |
+
"do_lower_case": false,
|
| 7 |
+
"eos_token": "</s>",
|
| 8 |
+
"errors": "replace",
|
| 9 |
+
"full_tokenizer_file": null,
|
| 10 |
+
"is_local": false,
|
| 11 |
+
"local_files_only": false,
|
| 12 |
+
"mask_token": "<mask>",
|
| 13 |
+
"model_max_length": 512,
|
| 14 |
+
"pad_token": "<pad>",
|
| 15 |
+
"sep_token": "</s>",
|
| 16 |
+
"tokenizer_class": "RobertaTokenizer",
|
| 17 |
+
"trim_offsets": true,
|
| 18 |
+
"unk_token": "<unk>"
|
| 19 |
+
}
|
training_info.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base": "deepset/roberta-base-squad2",
|
| 3 |
+
"n_original": 40000,
|
| 4 |
+
"n_lowercased": 39975,
|
| 5 |
+
"n_sentence": 30001,
|
| 6 |
+
"n_sentence_lowercased": 29995,
|
| 7 |
+
"windows": 141062,
|
| 8 |
+
"steps": 8817,
|
| 9 |
+
"lr": 1e-05,
|
| 10 |
+
"batch": 16,
|
| 11 |
+
"epochs": 1.0,
|
| 12 |
+
"seed": 13,
|
| 13 |
+
"device": "cuda",
|
| 14 |
+
"minutes": 42.0
|
| 15 |
+
}
|