Describe the bug
When I run this:
embedding_types: List[TokenEmbeddings] = [
FlairEmbeddings('news-forward'),
FlairEmbeddings('news-backward')
]
I obtain the following errors:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-177704bfc5f6> in <module>()
---> 51 FlairEmbeddings('news-forward'),
52 FlairEmbeddings('news-backward')
5 frames
/usr/local/lib/python3.6/dist-packages/flair/embeddings.py in __init__(self, model, fine_tune, chars_per_chunk)
1986 self.name = f"Task-LSTM-{self.lm.hidden_size}-{self.lm.nlayers}-{self.lm.is_forward_lm}"
1987 else:
-> 1988 self.lm: LanguageModel = LanguageModel.load_language_model(model)
1989 self.name = str(model)
1990
/usr/local/lib/python3.6/dist-packages/flair/models/language_model.py in load_language_model(cls, model_file)
195 state["embedding_size"],
196 state["nout"],
--> 197 state["dropout"],
198 )
199 model.load_state_dict(state["state_dict"])
/usr/local/lib/python3.6/dist-packages/flair/models/language_model.py in __init__(self, dictionary, is_forward_lm, hidden_size, nlayers, embedding_size, nout, dropout)
59
60 # auto-spawn on GPU if available
---> 61 self.to(flair.device)
62
63 def init_weights(self):
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in to(self, *args, **kwargs)
441 return t.to(device, dtype if t.is_floating_point() else None, non_blocking)
442
--> 443 return self._apply(convert)
444
445 def register_backward_hook(self, hook):
/usr/local/lib/python3.6/dist-packages/flair/models/language_model.py in _apply(self, fn)
392 def _apply(self, fn):
393 major, minor, build, *_ = (int(info)
--> 394 for info in torch.__version__.split('.'))
395
396 # fixed RNN change format for torch 1.4.0
/usr/local/lib/python3.6/dist-packages/flair/models/language_model.py in <genexpr>(.0)
392 def _apply(self, fn):
393 major, minor, build, *_ = (int(info)
--> 394 for info in torch.__version__.split('.'))
395
396 # fixed RNN change format for torch 1.4.0
ValueError: invalid literal for int() with base 10: '0+cu101'
To Reproduce
Follow this flair guide for NER and use flair embeddings
Expected behavior
Embeddings are stacked without errors.
Screenshots
None
Environment (please complete the following information):
Additional context
None
This issue was solved for me when I used:
!pip install --upgrade git+https://github.com/flairNLP/flair.git
Yes, this issue is fixed in master branch. Fix is part of next release.
Closing but feel free to reopen if you have more questions.
this issue generated again whenever i use PooledFlairEmbeddings. Any help please as the above fix doesn't work with me.
Most helpful comment
This issue was solved for me when I used: