-
Notifications
You must be signed in to change notification settings - Fork 152
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
[Question] Actual usage examples? #29
Comments
Hi, Your usage seems alright. The examples are meant to show how to use the CRF layer given that one has produced the emission scores, i.e. (unnormalized) log P(y_t | X) where y_t is the tag at position t and X is the input sentence. In your code, |
Thanks for your response. What was confusing to me originally was the fact that your CRF layer is actually a loss that one can minimize, whereas other PyTorch implementations had a separately-defined Viterbi loss module. Yes, dimensions that you mentioned coincide with what I have in my code. |
Actually, this is something that I think about every now and then. Right now the
You don't have to. The CRF layer accepts unnormalized emission scores just fine. It'll normalize the score of |
No problem! That would be an excellent idea. Feel free to close this issue, or keep it open as a reminder if you decide to incorporate more examples and also change the library such that |
Hi, I got some problem
first error come as CRF model has no the attribute batch_first , I solve it manually by ‘ CRF.batch_first = False’ then when I run the above code , the error come as
I am not sure if it is because my torch version is 1.1.0 , by the way , which torch version do you recommend? |
I have solve it , when the torch version is <= 1.0.0 , then no error |
@Huijun-Cui Thanks for letting me know. Next time please open a separate issue. |
Besides the toy examples listed in the docs and tests, are there actual examples of this library available anywhere?
I'm interested in using this library for a sequence labeling project, but I'm curious to know if I'm using this library correctly. What I have is something like this:
Although this seems to work and the loss is decreasing, I have a feeling that I might be missing something.
Any help is appreciated. Thanks!
The text was updated successfully, but these errors were encountered: