[Question] Actual usage examples?
See original GitHub issueBesides 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:
class MyModel(nn.Module):
def __init__(self, num_features, num_classes):
super(MyModel, self).__init__()
self.num_features = num_features
self.num_classes = num_classes
self.lstm = nn.LSTM(num_features, 128)
self.fc = nn.Linear(128, num_classes)
self.crf = CRF(num_classes)
# ----------------------------------------------------------
model = MyModel(...)
# Training loop:
y_hat = model(batch) # The network's forward returns fc(lstm(batch))
loss = -model.crf(y_hat, y)
loss.backward()
optimizer.step()
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!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
The 4 Main Types of Questions in English + Examples - Preply
4 Types of Questions in English. In this section, we'll walk you through each question type and provide real-world examples.
Read more >over 70 survey question examples + types of surveys and FAQs
70+ survey question examples you can use. Dos and don'ts of writing survey questions. 10 survey use cases: what you can do with...
Read more >User Interview Example Questions
The following are sample questions for a user interview. Please note that your questions need to be tailored to each individual project.
Read more >Question Definition & Meaning - Merriam-Webster
The meaning of QUESTION is an interrogative expression often used to test knowledge. How to use question in a sentence.
Read more >Survey Questions: Tips & Examples in 2022 - Qualtrics
Use open-ended question structures like “How do you feel about…” “If you said x, why?” or “What makes a good x?” Open-ended questions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No problem! That would be an excellent idea. Also thanks for clarification regarding the
log_softmax()
bit.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
loss
is separate from the CRF’s output. I’d personally be very happy if the changes/examples are added.Also, thanks for the great library!
@Huijun-Cui Thanks for letting me know. Next time please open a separate issue.