Skip to content

Arguments: (AttributeError("'TransformerWordEmbeddings' object has no attribute 'tokenize'"),) #4

@Student-xyf

Description

@Student-xyf

Hi urchade,

Thanks a lot for this great work. 😃
I'm trying to reproduce your results on CONLL04. But I found that the code reported an error:
Arguments: (AttributeError("'TransformerWordEmbeddings' object has no attribute 'tokenize'"),)
Through debugging, it was found that the flair library was referenced:
from flair.embeddings import TransformerWordEmbeddings
Then pass this code:
self.bert_layer = TransformerWordEmbeddings(model_name, fine_tune=fine_tune, subtoken_pooling=subtoken_pooling)
Among them model_name="bert-base-cased", fine_tune=True, subtoken_pooling="first"

Execute to the next code:
embedder = self.bert_layer
tokenized_sentences, all_token_subtoken_lengths, subtoken_lengths = embedder._gather_tokenized_strings(sentences)

The reason for the error is that the _gather_tokenized_strings method under the embedder cannot be found. I would like to ask what the reason is. It is because my flair version is wrong.

My flair version is: flair==0.13.1

Looking forward to your reply, thank you

Sincerely

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions