Code Monkey home page Code Monkey logo

real4mwp's Introduction

Code for EMNLP 2021 Paper "Recall and Learn: A Memory-augmented Solver for Math Word Problems".

environment

python3.6, pytorch1.2
You can install related packages directly through "pip install requirements.txt" or
create virtual environment with required package by "conda env create -f REAL.yaml".

preprocess data

python3 memory_module.py

train:

 python3 run.py --is_train --train_batch_size 6 --num_train_epochs 80 \
    --start_lr_decay_epoch 40 --dataset math23k --topk 1 \
    --add_copynet --add_memory_module --is_equ_norm 

test:

python3 run.py --eval_batch_size 6  --dataset math23k --topk 1 \
    --add_copynet --add_memory_module --is_equ_norm 

parallel

The project supports multi GPU parallel by setting CUDA_VISIBLE_DEVICES.

result

We don't spend more energy on adjusting the parameters of the model. You can get better results through parameter adjustment.

top1 result:

topk result:

Although REAL is trained with only a retrieved question, we still have the flexibility to adjust the number of retrieved questions at the testing stage by modifying the value of topk, which can affect the model’s performance.

In addition, It's simple to train topk retrieved questions by modifying the value of topk at training stage, which can obtain better result, though it is not show in our paper.

Improve

Further, we improve the effectiveness of REAL model to solve math work problems(MWP) by optimizing the memory module.
More details please see our NIPS2021 Paper on MATHAI4ED Workshop: "REAL2: An End-to-end Memory-augmented Solver for Math Word Problems".

Citation

If the paper or the code helps you, please cite the paper in the following format :

@inproceedings{huang-etal-2021-recall-learn,
    title = "Recall and Learn: A Memory-augmented Solver for Math Word Problems",
    author = "Huang, Shifeng and Wang, Jiawei and Xu, Jiao and Cao, Da and Yang, Ming",
    booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2021",
    year = "2021"
    }

Acknowledgments

Our code is based on unilm . We thank the authors for their wonderful open-source efforts. We use the same license as unilm.

real4mwp's People

Contributors

sfeng-m avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.