flairNLP / flair

A very simple framework for state-of-the-art Natural Language Processing (NLP)
https://flairnlp.github.io/flair/
Other
13.88k stars 2.1k forks source link

Can't run PooledFlairEmbeddings - unexpected keyword argument 'pool' #1470

Closed abhisaarsharma closed 4 years ago

abhisaarsharma commented 4 years ago

Describe the bug I ran into the 'cpu+0' issue described here and i did pip install --upgrade git+https://github.com/flairNLP/flair.git so i am on the latest flair version. I am trying to reproduce the state of the art NER results but the given examples are not running.

To Reproduce Run the CoNLL-03 Named Entity Recognition (Dutch) example


TypeError Traceback (most recent call last)

in 16 embedding_types: List[TokenEmbeddings] = [ 17 WordEmbeddings('nl'), ---> 18 PooledFlairEmbeddings('dutch-forward', pool='mean'), 19 PooledFlairEmbeddings('dutch-backward', pool='mean'), 20 ] ~\AppData\Local\Continuum\anaconda3\lib\site-packages\flair\embeddings.py in __init__(self, contextual_embeddings, pooling, only_capitalized, **kwargs) 2107 if type(contextual_embeddings) is str: 2108 self.context_embeddings: FlairEmbeddings = FlairEmbeddings( -> 2109 contextual_embeddings, **kwargs 2110 ) 2111 else: TypeError: __init__() got an unexpected keyword argument 'pool' **Expected behavior** Expected behavior is reproducing the SOTA results. **Screenshots** If applicable, add screenshots to help explain your problem. **Environment (please complete the following information):** - OS [Windows]: - Version [flair-0.4.5, torch 1.4.0] **Additional context** Add any other context about the problem here.
abhisaarsharma commented 4 years ago

It seems that the parameter is changed from 'pool' to 'pooling' in PooledFlairEmbeddings.

Please update your documentation when you get a chance, thanks and closing this.

djstrong commented 4 years ago

Glad you solved this. Please make pull request with updated document.

alanakbik commented 4 years ago

@abhisaarsharma thanks for spotting this - just updated the docs!