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

TransformerWordEmbeddings wrong arguments in README: batch_size not working #2195

Closed
ugm2 opened this issue Apr 1, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@ugm2
Copy link

ugm2 commented Apr 1, 2021

Describe the bug
I was following TRANSFORMER_EMBEDDINGS.md tutorial and tried assigning a batch_size for multiple sentences inference at once, and I got an error saying that batch_size is an unexpected keyword argument.

In the Arguments Section it says that I can use batch_size, but I was unable to.

It seems in Flair==0.7 works

To Reproduce

from flair.embeddings import TransformerWordEmbeddings
model = TransformerWordEmbeddings('bert-base-uncased', batch_size=2)

Traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/unai/miniconda3/envs/li_encoding/lib/python3.7/site-packages/flair/embeddings/token.py", line 821, in __init__
    self.model = AutoModel.from_pretrained(model, config=config, **kwargs)
  File "/home/unai/miniconda3/envs/li_encoding/lib/python3.7/site-packages/transformers/models/auto/modeling_auto.py", line 815, in from_pretrained
    pretrained_model_name_or_path, *model_args, config=config, **kwargs
  File "/home/unai/miniconda3/envs/li_encoding/lib/python3.7/site-packages/transformers/modeling_utils.py", line 1058, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
TypeError: __init__() got an unexpected keyword argument 'batch_size'

Expected behavior
I would expect a normal initialization of model, and then being able to embed sentences in chunks

Environment:

  • OS: Linux (Ubuntu 18.04.5 LTS)
  • Flair Version: 0.8
@ugm2 ugm2 added the bug Something isn't working label Apr 1, 2021
@alanakbik
Copy link
Collaborator

Hello @ugm2 we removed the batch_size parameter in Flair 0.8. I'll update the documentation!

alanakbik added a commit that referenced this issue Apr 1, 2021
@alanakbik
Copy link
Collaborator

Updated the docs, thanks for spotting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants