xinnuoxu / mmi_anti_pytorch Goto Github PK
View Code? Open in Web Editor NEWA pytorch implementation for the MMI-anti model
A pytorch implementation for the MMI-anti model
handsome boy, excuse me!
when I have been studing chatbot, I have a question that I don't understand . because of I thank you are enthusiastic,so I want to ask you for this question as follow:
eng_vocab_size = len(eng_tokenizer.word_index) + 1
this code means vocabulary size equals the length of word-index adding 1, I dont't understand why it need to add 1. I think it is necessary to add 1. please you help me , thank you !
Traceback (most recent call last):
File "translate.py", line 157, in
main()
File "translate.py", line 119, in main
batch_data = translator.translate_batch(batch, data)
File "/home/thea/cikm/mmi_anti_pytorch/onmt/translate/Translator.py", line 205, in translate_batch
ret = self._from_beam(beam)
File "/home/thea/cikm/mmi_anti_pytorch/onmt/translate/Translator.py", line 234, in _from_beam
best_scores, best_scores_id = self.tt.FloatTensor(b.ended_sentences_scores).topk(n_best, 0, True, True)
RuntimeError: invalid argument 3: dim not in range at /pytorch/aten/src/TH/generic/THTensorMath.c:3436
Hi XinnouXu, I caught an error in training 'python translate.py -model modelname' and really need some help here.
Thanks in advance!
Which version of pytorch and torchtext do you use ?
I got the following message when trying to perform translate.py.
(I use pytorch 0.3.0 and torchtext 0.2.1. )
TypeError: torch.index_select received an invalid combination of arguments - got (torch.cuda.FloatTensor, int, torch.LongTensor), but expected (torch.cuda.FloatTensor source, int dim, torch.cuda.LongTensor index)
I just see two losscompute in train.py
`def make_loss_compute(model, tgt_vocab, opt):
if opt.copy_attn:
compute = onmt.modules.CopyGeneratorLossCompute(
model.generator, tgt_vocab, opt.copy_attn_force)
else:
compute = onmt.Loss.NMTLossCompute(
model.generator, tgt_vocab,
label_smoothing=opt.label_smoothing)
if use_gpu(opt):
compute.cuda()
return compute`
I use pytorch-cpu 1.0.1, torchtext0.3.1, I am new for pytorch. How can i solve this problem?
`Traceback (most recent call last):
File "/home/yangjingying/PycharmProjects/mmi_anti_pytorch-master/train.py", line 403, in
Loading train dataset from data/dialogue.train.1.pt, number of examples: 100
main()
File "/home/yangjingying/PycharmProjects/mmi_anti_pytorch-master/train.py", line 385, in main
fields = load_fields(first_dataset, data_type, checkpoint)
File "/home/yangjingying/PycharmProjects/mmi_anti_pytorch-master/train.py", line 306, in load_fields
torch.load(opt.data + '.vocab.pt'), data_type)
File "/home/yangjingying/PycharmProjects/mmi_anti_pytorch-master/onmt/io/IO.py", line 57, in load_fields_from_vocab
fields = get_fields(data_type, n_src_features, n_tgt_features)
File "/home/yangjingying/PycharmProjects/mmi_anti_pytorch-master/onmt/io/IO.py", line 43, in get_fields
return TextDataset.get_fields(n_src_features, n_tgt_features)
File "/home/yangjingying/PycharmProjects/mmi_anti_pytorch-master/onmt/io/TextDataset.py", line 210, in get_fields
postprocessing=make_src, sequential=False)
TypeError: init() got an unexpected keyword argument 'tensor_type'
`
I can't find the model.pt.
There are many problems for indentation for the file Translator.py . Please fix it.
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.