facebookresearch / StarSpace

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

recomm_user_artists example: Model file cannot be opened for loading! #176

Closed loretoparisi closed 6 years ago

loretoparisi commented 6 years ago

I'm using the example recomm_user_artists.sh. I get two errors Input file cannot be opened! and Model file cannot be opened for loading!.

The temporary directory contents

ip-192-168-22-127:StarSpace loretoparisi$ ls -l /tmp/starspace/data/lastfm/
artists.dat                        readme.txt                         temp                               user_friends.dat                   user_taggedartists.dat
lastfm.zip                         tags.dat                           user_artists.dat                   user_taggedartists-timestamps.dat  

So it seems the .train and .test files are missing. The error was due to the error split: illegal option -- d:

split: illegal option -- d
usage: split [-a sufflen] [-b byte_count] [-l line_count] [-p pattern]
             [file [prefix]]

The whole console logging:

bash examples/recomm_user_artists.sh 
Downloading dataset lastFM
--2018-09-19 12:55:14--  http://files.grouplens.org/datasets/hetrec2011/hetrec2011-lastfm-2k.zip
Risoluzione di files.grouplens.org (files.grouplens.org)... 128.101.34.235
Connessione a files.grouplens.org (files.grouplens.org)|128.101.34.235|:80... connesso.
Richiesta HTTP inviata, in attesa di risposta... 200 OK
Lunghezza: 2589075 (2,5M) [application/zip]
Salvataggio in: "/tmp/starspace/data/lastfm/lastfm.zip"

/tmp/starspace/data/lastfm/lastfm.zip       100%[===========================================================================================>]   2,47M  2,05MB/s    in 1,2s    

2018-09-19 12:55:16 (2,05 MB/s) - "/tmp/starspace/data/lastfm/lastfm.zip" salvato [2589075/2589075]

Archive:  /tmp/starspace/data/lastfm/lastfm.zip
  inflating: /tmp/starspace/data/lastfm/user_friends.dat  
  inflating: /tmp/starspace/data/lastfm/user_taggedartists.dat  
  inflating: /tmp/starspace/data/lastfm/user_taggedartists-timestamps.dat  
  inflating: /tmp/starspace/data/lastfm/artists.dat  
  inflating: /tmp/starspace/data/lastfm/readme.txt  
  inflating: /tmp/starspace/data/lastfm/tags.dat  
  inflating: /tmp/starspace/data/lastfm/user_artists.dat  
Converting data to StarSpace format ...
split: illegal option -- d
usage: split [-a sufflen] [-b byte_count] [-l line_count] [-p pattern]
             [file [prefix]]
mv: rename /tmp/starspace/data/lastfm/user_artists00 to /tmp/starspace/data/lastfm/user_artists.train: No such file or directory
mv: rename /tmp/starspace/data/lastfm/user_artists01 to /tmp/starspace/data/lastfm/user_artists.test: No such file or directory
Compiling StarSpace
make: Nothing to be done for `opt'.
Start to train on lastfm data:
Arguments: 
lr: 0.01
dim: 100
epoch: 100
maxTrainTime: 8640000
validationPatience: 10
saveEveryEpoch: 0
loss: hinge
margin: 0.05
similarity: cosine
maxNegSamples: 100
negSearchLimit: 100
thread: 40
minCount: 1
minCountLabel: 1
label: A
ngrams: 1
bucket: 2000000
adagrad: 1
trainMode: 1
fileFormat: fastText
normalizeText: 0
dropoutLHS: 0
dropoutRHS: 0
Start to initialize starspace model.
Build dict from input file : /tmp/starspace/data/lastfm/user_artists.train
Input file cannot be opened!
Start to evaluate trained model:
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
thread: 40
minCount: 1
minCountLabel: 1
label: A
ngrams: 1
bucket: 2000000
adagrad: 1
trainMode: 1
fileFormat: fastText
normalizeText: 0
dropoutLHS: 0
dropoutRHS: 0
Start to load a trained starspace model.
Model file cannot be opened for loading!
ledw commented 6 years ago

@loretoparisi Hi, this seems to be an issue with split in your operation system. Check if the solution in the following page helps: https://apple.stackexchange.com/questions/138785/d-option-for-split-is-illegal-on-os-x-10-9

loretoparisi commented 6 years ago

@ledw yes it was! I had to change split to default POSIX options:

split -l 1500 ${TEMP_FILE} ${OUTPUT_FILE}
mv "${DATADIR}/${DATASET}/user_artistsaa" "${DATADIR}/${DATASET}/user_artists.train"
mv "${DATADIR}/${DATASET}/user_artistsab" "${DATADIR}/${DATASET}/user_artists.test"