jaketae / ensemble-transformers

Ensembling Hugging Face transformers made easy
MIT License
62 stars 5 forks source link

AttributeError: type object 'EnsembleModelForSequenceClassification' has no attribute 'from_multiple_pretrained' #2

Closed chashimo closed 1 year ago

chashimo commented 1 year ago

Describe the bug I got AttributeError when I executed the following code:

from ensemble_transformers import EnsembleModelForSequenceClassification
ensemble = EnsembleModelForSequenceClassification.from_multiple_pretrained("bert-base-uncased", "distilroberta-base", "xlnet-base-cased")
batch = ["This is a test sentence", "This is another test sentence."]
ensemble(batch)

So, I simply executed the example in the repo. Could anyone tell me how to fix this?

Expected behavior The output should be something like: tensor([[ 0.2858, -0.0892], [ 0.2437, -0.0338]], grad_fn=<MeanBackward1>)

chashimo commented 1 year ago

The above issue I posted was found when I used ensemble-transformers installed via "pip install". I tried the one installed via "git clone" and could successfully executed the example.

So, it is solved. Thanks!

jaketae commented 1 year ago

Hello, thanks for filing this issue! I realized that the pip version is out of sync with the GitHub main branch. I'll push out a fix in the coming days. Happy holidays!