-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimum risk training #2
Comments
starting to work on this, very slowly though.. |
@jindrahelcl: What do you mean by “beamsearch is already done”? |
@tomasmcz that's what @jlibovicky says. Anyway, the implementation of beamsearch could be used for sampling the sentences for estimating the risk. |
In that case, beamsearch is done, but it is an ugly hack and I'm not sure it's working correctly right now (see #5). |
Hello team, I start working on the min risk training as an university project. I'll let you know about my progress here. Best regards: |
Hi, what is the easiest way in the decoder to access the words from the vocabulary while training given the IDs? And actually I need them postproccessed since I want to build a whole sentence from the samples, that I'll compute BLEU score on. Thank you and best regards: |
Hi, the decoder has a vocabulary as a property, so you can access it and words for indices. However, I don't think you should do this in decoder. Decoder is a description of the model part used for decoding, the actual work is done in runners and trainers. In this case, you probably should create a new trainer for minimum risk training and do the sentence handling there. You have more options how you can score the sentences
|
Hi, thank you! I was thinking of a mrt_loss as a function in the decoder directly, like the tf...sequence_loss you use for xent. I see your point on not doing it this way. Creating a new trainer should means to create a class similar to the cross_entropy_trainer, where first a runner is called to obtain the sentences. The runner should do the same like the GreedyRunExecutable, but with a decoder that samples from the runtime_logprobs it obtained and I'll also add a fetche for mrt_loss. Don't sure how to get the real sentences out of the runner though. After that I thought I can use the neuralmonkey.evaluators.bleu.BLEUEvaluator to obtain the score. The rest of the computations needed for a MRT will be done in a function like xent_objective that returns Objective object. That means also, that I have to overwrite add a runner to the Objective. What do you think? Sorry, I'm confused with the whole classes. Best, |
You're basically right. Your trainer needs to have an executable that will first do the inference including the postprocessing and evaluation. At this point, however, the executable will not yield any result. It the next step it will finally prepare the the fetch that will compute the MRT loss and an additional feed dict for a placeholder with BLEU. The additional parts of the computational graph (including the BLEU placeholder) should be defined in the trainer's constructor. You should be also careful with the evaluators. |
I have now a runner that can do the postprocressing and gleu and also gives me the prob of the sentences, did it only to test how the parts will work. I'll try to transffer what I've done there into a trainer. Is there an easy way like running this runner in the new trainer first (), taking the outputs of the runner and computing a MRT loss and then adding the loss to Objective? |
What do you exactly mean with "It the next step it will finally prepare the the fetch that will compute the MRT loss and an additional feed dict for a placeholder with BLEU"? |
Every instance of runner or trainer can five you an instance of You can probably inherit your trainer from If you have your code in a fork on GitHub, I can eventually have a look at the code, if you want. |
Thank you! It works now, except that I couldn't find out how to feed the score to the placeholder, since the session execution happens somewhere else. Do you have any suggestions on how to do it? |
Hi,
as long as the runner sets its result, the tf_manager will keep calling its
next_to_execute method and run the session again with the provided
executable. Look at the code in tf_manager, I think this property can be
used for this..
Best,
Jindra
Dne 16. 4. 2017 12:15 napsal uživatel "StoyanVenDimitrov" <
[email protected]>:
Thank you! It works now, except that I couldn't find out how to feed the
score to the placeholder, since the session execution happens somewhere
else. Do you have any suggestions on how to do it?
Best,
Stoyan
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABwcs5Kew8WmOllNmDePqlxU52ytpbaVks5rwepZgaJpZM4I6qKv>
.
|
Hi, Best, |
fixed initialization of next_w
Implement minimum risk trainer as described in http://arxiv.org/abs/1512.02433.
The text was updated successfully, but these errors were encountered: