jingtaozhan / DRhard

SIGIR'21: Optimizing DR with hard negatives and achieving SOTA first-stage retrieval performance on TREC DL Track.
BSD 3-Clause "New" or "Revised" License
125 stars 14 forks source link

Issue in importing RobertaPreTrainedModel during STAR inference #10

Closed yitsingF closed 3 years ago

yitsingF commented 3 years ago

Hi, I am trying to replicate your job and confront the following issue when executing python ./star/inference.py --data_type passage --max_doc_length 256 --mode dev

the error is:

Traceback (most recent call last):
  File "./star/inference.py", line 15, in <module>
    from model import RobertaDot
  File "./model.py", line 10, in <module>
    from transformers.modeling_roberta import RobertaPreTrainedModel
ImportError: cannot import name 'RobertaPreTrainedModel' from 'transformers.modeling_rob

this error happens for both transformers versions (2.8.0 and 3.4.0)

I found ANCE uses RobertaForSequenceClassification in RobertaDot_NLL_LN, can I use this class or some other RoBerta subclass instead?

best regards