DPRQuestionEncoder

I have installed transformers version 3.0.2.

When I do a
from transformers import DPRQuestionEncoder, DPRQuestionEncoderTokenizer,
I get the following error :

ImportError Traceback (most recent call last)
in
----> 1 from transformers import DPRQuestionEncoder, DPRQuestionEncoderTokenizer

ImportError: cannot import name ‘DPRQuestionEncoder’ from ‘transformers’ (/anaconda3/lib/python3.7/site-packages/transformers/init.py)

ref: https://github.com/huggingface/transformers/issues/6013,
I see that dpr functionality is not available in 3.0.2.

No it’s not, it was merged after, so you will need a source install for that functionality.

Thanks for the reply!

I did a source install, but I get an error when I try to import DPRQuestionEncoder.

from transformers import DPRQuestionEncoder, DPRQuestionEncoderTokenizer

ImportError: cannot import name ‘DPRQuestionEncoder’

I had updated PYTHONPATH to include the path to the transformers code, but that didn’t help.

There must be a problem in your virtual enviromnent not using the right transformers version or your repo is not up to date. They definitely are in the repo.

I hadn’t installed torch. Works now!