MCPcopy Index your code
hub / github.com/SparkJiao/SLQA

github.com/SparkJiao/SLQA @v2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0 ↗ · + Follow
62 symbols 246 edges 12 files 2 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SLQA

Multi-Granularity Hierarchical Attention Fusion Networks for Reading Comprehension and Question Answering

If anyone would love to test the performance on SQuAD, please tell me the final score. You just need to change the coca_reader.py to read in dataset of SQuAD.

Paper: http://www.aclweb.org/anthology/P18-1158
Allennlp:https://github.com/allenai/allennlp

Tutorial

First you should install allennlp and make sure you have downloaded the elmo and glove. You will find the version information in config/seperate_slqa.json. You could also use elmo by url, please turn to allennlp tutorials for help.
mkdir elmo
mkdir glove
Then for train, run:
allennlp train config/seperate_slqa.json -s output_dir --include-package coca-qa
To modified the parameters for the model, you can see config/seperate_slqa.json. I recommend you to learn how to use allennlp. It's very easy and useful.

update:

  • Rewrite the model using allennlp. It seems that it would run successfully. I'm waiting for the performance.
  • Add simple flow layer and the config file is slqa_h.json in package config.

update 12.6:

  • It seems that the performance is not good enough.

update 12.7:

  • The text_field_embedder receives a list of token embedders and concatenates their output in an arbitrary order. So if we use split we can't make sure the part with dimension of 1024 is the output of elmo_token_embedder. As a result, I split it as three seperate text_field_embedders.
  • The fuse function in the paper is wrote as the same one. But I think the fuse layers of passage, question and self-aligned passage representation use different weight and they should not share gradients. So I use three different fuse layers.
  • Change the self attention function from D = AA^T to D = AWA^T

update 12.9:

I think this version will be the final. Since I don't know how to reach the performance mentioned in paper where it's good than bidaf with self-attention and elmo. The final F1 score on CoQA is 61.879 where bidaf++ can reach 65. Besides, I didn't use any previous questions and answers. May be the performance with historical information is good enough but I have no time to test now.

TODO:

  • Try to have a better performance.
  • Add more manual features.
  • Test performance with previous information.
  • Test performance on SQuAD1.1.

Core symbols most depended-on inside this repo

get_front_blanks
called by 2
coca-qa/coca_reader.py
get_front_blanks
called by 2
coca-qa/clean_coqa_reader.py
_get_best_span_yesno_followup
called by 1
coca-qa/slqa.py
_get_best_span_yesno_followup
called by 1
coca-qa/seperate_slqa.py
_get_best_span_yesno_followup
called by 1
coca-qa/slqa_h.py
make_reading_comprehension_instance_quac
called by 1
coca-qa/squad_reader.py
text_to_instance
called by 1
coca-qa/coca_reader.py
make_reading_comprehension_instance_quac
called by 1
coca-qa/coca_reader.py

Shape

Method 48
Class 14

Languages

Python100%

Modules by API surface

models/layers.py18 symbols
models/nn.py8 symbols
coca-qa/squad_reader.py6 symbols
coca-qa/slqa_h.py6 symbols
coca-qa/slqa.py6 symbols
coca-qa/seperate_slqa.py6 symbols
coca-qa/coca_reader.py6 symbols
coca-qa/clean_coqa_reader.py6 symbols

For agents

$ claude mcp add SLQA \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact