import flair import torch from flair.models import TARSSequenceTagger2 from flair.data import Sentence from flair.datasets import MIT_MOVIE_NER_COMPLEX flair.set_seed(3) tagger = TARSSequenceTagger2.load("resources/v3/conll_3-cryptic/final-model.pt") label_name_map = { "Character_Name":"Character Name" } print(label_name_map) corpus = MIT_MOVIE_NER_COMPLEX(tag_to_bioes=None, tag_to_bio2="ner", label_name_map=label_name_map) corpus = corpus.downsample(0.1) tag_type = "ner" tag_dictionary = corpus.make_label_dictionary(tag_type) tagger.add_and_switch_to_new_task("zeroshot-conll_3-cryptic-to-moviecomplex", tag_dictionary=tag_dictionary, tag_type=tag_type) result, eval_loss = tagger.evaluate(corpus.test) print(result.main_score) print(result.log_header) print(result.log_line) print(result.detailed_results) print(eval_loss) # evaluation sentences = [ Sentence("The Parlament of the United Kingdom is discussing a variety of topics."),