Comments (3)
It would be great if you can give more details about the question. i'm not sure whether i get it or not
from lm-lstm-crf.
oh, sorry,
For example, in https://github.com/spro/practical-pytorch/blob/master/seq2seq-translation/seq2seq-translation-batched.ipynb , the function 'forward' in class 'EncoderRNN'
packed = torch.nn.utils.rnn.pack_padded_sequence(embedded, input_lengths)
outputs, hidden = self.gru(packed, hidden)
outputs, output_lengths = torch.nn.utils.rnn.pad_packed_sequence(outputs) # unpack (back to padded)
it packs a batch of sentences firstly, and then uses gru.
And you do it in this way:
outputs, hidden = self.gru(embedded, hidden)
And I just want to know why you do not pack them, and what is the difference between using pack_padded_sequence or not.
thank you!
from lm-lstm-crf.
Get it!
it's essentially due to a advanced feature of PyTorch, which is padded sequences of variable length
.
In our code, we manually conducted the padding, and do not need to use this function (since i've heard that the padded sequence would cause inefficiency, but i'm not sure). And it seems that the example you refers use this technique. This is why i do not pack them, and they need to.
from lm-lstm-crf.
Related Issues (20)
- train_w.py Error HOT 2
- Mismatch of performance between this repository and the paper HOT 6
- How can I include handcrafted features in NER ?
- evaluator.calc_score HOT 3
- where is the dictory './data'
- AttributeError: module 'torch._C' has no attribute '_cuda_setDevice' HOT 3
- KeyError in predictor.py class predict HOT 1
- Question about POS performance HOT 2
- How to deal with sentences with different lengths?
- train_w.py Error, TypeError: can't convert np.ndarray of type numpy.object_ HOT 2
- Is word level bi-lstm reflected in the code ? HOT 1
- About the score given a sequence and a target
- anyone can update to pytorch1.0
- Missing "eval_batch" in train_w.py line 163 HOT 1
- RuntimeError: HOT 1
- dropout
- RuntimeError: expand(torch.LongTensor{[50, 1]}, size=[50]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
- How do you tune the model to get a large # of keywords outputted by the CRF layer? HOT 1
- Incorrect Precision Output for test_rec HOT 1
- Line 530 in utils.py is too slow with huge datasets HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lm-lstm-crf.