Instructions to use RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf", filename="GNER-LLaMA-7B.IQ3_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
Use Docker
docker model run hf.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf with Ollama:
ollama run hf.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
- Unsloth Studio
How to use RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf to start chatting
- Atomic Chat new
- Docker Model Runner
How to use RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf with Docker Model Runner:
docker model run hf.co/RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
- Lemonade
How to use RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull RichardErkhov/dyyyyyyyy_-_GNER-LLaMA-7B-gguf:Q4_K_M
Run and chat with the model
lemonade run user.dyyyyyyyy_-_GNER-LLaMA-7B-gguf-Q4_K_M
List all available models
lemonade list
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Quantization made by Richard Erkhov.
GNER-LLaMA-7B - GGUF
- Model creator: https://huggingface.co/dyyyyyyyy/
- Original model: https://huggingface.co/dyyyyyyyy/GNER-LLaMA-7B/
| Name | Quant method | Size |
|---|---|---|
| GNER-LLaMA-7B.Q2_K.gguf | Q2_K | 2.36GB |
| GNER-LLaMA-7B.IQ3_XS.gguf | IQ3_XS | 2.6GB |
| GNER-LLaMA-7B.IQ3_S.gguf | IQ3_S | 2.75GB |
| GNER-LLaMA-7B.Q3_K_S.gguf | Q3_K_S | 2.75GB |
| GNER-LLaMA-7B.IQ3_M.gguf | IQ3_M | 2.9GB |
| GNER-LLaMA-7B.Q3_K.gguf | Q3_K | 3.07GB |
| GNER-LLaMA-7B.Q3_K_M.gguf | Q3_K_M | 3.07GB |
| GNER-LLaMA-7B.Q3_K_L.gguf | Q3_K_L | 3.35GB |
| GNER-LLaMA-7B.IQ4_XS.gguf | IQ4_XS | 3.4GB |
| GNER-LLaMA-7B.Q4_0.gguf | Q4_0 | 3.56GB |
| GNER-LLaMA-7B.IQ4_NL.gguf | IQ4_NL | 3.58GB |
| GNER-LLaMA-7B.Q4_K_S.gguf | Q4_K_S | 3.59GB |
| GNER-LLaMA-7B.Q4_K.gguf | Q4_K | 3.8GB |
| GNER-LLaMA-7B.Q4_K_M.gguf | Q4_K_M | 3.8GB |
| GNER-LLaMA-7B.Q4_1.gguf | Q4_1 | 3.95GB |
| GNER-LLaMA-7B.Q5_0.gguf | Q5_0 | 4.33GB |
| GNER-LLaMA-7B.Q5_K_S.gguf | Q5_K_S | 4.33GB |
| GNER-LLaMA-7B.Q5_K.gguf | Q5_K | 4.45GB |
| GNER-LLaMA-7B.Q5_K_M.gguf | Q5_K_M | 4.45GB |
| GNER-LLaMA-7B.Q5_1.gguf | Q5_1 | 4.72GB |
| GNER-LLaMA-7B.Q6_K.gguf | Q6_K | 5.15GB |
| GNER-LLaMA-7B.Q8_0.gguf | Q8_0 | 6.67GB |
Original model description:
license: apache-2.0 datasets: - Universal-NER/Pile-NER-type language: - en metrics: - f1 library_name: transformers pipeline_tag: text-generation
Rethinking Negative Instances for Generative Named Entity Recognition
Model Card for GNER-LLaMA-7B
We introduce GNER, a Generative Named Entity Recognition 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.
- ๐ป Code: https://github.com/yyDing1/GNER/
- ๐ Paper: Rethinking Negative Instances for Generative Named Entity Recognition
- ๐พ Models in the ๐ค HuggingFace Hub: GNER-Models
- ๐งช Reproduction Materials: Reproduction Materials
- ๐จ Example Jupyter Notebooks: GNER Notebook
PreTrained Models
We release five GNER models based on LLaMA (7B) and Flan-T5 (base, large, xl and xxl).
| 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 |
Demo usage
You should install the dependencies:
pip install torch datasets deepspeed accelerate transformers protobuf
Please check out Example Jupyter Notebooks for guidance on utilizing GNER models.
A simple inference example is as follows:
Below is an example using GNER-LLaMA
>>> import torch
>>> from transformers import AutoTokenizer, AutoModelForCausalLM
>>> tokenizer = AutoTokenizer.from_pretrained("dyyyyyyyy/GNER-LLaMA-7B")
>>> model = AutoModelForCausalLM.from_pretrained("dyyyyyyyy/GNER-LLaMA-7B", torch_dtype=torch.bfloat16).cuda()
>>> model = model.eval()
>>> 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"
>>> sentence = "did george clooney make a musical in the 1980s"
>>> entity_labels = ["genre", "rating", "review", "plot", "song", "average ratings", "director", "character", "trailer", "year", "actor", "title"]
>>> instruction = f"{instruction_template}\nUse the specific entity tags: {', '.join(entity_labels)} and O.\nSentence: {sentence}"
>>> instruction = f"[INST] {instruction} [/INST]"
>>> inputs = tokenizer(instruction, return_tensors="pt").to("cuda")
>>> outputs = model.generate(**inputs, max_new_tokens=640)
>>> response = tokenizer.decode(outputs[0], skip_special_tokens=True)
>>> response = response[response.find("[/INST]") + len("[/INST]"):].strip()
>>> print(response)
"did(O) george(B-actor) clooney(I-actor) make(O) a(O) musical(B-genre) in(O) the(O) 1980s(B-year)"
Citation
@misc{ding2024rethinking,
title={Rethinking Negative Instances for Generative Named Entity Recognition},
author={Yuyang Ding and Juntao Li and Pinzheng Wang and Zecheng Tang and Bowen Yan and Min Zhang},
year={2024},
eprint={2402.16602},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
- Downloads last month
- 129
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit