Skip to content

Commit

Permalink
update transformers version (castorini#601)
Browse files Browse the repository at this point in the history
* update transformers version

* update 4.6.0
  • Loading branch information
MXueguang authored May 21, 2021
1 parent aa4361c commit 0cecba6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pyserini/dsearch/_dsearcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import pandas as pd
from transformers import (AutoModel, AutoTokenizer, BertModel, BertTokenizer, DPRQuestionEncoder,
DPRQuestionEncoderTokenizer, RobertaTokenizer)
from transformers.file_utils import is_faiss_available, requires_faiss
from transformers.file_utils import is_faiss_available, requires_backends

from pyserini.util import (download_encoded_queries, download_prebuilt_index,
get_dense_indexes_info)
Expand Down Expand Up @@ -228,7 +228,7 @@ class SimpleDenseSearcher:
"""

def __init__(self, index_dir: str, query_encoder: Union[QueryEncoder, str]):
requires_faiss(self)
requires_backends(self, "faiss")
if isinstance(query_encoder, QueryEncoder):
self.query_encoder = query_encoder
else:
Expand Down
4 changes: 2 additions & 2 deletions pyserini/dsearch/_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional

from transformers import PreTrainedModel, RobertaConfig, RobertaModel
from transformers.file_utils import is_torch_available, requires_pytorch
from transformers.file_utils import is_torch_available, requires_backends

if is_torch_available():
import torch
Expand All @@ -15,7 +15,7 @@ class AnceEncoder(PreTrainedModel):
_keys_to_ignore_on_load_unexpected = [r'pooler', r'classifier']

def __init__(self, config: RobertaConfig):
requires_pytorch(self)
requires_backends(self, 'torch')
super().__init__(config)
self.config = config
self.roberta = RobertaModel(config)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pyjnius>=1.2.1
scikit-learn>=0.22.1
scipy>=1.4.1
tqdm
transformers>=4.0.0,<=4.5.0
transformers>=4.6.0
sentencepiece>=0.1.95

0 comments on commit 0cecba6

Please sign in to comment.