RichardErkhov commited on
Commit
870a8a8
β€’
1 Parent(s): 4530778

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +129 -0
README.md ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ GNER-LLaMA-7B - GGUF
11
+ - Model creator: https://huggingface.co/dyyyyyyyy/
12
+ - Original model: https://huggingface.co/dyyyyyyyy/GNER-LLaMA-7B/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [GNER-LLaMA-7B.Q2_K.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q2_K.gguf) | Q2_K | 2.36GB |
18
+ | [GNER-LLaMA-7B.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.IQ3_XS.gguf) | IQ3_XS | 2.6GB |
19
+ | [GNER-LLaMA-7B.IQ3_S.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.IQ3_S.gguf) | IQ3_S | 2.75GB |
20
+ | [GNER-LLaMA-7B.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q3_K_S.gguf) | Q3_K_S | 2.75GB |
21
+ | [GNER-LLaMA-7B.IQ3_M.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.IQ3_M.gguf) | IQ3_M | 2.9GB |
22
+ | [GNER-LLaMA-7B.Q3_K.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q3_K.gguf) | Q3_K | 3.07GB |
23
+ | [GNER-LLaMA-7B.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q3_K_M.gguf) | Q3_K_M | 3.07GB |
24
+ | [GNER-LLaMA-7B.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q3_K_L.gguf) | Q3_K_L | 3.35GB |
25
+ | [GNER-LLaMA-7B.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.IQ4_XS.gguf) | IQ4_XS | 3.4GB |
26
+ | [GNER-LLaMA-7B.Q4_0.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q4_0.gguf) | Q4_0 | 3.56GB |
27
+ | [GNER-LLaMA-7B.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.IQ4_NL.gguf) | IQ4_NL | 3.58GB |
28
+ | [GNER-LLaMA-7B.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q4_K_S.gguf) | Q4_K_S | 3.59GB |
29
+ | [GNER-LLaMA-7B.Q4_K.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q4_K.gguf) | Q4_K | 3.8GB |
30
+ | [GNER-LLaMA-7B.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q4_K_M.gguf) | Q4_K_M | 3.8GB |
31
+ | [GNER-LLaMA-7B.Q4_1.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q4_1.gguf) | Q4_1 | 3.95GB |
32
+ | [GNER-LLaMA-7B.Q5_0.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q5_0.gguf) | Q5_0 | 4.33GB |
33
+ | [GNER-LLaMA-7B.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q5_K_S.gguf) | Q5_K_S | 4.33GB |
34
+ | [GNER-LLaMA-7B.Q5_K.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q5_K.gguf) | Q5_K | 4.45GB |
35
+ | [GNER-LLaMA-7B.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q5_K_M.gguf) | Q5_K_M | 4.45GB |
36
+ | [GNER-LLaMA-7B.Q5_1.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q5_1.gguf) | Q5_1 | 4.72GB |
37
+ | [GNER-LLaMA-7B.Q6_K.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q6_K.gguf) | Q6_K | 5.15GB |
38
+ | [GNER-LLaMA-7B.Q8_0.gguf](https://huggingface.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf/blob/main/GNER-LLaMA-7B.Q8_0.gguf) | Q8_0 | 6.67GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ license: apache-2.0
46
+ datasets:
47
+ - Universal-NER/Pile-NER-type
48
+ language:
49
+ - en
50
+ metrics:
51
+ - f1
52
+ library_name: transformers
53
+ pipeline_tag: text-generation
54
+ ---
55
+
56
+ <p align="center"><h2 align="center">Rethinking Negative Instances for Generative Named Entity Recognition</h2></p>
57
+
58
+ # Model Card for GNER-LLaMA-7B
59
+
60
+ <!-- Provide a quick summary of what the model is/does. -->
61
+
62
+ We introduce GNER, a **G**enerative **N**amed **E**ntity **R**ecognition framework, which demonstrates enhanced zero-shot capabilities across unseen entity domains. Experiments on two representative generative models, i.e., LLaMA and Flan-T5, show that the integration of negative instances into the training process yields substantial performance enhancements. The resulting models, GNER-LLaMA and GNER-T5, outperform state-of-the-art (SoTA) approaches by a large margin, achieving improvements of 8 and 11 points in $F_1$ score, respectively. Code and models are publicly available.
63
+
64
+ * πŸ’» Code: [https://github.com/yyDing1/GNER/](https://github.com/yyDing1/GNER/)
65
+ * πŸ“– Paper: [Rethinking Negative Instances for Generative Named Entity Recognition](https://arxiv.org/abs/2402.16602)
66
+ * πŸ’Ύ Models in the πŸ€— HuggingFace Hub: [GNER-Models](https://huggingface.co/collections/dyyyyyyyy/gner-65dda2cb96c6e35c814dea56)
67
+ * πŸ§ͺ Reproduction Materials: [Reproduction Materials](https://drive.google.com/drive/folders/1m2FqDgItEbSoeUVo-i18AwMvBcNkZD46?usp=drive_link)
68
+ * 🎨 Example Jupyter Notebooks: [GNER Notebook](https://github.com/yyDing1/GNER/blob/main/notebook.ipynb)
69
+
70
+ <p align="center">
71
+ <img src="https://github.com/yyDing1/GNER/raw/main/assets/zero_shot_results.png">
72
+ </p>
73
+
74
+ ## PreTrained Models
75
+
76
+ We release five GNER models based on LLaMA (7B) and Flan-T5 (base, large, xl and xxl).
77
+
78
+ | Model | # Params | Zero-shot Average $F_1$ | Supervised Average $F_1$ | πŸ€— HuggingFace<br />Download Link |
79
+ | ------------- | -------: | :----------------------: | :-----------------------: | :-------------------------------------------------: |
80
+ | GNER-LLaMA | 7B | 66.1 | 86.09 | [link](https://huggingface.co/dyyyyyyyy/GNER-LLaMA-7B) |
81
+ | GNER-T5-base | 248M | 59.5 | 83.21 | [link](https://huggingface.co/dyyyyyyyy/GNER-T5-base) |
82
+ | GNER-T5-large | 783M | 63.5 | 85.45 | [link](https://huggingface.co/dyyyyyyyy/GNER-T5-large) |
83
+ | GNER-T5-xl | 3B | 66.1 | 85.94 | [link](https://huggingface.co/dyyyyyyyy/GNER-T5-xl) |
84
+ | GNER-T5-xxl | 11B | 69.1 | 86.15 | [link](https://huggingface.co/dyyyyyyyy/GNER-T5-xxl) |
85
+
86
+ ## Demo usage
87
+
88
+ You should install the dependencies:
89
+ ```bash
90
+ pip install torch datasets deepspeed accelerate transformers protobuf
91
+ ```
92
+
93
+ Please check out [Example Jupyter Notebooks](https://github.com/yyDing1/GNER/blob/main/notebook.ipynb) for guidance on utilizing GNER models.
94
+
95
+ A simple inference example is as follows:
96
+
97
+ Below is an example using `GNER-LLaMA`
98
+ ```python
99
+ >>> import torch
100
+ >>> from transformers import AutoTokenizer, AutoModelForCausalLM
101
+ >>> tokenizer = AutoTokenizer.from_pretrained("dyyyyyyyy/GNER-LLaMA-7B")
102
+ >>> model = AutoModelForCausalLM.from_pretrained("dyyyyyyyy/GNER-LLaMA-7B", torch_dtype=torch.bfloat16).cuda()
103
+ >>> model = model.eval()
104
+ >>> 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"
105
+ >>> sentence = "did george clooney make a musical in the 1980s"
106
+ >>> entity_labels = ["genre", "rating", "review", "plot", "song", "average ratings", "director", "character", "trailer", "year", "actor", "title"]
107
+ >>> instruction = f"{instruction_template}\nUse the specific entity tags: {', '.join(entity_labels)} and O.\nSentence: {sentence}"
108
+ >>> instruction = f"[INST] {instruction} [/INST]"
109
+ >>> inputs = tokenizer(instruction, return_tensors="pt").to("cuda")
110
+ >>> outputs = model.generate(**inputs, max_new_tokens=640)
111
+ >>> response = tokenizer.decode(outputs[0], skip_special_tokens=True)
112
+ >>> response = response[response.find("[/INST]") + len("[/INST]"):].strip()
113
+ >>> print(response)
114
+ "did(O) george(B-actor) clooney(I-actor) make(O) a(O) musical(B-genre) in(O) the(O) 1980s(B-year)"
115
+ ```
116
+
117
+ ## Citation
118
+
119
+ ```bibtex
120
+ @misc{ding2024rethinking,
121
+ title={Rethinking Negative Instances for Generative Named Entity Recognition},
122
+ author={Yuyang Ding and Juntao Li and Pinzheng Wang and Zecheng Tang and Bowen Yan and Min Zhang},
123
+ year={2024},
124
+ eprint={2402.16602},
125
+ archivePrefix={arXiv},
126
+ primaryClass={cs.CL}
127
+ }
128
+ ```
129
+