GateNLP / gate-lf-pytorch-json

PyTorch wrapper for the LearningFramework GATE plugin
Apache License 2.0
1 stars 2 forks source link

Pytorch emits an odd message which screws up the process communication #48

Closed johann-petrak closed 5 years ago

johann-petrak commented 5 years ago

Pytorch emits the message:

Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex.

Since we use stdout/stderr pipes for process communication, this messes up things and makes the application crash.

johann-petrak commented 5 years ago

This may not actually be pytorch but either some GPU-related library used by pytorch or the Elmo model code we use

johann-petrak commented 5 years ago

Searching all of anaconda this only is found in one file: lib/python3.6/site-packages/pytorch_pretrained_bert/modeling.py

Why would we load or use that file though??

johann-petrak commented 5 years ago

OK, allennlp contains both ELMO and BERT so this could happen when allennlp is loaded.

johann-petrak commented 5 years ago

Allennlp loads the pretrained bert modeling when loading the Elmo module. This causes the message. The modeling.py I had was from a version of pytorch pretrained which used "print" to emit the message to standard output. This has been changed in version 0.6.2 to use the logger.

So in order to fix this:

johann-petrak commented 5 years ago

The TextClassCnnSingleElmo module should also check the version of pytorch-pretrained and maybe just refuse to work unless it finds at least 0.6.2

johann-petrak commented 5 years ago

For now, requiring version 0.6.2 or later of pytorch_pretrained_bert is an acceptable fix.