mjc92 / gettothepoint Goto Github PK
View Code? Open in Web Editor NEWPytorch implementation of "Get to the point: Get To The Point: Summarization with Pointer-Generator Networks"
Pytorch implementation of "Get to the point: Get To The Point: Summarization with Pointer-Generator Networks"
Hi,
Thanks for the pytorch implementation. I just wanted to know how do I go about running this?
Considering that the numpy arrays are already saved, I just want to know what are the steps that have to be done next?
You are using softmax + NLLLoss
You should either use log_softmax + NLLLoss or softmax + CrossEntropyLoss
https://discuss.pytorch.org/t/is-log-softmax-nllloss-crossentropyloss/9352
code :
while (epoch < args.epochs):
epoch += 1
random.shuffle(file_list)
print("length of file list is:",len(file_list))
for file in file_list:
opt.zero_grad()
with open(os.path.join(args.data_dir, file)) as f:
minibatch = f.read()
stories, summaries = batch.process_minibatch(minibatch, vocab)
out_list, cov_loss = model(stories, summaries, batch, vocab, True)
target = num_to_var(summaries[:, 2]).reshape(-1, 1)
target = pack(target, batch.output_lens.tolist(), batch_first=True)[0]
pad_out = pack(out_list, batch.output_lens.tolist(), batch_first=True)[0]
pad_out = torch.log(pad_out)
print("pad_out and target shapes:",pad_out.shape,target.shape)
loss = criterion(pad_out, target) + cov_loss
print('loss:',loss)
loss.backward()
opt.step()
beam search was not implemented in the code so i took one of the possible output just to train it.
forward pass it working and loss is calculating then during loss.backward() it shows the below error.
Traceback (most recent call last):
File "/home/m9506574/Downloads/GetToThePoint-master/shubh3_train.py", line 142, in
loss.backward()
File "/home/m9506574/anaconda3/envs/my_env/lib/python3.6/site-packages/torch/tensor.py", line 102, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/m9506574/anaconda3/envs/my_env/lib/python3.6/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: select(): index 1 out of range for tensor of size [1, 100, 50020] at dimension 0
-> pack padded sequence i think it needs to be done before passing into the model and after getting the output from the model we have to do pad padded sequence. can someone explain it to me that why they are not doing pack padded sequence before passing it into the model and pad padded sequence was not implemented.
the copydecoder not exists in the project
Line 173 in e59c06d
Why it's multiplied by attn_mask instead of mask?
Hi,
Thanks for your work on implementing this model in PyTorch. Just wanted to know if this implementation managed to reproduce the results mentioned in the paper?
when I use the package spacy to split words, I find the result has lot of error. maybe it will affect the final result.
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.