Skip to content

TypeError: __init__() missing 1 required positional argument: 'text' while loading the model #64

@Siddhijain16

Description

@Siddhijain16

Hi @jantrienes ,
I am following the step mention at README.md but I am not able to get any result.
While loading the model I am facing this error. Please help me out how to solve it.
image

Select downloaded model

model = './model_bilstmcrf_ons_large-v0.2.0/final-model.pt'

Instantiate tokenizer

tokenizer = TokenizerFactory().tokenizer(corpus='ons', disable=("tagger", "ner"))

Output ==> 2022-04-11 10:22:37.046 | INFO | deidentify.tokenizer.base:tokenizer:36 - Tokenizer for corpus: ons

Load tagger with a downloaded model file and tokenizer

tagger = FlairTagger(model=model, tokenizer=tokenizer, verbose=False)

Annotate your documents

annotated_docs = tagger.annotate(documents)

Output ==>
2022-04-11 10:30:37.252 | INFO | deidentify.taggers.flair_tagger:init:20 - Load flair model from /content/drive/MyDrive/47billion/model_bilstmcrf_ons_large-v0.2.0/final-model.pt

2022-04-11 10:30:37,257 loading file /content/drive/MyDrive/47billion/model_bilstmcrf_ons_large-v0.2.0/final-model.pt
2022-04-11 10:30:59,342 SequenceTagger predicts: Dictionary with 33 tags: , O, B-Date, B-Name, I-Name, B-Hospital, B-Internal_Location, B-Care_Institute, B-Initials, B-Organization_Company, I-Organization_Company, I-Date, B-ID, I-ID, I-Care_Institute, B-Address, I-Address, B-Age, I-Age, I-Hospital, I-Internal_Location, B-Phone_fax, B-Profession, I-Profession, I-Initials, B-Other, I-Other, B-URL_IP, I-Phone_fax, B-Email, B-SSN, ,

2022-04-11 10:31:00.242 | INFO | deidentify.taggers.flair_tagger:init:22 - Finish loading flair model.


TypeError Traceback (most recent call last)

in ()
2 tagger = FlairTagger(model=model, tokenizer=tokenizer, verbose=False)
3 # Annotate your documents
----> 4 annotated_docs = tagger.annotate(documents)

1 frames

/usr/local/lib/python3.7/dist-packages/deidentify/methods/bilstmcrf/flair_utils.py in standoff_to_flair_sents(docs, tokenizer, verbose)
59 flair_sents = []
60 for sent in sents:
---> 61 flair_sent = Sentence()
62 for token in sent:
63 if token.text.isspace():

TypeError: init() missing 1 required positional argument: 'text'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions