{"id":26156875,"url":"https://github.com/parshakova/apsn","last_synced_at":"2026-04-20T14:03:18.830Z","repository":{"id":95746066,"uuid":"139707105","full_name":"parshakova/apsn","owner":"parshakova","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-06T07:01:29.000Z","size":1283,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-07T03:38:42.653Z","etag":null,"topics":["latent-variable-models","policy-gradient","pytorch","question-answering","semi-supervised-learning","vae"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parshakova.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-04T10:29:09.000Z","updated_at":"2018-10-15T04:32:42.000Z","dependencies_parsed_at":"2023-04-22T17:30:44.386Z","dependency_job_id":null,"html_url":"https://github.com/parshakova/apsn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/parshakova/apsn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parshakova%2Fapsn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parshakova%2Fapsn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parshakova%2Fapsn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parshakova%2Fapsn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parshakova","download_url":"https://codeload.github.com/parshakova/apsn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parshakova%2Fapsn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32050451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["latent-variable-models","policy-gradient","pytorch","question-answering","semi-supervised-learning","vae"],"created_at":"2025-03-11T09:33:08.200Z","updated_at":"2026-04-20T14:03:18.795Z","avatar_url":"https://github.com/parshakova.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## APSN\nLatent Question Interpretation Through Parameter Adaptation Using Stochastic Neuron \n\nIn this work we propose a training framework and the APSN module for learning question interpretations that help\nto find various valid answers within the same document. \n\u003cp align=\"center\"\u003e\n\u003cimg width=690 src=\"imgs/apsn.jpg\"\u003e\u003cbr\u003e\n\u003ci\u003e\u003csub\u003eStructure overview of integrated APSN module with DrQA. In this illustration number of interpretations is 2 and a sampled interpretation is 1.\u003c/sub\u003e\u003c/i\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n|| \u003csub\u003eSample answers (`Model`) produced by inducing the value of a latent interpretation given `D, Q`\u003c/sub\u003e|\n| --- | --- |\n| `D` | \u003csub\u003eITV Tyne Tees was based at City Road for over 40 years after its launch in January 1959.\u003cbr\u003eIn 2005 it moved to a new facility on The Watermark business park next to the MetroCentre in Gateshead.\u003c/sub\u003e|\n| `Q` | \u003csub\u003eWhere did ITV Tyne Tees move in 2005?\u003c/sub\u003e|\n| `A` | \u003csub\u003e[’a new facility’]\u003c/sub\u003e |\n| `Model` | \u003csub\u003e['The Watermark business park', 'Gateshead']\u003c/sub\u003e |\n|||\n| `D` | \u003csub\u003eResearch shows that student motivation and attitudes towards school are closely linked to student-teacher\u003cbr\u003e relationships. Enthusiastic teachers are particularly good at creating beneficial relations with their students.\u003c/sub\u003e|\n| `Q` | \u003csub\u003eWhat type of relationships do enthusiastic teachers cause?\u003c/sub\u003e|\n| `A` | \u003csub\u003e[’beneficial’]\u003c/sub\u003e |\n| `Model` | \u003csub\u003e['student-teacher', 'beneficial relations']\u003c/sub\u003e |\n|||\n| `D` | \u003csub\u003eFor Luther, also Christ’s life, when understood as an example, is nothing more than an illustration\u003cbr\u003eof the Ten Commandments, which a Christian should follow in his or her vocations on a daily basis.\u003c/sub\u003e|\n| `Q` | \u003csub\u003eWhat should a Christian follow in his life?\u003c/sub\u003e|\n| `A` | \u003csub\u003e[’Ten Commandments’]\u003c/sub\u003e |\n| `Model` | \u003csub\u003e['Ten Commandment', 'vocations on a daily basis']\u003c/sub\u003e |\n|||\n| `D` | \u003csub\u003eIt is believed that the civilization was later devastated by the spread of diseases from Europe,\u003cbr\u003esuch as smallpox.\u003c/sub\u003e|\n| `Q` | \u003csub\u003eWhat was believed to be the cause of devastation to the civilization?\u003c/sub\u003e|\n| `A` | \u003csub\u003e[’spread of diseases from Europe’]\u003c/sub\u003e |\n| `Model` | \u003csub\u003e['smallpox', 'spread of diseases from Europe']\u003c/sub\u003e |\n\nTested on GeForce GTX Titan X.\n\n## Setup\n**GPU and CUDA 8 are required**\n\n#### Install\n \n - Python \u003e= 3.5 \n - [PyTorch](http://pytorch.org/)\n - CuPy, pynvrtc\n - Spacy 1.10.1\n - Cython, Pandas, NumPy, Scikit-learn\n - msgpack, tensorboardX, Matplotlib\n \n #### Download \n \n - the [SQuAD](https://rajpurkar.github.io/SQuAD-explorer/)\n - GloVe word vectors \n - [Sent2vec](https://github.com/epfml/sent2vec) with wiki_bigram.bin \n - Use checkpoint [`init1`](https://drive.google.com/open?id=1pom0i15ztFmC9wie1odjizs_ER00yzzF) to initialize models for training\n \n using `bash download.sh`\n \n #### Preprocess Dataset\n ```bash\n# prepare the data\npython prepro.py\n\n# prepare semi-supervised labels for question-answer pairs\npython semisup_labels.py\n\n# make sure CUDA lib path can be found, e.g.:\nexport LD_LIBRARY_PATH=/usr/local/cuda/lib64\n```\n\n## Running Code\n ```bash\n# training in semi-supervised VAE framework\npython train.py -e 240 -bs 50 -rd init1 -rs best_model.pt -lr  0.0005 --pi_q_rnn pi_d_nqd --control_d sru_00_kconv5_gram_s_cos --critic_loss --n_actions 5 --vae --semisup --rl_start 80 --rl_tuning pg\n\n# sample answers with induced values for interpretations\npython interpret.py -bs 32 -rd m1_80.9 -rs best_model.pt --pi_q_rnn pi_d_nqd --control_d sru_00_kconv5_gram_s_cos --n_actions 5 --vae\n\n# visualize document encodings with interpretation-adapted parameters\npython tsne.py -bs 1 -rd m1_80.9 -rs best_model.pt --pi_q_rnn pi_d_nqd --control_d sru_00_kconv5_gram_s_cos --n_actions 5 --vae\n ```\n \u003cp align=\"center\"\u003e\n\u003cimg width=700 src=\"imgs/tsne.png\"\u003e\u003cbr\u003e\n\u003ci\u003e\u003csub\u003eIndices represent different documents, colors correspond to induced interpretations (interpretation marked with cross was chosen by the policy during testing)\u003c/sub\u003e\u003c/i\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n## Credits\nAuthor of the Document Reader model: [@danqi](https://github.com/danqi)\n\nPytorch implementation of DrQA with SRU cells [@taolei87](https://github.com/taolei87/sru/tree/master/DrQA)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparshakova%2Fapsn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparshakova%2Fapsn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparshakova%2Fapsn/lists"}