facebookresearch / StarSpace

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

Model file cannot be opened for saving! #231

Closed helgasvala closed 5 years ago

helgasvala commented 5 years ago

Hey!

I'd had some problems before with loading the base doc file and loading the model file but I had to download StarSpace again and now I'm getting a new error.

I'm using this tutorial https://towardsdatascience.com/learning-note-starspace-for-multi-label-text-classification-81de0e8fca53

My train and test files look like this:

'market open household __label__1',
 'guarante __label__1',
 'syring contain microgram correspond million intern unit interferon beta __label__0'

and I'm running

(base) Helgas-MBP:Starspace helgasvala$ Starspace/starspace train -ngrams 2 -minCount 10 -thread 4 -trainFile topics2/train_2.txt -model topics/starspace_2.model

I get

Arguments: 
lr: 0.01
dim: 100
epoch: 5
maxTrainTime: 8640000
validationPatience: 10
saveEveryEpoch: 0
loss: hinge
margin: 0.05
similarity: cosine
maxNegSamples: 10
negSearchLimit: 50
batchSize: 5
thread: 4
minCount: 10
minCountLabel: 1
label: __label__
label: __label__
ngrams: 2
bucket: 2000000
adagrad: 1
trainMode: 0
fileFormat: fastText
normalizeText: 0
dropoutLHS: 0
dropoutRHS: 0
useWeight: 0
weightSep: :
Start to initialize starspace model.
Build dict from input file : topics2/train_2.txt
Read 8M words
Number of words in dictionary:  14348
Number of labels in dictionary: 2
Loading data from file : topics2/train_2.txt
Total number of examples loaded : 803763
Training epoch 0: 0.01 0.002
Epoch: 100.0%  lr: 0.008000  loss: 0.002109  eta: 0h7m  tot: 0h1m52s  (20.0%)
 ---+++                Epoch    0 Train error : 0.00210387 +++--- ☃
Training epoch 1: 0.008 0.002
Epoch: 100.0%  lr: 0.006000  loss: 0.000526  eta: 0h6m  tot: 0h4m1s  (40.0%)
 ---+++                Epoch    1 Train error : 0.00052851 +++--- ☃
Training epoch 2: 0.006 0.002
Epoch: 100.0%  lr: 0.004000  loss: 0.000352  eta: 0h3m  tot: 0h5m57s  (60.0%)
 ---+++                Epoch    2 Train error : 0.00035227 +++--- ☃
Training epoch 3: 0.004 0.002
Epoch: 100.0%  lr: 0.002000  loss: 0.000302  eta: 0h1m  tot: 0h7m50s  (80.0%)
 ---+++                Epoch    3 Train error : 0.00028948 +++--- ☃
Training epoch 4: 0.002 0.002
Epoch: 100.0%  lr: -0.000000  loss: 0.000264  eta: <1min   tot: 0h9m43s  (100.0%)
 ---+++                Epoch    4 Train error : 0.00025703 +++--- ☃
Saving model to file : topics/starspace_2.model
Model file cannot be opened for saving!

I can't find anything about this problem except for the code where the error message is written. What can I do to get around this?

Thanks for your help!

ledw commented 5 years ago

@helgasvala Hi, does the directory topics exists and you have the write permission? I think that's the only reason the model saving could fail. Have you checked that?

helgasvala commented 5 years ago

It worked with a completely new installation, something must have gone wrong when installing. Thanks. :)

ledw commented 5 years ago

@helgasvala You're welcome. I'm glad that works. Closing the issue now.