1

I wrote LDA model in notebook. I'm trying to wrap my gensim LDA model with mallet, getting the following error:

CalledProcessError: Command '../input/mymallet/mallet-2.0.8/bin/mallet import-file --preserve-case --keep-sequence --remove-stopwords --token-regex "\S+" --input /tmp/fbcc4b_corpus.txt --output /tmp/fbcc4b_corpus.mallet' returned non-zero exit status 126.

The error raised because of the second line:

mallet_path = '../input/mymallet/mallet-2.0.8/bin/mallet' # update this path
ldamallet = gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus, num_topics=20, id2word=id2word)

The path is correct.

Tried this solution: Gensim mallet CalledProcessError: returned non-zero exit status

didn't work for me..

2 Answers2

0

I spent hours trying to solve it. Tried this solution and nothing worked.

Looking to a previous sucessfull call I made to LDA Mallet, I noticed some parameters were not being set, then I made it like this:

gensim.models.wrappers.LdaMallet(mallet_path=mallet_path, corpus=corpus, num_topics=num_topics, id2word=id2word, prefix='temp_file_', workers=4)

I really hope it helps you. Finding a solution to this problem is a pain.

0

I don't know if you ever solved this or not, but I have run into the same problem. For me, the problem occurred because I had uploaded the mallet binary to a research server, where Mallet lost its executable flag. My solution was to run

chmod -R +x mallet-2.0.8

This allowed the gensim wrapper, or whatever means you wish to run mallet, to run the executable file. If you want to be more precise with the chmod, you could probably chmod the actual mallet-2.0.8/bin/mallet file.

rchurch4
  • 859
  • 6
  • 14