Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANCE compatibility with the newest version of transformers #14

Open
WerLaj opened this issue Sep 13, 2022 · 9 comments
Open

ANCE compatibility with the newest version of transformers #14

WerLaj opened this issue Sep 13, 2022 · 9 comments

Comments

@WerLaj
Copy link

WerLaj commented Sep 13, 2022

Hi,

I'm trying to use ANCE dense retriever followed by a T5 re-ranker implemented using the transformers package. I'm getting the dependency conflicts, as pyterrier_ance requires transformers==2.3.0, but I need to use a newer version that contains T5 model. Currently, I'm using transformers==4.9.0.

@cmacdonald @seanmacavaney @tonellotto @Xiao0728

@cmacdonald
Copy link
Contributor

Hi. Have you tried just installed transformers 4 once pyt_ance is installed? If you can do that, and post the error message, I can try to see how to fix.

@WerLaj
Copy link
Author

WerLaj commented Sep 13, 2022

Thank you for your quick reply. I've tried that. Here is the dependency error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. pyserini 0.17.1 requires pyjnius>=1.4.0, but you have pyjnius 1.3.0 which is incompatible. ance 0.1.0 requires transformers==2.3.0, but you have transformers 4.9.0 which is incompatible.

And the error message while running ANCE:
import pyterrier_ance
File ".../lib/python3.7/site-packages/pyterrier_ance/__init__.py", line 125, in <module>
from ance.drivers.run_ann_data_gen import StreamInferenceDoc, load_model, GetProcessingFn
File ".../lib/python3.7/site-packages/ance/drivers/run_ann_data_gen.py", line 6, in <module>
from ance.utils.util import (
File ".../lib/python3.7/site-packages/ance/utils/util.py", line 25, in <module>
from ance.model.models import MSMarcoConfigDict, ALL_MODELS
File ".../lib/python3.7/site-packages/ance/model/models.py", line 260, in <module>
(),
File ".../lib/python3.7/site-packages/ance/model/models.py", line 256, in <genexpr>
for conf in (
AttributeError: type object 'RobertaConfig' has no attribute 'pretrained_config_archive_map'

@cmacdonald
Copy link
Contributor

Ok I remember now. Have a look at this PR: https://github.com/cmacdonald/ANCE/pull/1/files, which I think may work for transformers 4 as well.

@WerLaj
Copy link
Author

WerLaj commented Sep 13, 2022

Thanks a lot! It worked with some small modifications for the ance/model/models.py file (e.g., from transformers import RobertaConfig instead of from transformers.configuration_roberta import RobertaConfig for all the imports in lines 17-26). Are you planning on officially applying this fix anytime soon? Should I create a PR from the forked repo?

@cmacdonald
Copy link
Contributor

We dont use ANCE a lot, as it tends just to be a baseline for other experiments. We would need to extend the github testing to check multiple transformer versions (see how we did it https://github.com/terrierteam/pyterrier_colbert/pull/41/files). Happy to take a PR that fixes this though.

@cmacdonald
Copy link
Contributor

Hi @WerLaj can you submit the PR for ANCE, and I can do the testing on this repo?

@WerLaj
Copy link
Author

WerLaj commented Sep 15, 2022

Hi, this is the PR that I created. I tested it in my own project and ANCE is working just fine with transformers==4.9.0. right now.

@cmacdonald
Copy link
Contributor

thanks. I'll want to make things work with old and new transformers versions. Leave it with me.

@WerLaj
Copy link
Author

WerLaj commented Sep 16, 2022

Great, thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants