flairNLP / flair

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

[Bug]: AttributeError: 'SequenceTagger' object has no attribute 'tag_dictionary' #3264

Open nouranali opened 1 year ago

nouranali commented 1 year ago

Describe the bug

when I import sequencetagger model and try to access the tag dictionary I get the following error

AttributeError: 'SequenceTagger' object has no attribute 'tag_dictionary'

To Reproduce

from flair.models import SequenceTagger
config.tag_size = len(self.pos_tagger.tag_dictionary) if self.pos_tagger else None

Expected behavior

len of dictionary

Logs and Stack traces

No response

Screenshots

No response

Additional Context

No response

Environment

Versions:

Flair

0.12.2

Pytorch

1.10.0+cu102

Transformers

4.30.1

GPU

False

nouranali commented 1 year ago

the solution for me was to set self.tag_dictionary=tag_dictionary in the sequencetagger class and replace all tag_dictionary with self.tag_dictionary

helpmefindaname commented 1 year ago

Hi @nouranali , I suppose you are looking for tagger.label_dictionary