Views
No views yet

| Model | # Params | Zero-shot Average $F_1$ | Supervised Average $F_1$ | 🤗 HuggingFace Download Link |
|---|---|---|---|---|
| GNER-LLaMA | 7B | 66.1 | 86.09 | link |
| GNER-T5-base | 248M | 59.5 | 83.21 | link |
| GNER-T5-large | 783M | 63.5 | 85.45 | link |
| GNER-T5-xl | 3B | 66.1 | 85.94 | link |
| GNER-T5-xxl | 11B | 69.1 | 86.15 | link |
pip install torch datasets deepspeed accelerate transformers protobufGNER-T51>>> import torch
2>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3>>> tokenizer = AutoTokenizer.from_pretrained("dyyyyyyyy/GNER-T5-xxl")
4>>> model = AutoModelForSeq2SeqLM.from_pretrained("dyyyyyyyy/GNER-T5-xxl", torch_dtype=torch.bfloat16).cuda()
5>>> model = model.eval()
6>>> instruction_template = "Please analyze the sentence provided, identifying the type of entity for each word on a token-by-token basis.\nOutput format is: word_1(label_1), word_2(label_2), ...\nWe'll use the BIO-format to label the entities, where:\n1. B- (Begin) indicates the start of a named entity.\n2. I- (Inside) is used for words within a named entity but are not the first word.\n3. O (Outside) denotes words that are not part of a named entity.\n"
7>>> sentence = "did george clooney make a musical in the 1980s"
8>>> entity_labels = ["genre", "rating", "review", "plot", "song", "average ratings", "director", "character", "trailer", "year", "actor", "title"]
9>>> instruction = f"{instruction_template}\nUse the specific entity tags: {', '.join(entity_labels)} and O.\nSentence: {sentence}"
10>>> inputs = tokenizer(instruction, return_tensors="pt").to("cuda")
11>>> outputs = model.generate(**inputs, max_new_tokens=640)
12>>> response = tokenizer.decode(outputs[0], skip_special_tokens=True)
13>>> print(response)
14"did(O) george(B-actor) clooney(I-actor) make(O) a(O) musical(B-genre) in(O) the(O) 1980s(B-year)"1@misc{ding2024rethinking,
2 title={Rethinking Negative Instances for Generative Named Entity Recognition},
3 author={Yuyang Ding and Juntao Li and Pinzheng Wang and Zecheng Tang and Bowen Yan and Min Zhang},
4 year={2024},
5 eprint={2402.16602},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}