laddie132 / match-lstm Goto Github PK
View Code? Open in Web Editor NEWA PyTorch implemention of Match-LSTM, R-NET and M-Reader for Machine Reading Comprehension
License: MIT License
A PyTorch implemention of Match-LSTM, R-NET and M-Reader for Machine Reading Comprehension
License: MIT License
在下面这段代码里,为了用Pointer网络计算从右至左的开始和结束概率,直接把Hr输入到另一个UniBoundaryPointer
,并把输出的“开始概率"和”结束概率“对调,这段我不太理解,能否解释一下?
Lines 583 to 587 in 793f0ec
Hr
似乎应该使用masked_flip
翻转后再输入吧?
是不是应该效仿MatchRNN
的处理方式,用masked_flip
处理Hr
后输入,得到beta
后再用masked_flip
翻回来?
I am trying to train the model (after pre-processing was done successfully) using
python run.py train.
I am using running Windows 10, Python 3.6.5, spaCy 2.0.0, pytorch 0.4.0
Unfortunately, I am receiving a run time error .
2019-05-02 18:47:45,082 - [train.py:22-train()] - INFO - ------------MODEL TRAIN--------------
2019-05-02 18:47:45,082 - [train.py:23-train()] - INFO - loading config file...
2019-05-02 18:47:45,082 - [train.py:37-train()] - INFO - reading squad dataset...
2019-05-02 18:47:49,647 - [train.py:40-train()] - INFO - constructing model...
2019-05-02 18:47:50,334 - [train.py:89-train()] - INFO - start training...
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/Match-LSTM/run.py", line 38, in
train(args.config_path)
File "C:\Users\Administrator\PycharmProjects\Match-LSTM\train.py", line 110, in train
device=device)
File "C:\Users\Administrator\PycharmProjects\Match-LSTM\train.py", line 162, in train_on_model
ans_range_prop, _, _ = model.forward(*batch_input)
File "C:\Users\Administrator\PycharmProjects\Match-LSTM\models\match_lstm_plus.py", line 119, in forward
context_encode, _ = self.encoder.forward(context_vec, context_mask)
File "C:\Users\Administrator\PycharmProjects\Match-LSTM\models\layers.py", line 716, in forward
o_pack_dropout, _ = self.hidden.forward(v_pack_dropout)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 178, in forward
self.check_forward_args(input, hx, batch_sizes)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 130, in check_forward_args
self.input_size, input.size(-1)))
RuntimeError: input.size(-1) must be equal to input_size. Expected 373, got 372
Process finished with exit code 1
Would appreciate any help regarding this.
Thanks!
I am getting this error while running pre-process, can you please check?
2018-08-02 18:50:57,367 - [preprocess_data.py:375-run()] - INFO - padding id vectors...
2018-08-02 18:51:21,268 - [preprocess_data.py:392-run()] - INFO - export to hdf5 file...
Traceback (most recent call last):
File "./run.py", line 35, in
preprocess(args.config_path)
File "./run.py", line 24, in preprocess
pdata.run()
File "/data/dchaudhu/Match-LSTM/dataset/preprocess_data.py", line 393, in run
self._export_squad_hdf5()
File "/data/dchaudhu/Match-LSTM/dataset/preprocess_data.py", line 344, in _export_squad_hdf5
**self._compress_option)
File "/data/dchaudhu/anaconda3/envs/py36/lib/python3.6/site-packages/h5py/_hl/group.py", line 116, in create_dataset
dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
File "/data/dchaudhu/anaconda3/envs/py36/lib/python3.6/site-packages/h5py/_hl/dataset.py", line 100, in make_new_dset
tid = h5t.py_create(dtype, logical=1)
File "h5py/h5t.pyx", line 1611, in h5py.h5t.py_create
File "h5py/h5t.pyx", line 1633, in h5py.h5t.py_create
File "h5py/h5t.pyx", line 1688, in h5py.h5t.py_create
TypeError: Object dtype dtype('O') has no native HDF5 equivalent
Regards,
Debanjan
when i run "python helper_run/preprocess.py" to save squad_glove.h5,
i get:
Error! /workspace/matchLSTM-pytorch/data/squad_glove.h5 is not UTF-8 encoded
Saving disabled.
`Traceback (most recent call last):
File "run.py", line 35, in
preprocess(args.config_path)
File "run.py", line 24, in preprocess
pdata.run()
File "E:\coms\challenger\资料\codes\Match-LSTM-master\Match-LSTM-master\dataset\preprocess_data.py", line 392, in run
self._export_squad_hdf5()
File "E:\coms\challenger\资料\codes\Match-LSTM-master\Match-LSTM-master\dataset\preprocess_data.py", line 343, in _export_squad_hdf5
**self._compress_option)
File "C:\Users\l\Anaconda3\lib\site-packages\h5py_hl\group.py", line 106, in create_dataset
dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
File "C:\Users\l\Anaconda3\lib\site-packages\h5py_hl\dataset.py", line 100, in make_new_dset
tid = h5t.py_create(dtype, logical=1)
File "h5py\h5t.pyx", line 1519, in h5py.h5t.py_create
File "h5py\h5t.pyx", line 1541, in h5py.h5t.py_create
File "h5py\h5t.pyx", line 1596, in h5py.h5t.py_create
TypeError: Object dtype dtype('O') has no native HDF5 equivalent'
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.