Allennlp POS tagger taking longer time

Iam using constituency_parser and it’s taking a lot of time for getting the POS patterns for about 500 lines in a text file, Is there any parameter to set to the model predict so that I can just get the pos_tags and tokens alone. is there a way to load it faster or multiprocess the same?

@Sundeep_Pidugu are you feeding it the entire file at once or are you sending it one sentence at a time? Can you quantify how long it’s taking presently?

I tried passing the entire file and it just doesn’t respond, and then i pass sentence by sentence it take close to around 3 minutes for all the 500 sentences.

Hi @Sundeep_Pidugu, are you using a GPU? If you’re using the allennlp predict command for example, you should try using a GPU with --cuda-device 0. The constituency parser uses ELMo embeddings which are quite slow if you’re only using the CPU.

The bigger question is why you’re using a constituency parser if you just want pos tags. Why not just use spacy’s pos tagger?

1 Like