facebookresearch / StarSpace

Learning embeddings for classification, retrieval and ranking.
MIT License
3.94k stars 531 forks source link

Training works, but testing doesn't #166

Closed rajicon closed 6 years ago

rajicon commented 6 years ago

I'm using StarSpace for multilabel classification, and training the model works fine, but testing gives me the following error:

assertion "pair.first < this->numRows()" failed: file "src/proj.h", line 57, function: void starspace::SparseLinear::forward(const std::vector<std::pair<int, Real> >&, starspace::Matrix&) [with Real = float] Aborted (core dumped)

Here is the full output: starspace test -testFile cache/val.txt -model cache/starspace.model -predictionFile cache/starspace.pred Arguments: lr: 0.01 dim: 100 epoch: 5 maxTrainTime: 8640000 saveEveryEpoch: 0 loss: hinge margin: 0.05 similarity: cosine maxNegSamples: 10 negSearchLimit: 50 thread: 10 minCount: 1 minCountLabel: 1 label: label ngrams: 1 bucket: 2000000 adagrad: 1 trainMode: 0 fileFormat: fastText normalizeText: 0 dropoutLHS: 0 dropoutRHS: 0 Start to load a trained starspace model. STARSPACE-2017-2 Model loaded. Loading data from file : cache/val.txt Total number of examples loaded : 39892 ------Loaded model args: Arguments: lr: 0.01 dim: 100 epoch: 5 maxTrainTime: 8640000 saveEveryEpoch: 0 loss: hinge margin: 0.05 similarity: cosine maxNegSamples: 10 negSearchLimit: 50 thread: 10 minCount: 10 minCountLabel: 1 label: label ngrams: 2 bucket: 2000000 adagrad: 1 trainMode: 0 fileFormat: fastText normalizeText: 0 dropoutLHS: 0 dropoutRHS: 0 assertion "pair.first < this->numRows()" failed: file "src/proj.h", line 57, function: void starspace::SparseLinear::forward(const std::vector<std::pair<int, Real> >&, starspace::Matrix&) [with Real = float] Aborted (core dumped)

This happens even when I test on the same data I trained on, so I don't think it has to do with the data.

I'm using cygwin on Windows, if that matters.

rajicon commented 6 years ago

I tried using the tsv file instead, it seems to work.

ledw commented 6 years ago

@rajicon glad to know the tsv file works. Sometimes it could be due to the model saved is corrupted, or it's not the same version. Try to make clean and rerun the model to see if the problem persists.

ledw commented 6 years ago

Closing as no recent update.