carpedm20 / memn2n-tensorflow Goto Github PK
View Code? Open in Web Editor NEW"End-To-End Memory Networks" in Tensorflow
Home Page: http://arxiv.org/abs/1503.08895v4
License: MIT License
"End-To-End Memory Networks" in Tensorflow
Home Page: http://arxiv.org/abs/1503.08895v4
License: MIT License
In the code of this repo, context matrix of shape [batch_size, mem_size] is chosen randomly as below
m = random.randrange(self.mem_size, len(data)) target[b][data[m]] = 1 context[b] = data[m - self.mem_size:m]
My quesiton (I am sorry it is not actually an 'issue' but my personal quesion) is what approaches I can take to get better result rather than just random?
Any kind of material that is helpful is welcomed :)
I am a student of Yunnan University in China and learning the code ,could you help me get the 'past.builtins'? Thangks
envy@ub1404:/media/envy/data1t/os_prj/github/MemN2N-tensorflow$ PYTHONPATH=~/os_prj/github/tensorflow/_python_build python main.py --nhop 6 --mem_size 100
Read 929589 words from data/ptb.train.txt
Read 73760 words from data/ptb.valid.txt
Read 82430 words from data/ptb.test.txt
{'batch_size': 128,
'checkpoint_dir': 'checkpoints',
'data_dir': 'data',
'data_name': 'ptb',
'edim': 150,
'init_hid': 0.1,
'init_lr': 0.01,
'init_std': 0.05,
'is_test': False,
'lindim': 75,
'max_grad_norm': 50,
'mem_size': 100,
'nepoch': 100,
'nhop': 6,
'nwords': 10000,
'show': False}
Traceback (most recent call last):
File "main.py", line 52, in
tf.app.run()
File "/home/envy/os_pri/github/tensorflow/_python_build/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "main.py", line 43, in main
model = MemN2N(FLAGS, sess)
File "/media/envy/data1t/os_prj/github/MemN2N-tensorflow/model.py", line 26, in init
raise Exception(" [!] Directory %s not found" % self.checkpoint_dir)
Exception: [!] Directory checkpoints not found
envy@ub1404:/media/envy/data1t/os_prj/github/MemN2N-tensorflow$
Can you pls add a requirements.txt ?
I found your code measuring norms and clipping gradients for each parameter separately. But in the paper, the authors said "the l2 norm of the whole gradient of all parameters..." and your method was used in QA tasks.
(tensorflow09GPU)➜ MemN2N-tensorflow git:(master) python main.py --nhop 6 --mem_size 100
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Read 929589 words from data/ptb.train.txt
Read 73760 words from data/ptb.valid.txt
Read 82430 words from data/ptb.test.txt
{'batch_size': 128,
'checkpoint_dir': 'checkpoints',
'data_dir': 'data',
'data_name': 'ptb',
'edim': 150,
'init_hid': 0.1,
'init_lr': 0.01,
'init_std': 0.05,
'is_test': False,
'lindim': 75,
'max_grad_norm': 50,
'mem_size': 100,
'nepoch': 100,
'nhop': 6,
'nwords': 10000,
'show': False}
[1] 9730 segmentation fault (core dumped) python main.py --nhop 6 --mem_size 100
how to solve this?
Hi, thanks for the code.
I'm getting the following error when running main
Traceback (most recent call last):
File "main.py", line 52, in <module>
tf.app.run()
File "/home/eders/anaconda/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
Traceback (most recent call last):
File "main.py", line 52, in <module>
tf.app.run()
File "/home/eders/anaconda/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "main.py", line 43, in main
model = MemN2N(FLAGS, sess)
File "/home/eders/python/MemN2N-tensorflow/model.py", line 26, in __init__
raise Exception(" [!] Directory %s not found" % self.checkpoint_dir)
Exception: [!] Directory checkpoints not found
I tried to use --data_dir but that didn't work either.
Hello @carpedm20 , thanks for this project, it is helping me get better insight into the paper :)
Quick question: during re-implementation of the code, I am getting the following error:
Aout = tf.matmul(self.hid3dim, Ain, adjoint_b=True) TypeError: matmul() got an unexpected keyword argument 'adjoint_b'
Any idea what the cause could be?
Thanks a ton :)
ptb
data is not the QA task, so it makes me confused.
Thank you @carpedm20
Hi,
Thanks for the code. I notice that in the original code, the weights of C are shared, as in https://github.com/facebook/MemNN/blob/946c4784b59dcf053bbbbb9637d6814bc152c276/MemN2N-lang-model/model.lua#L67-L74
However, I cannot find the weight sharing part in this code. Did I miss something? Thank you.
I don't know how to use this model.
I need a code to answer questions.
ex)
context{ Sam walks into the kitchen
Sam picks up an apple
Sam walks into the bedroom
Sam drops the apple
}
Q: Where is the apple?
A: Bedroom
please exam code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.