Instructions to use LR-AI-Labs/tiny-universal-NER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LR-AI-Labs/tiny-universal-NER with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LR-AI-Labs/tiny-universal-NER")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LR-AI-Labs/tiny-universal-NER") model = AutoModelForCausalLM.from_pretrained("LR-AI-Labs/tiny-universal-NER", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LR-AI-Labs/tiny-universal-NER with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LR-AI-Labs/tiny-universal-NER" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LR-AI-Labs/tiny-universal-NER", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/LR-AI-Labs/tiny-universal-NER
- SGLang
How to use LR-AI-Labs/tiny-universal-NER with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "LR-AI-Labs/tiny-universal-NER" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LR-AI-Labs/tiny-universal-NER", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "LR-AI-Labs/tiny-universal-NER" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LR-AI-Labs/tiny-universal-NER", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use LR-AI-Labs/tiny-universal-NER with Docker Model Runner:
docker model run hf.co/LR-AI-Labs/tiny-universal-NER
Update README.md
Browse files
README.md
CHANGED
|
@@ -37,7 +37,7 @@ messages = [
|
|
| 37 |
},
|
| 38 |
{
|
| 39 |
"role": "user",
|
| 40 |
-
"content": "Text:
|
| 41 |
},
|
| 42 |
{
|
| 43 |
"role": "assistant",
|
|
@@ -45,7 +45,7 @@ messages = [
|
|
| 45 |
},
|
| 46 |
{
|
| 47 |
"role": "user",
|
| 48 |
-
"content": "What describes
|
| 49 |
}
|
| 50 |
]
|
| 51 |
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
|
@@ -60,7 +60,7 @@ print(outputs[0]["generated_text"])
|
|
| 60 |
# <|user|>
|
| 61 |
# What describes location in the text?</s>
|
| 62 |
# <|assistant|>
|
| 63 |
-
# ["
|
| 64 |
```
|
| 65 |
|
| 66 |
### Note: Inferences are based on one entity type at a time. For multiple entity types, create separate instances for each type.
|
|
|
|
| 37 |
},
|
| 38 |
{
|
| 39 |
"role": "user",
|
| 40 |
+
"content": "Text: VinBigData Joint Stock Company provides platform technology solutions and advanced products based on Big Data and Artificial Intelligence. With a staff of professors, doctors, and global technology experts, VinBigData is currently developing and deploying products such as ViVi virtual assistant, VinBase the comprehensive multi-cognitive artificial intelligence ecosystem, Vizone the ecosystem of smart image analysis solutions, VinDr the medical image digitization platform,..."
|
| 41 |
},
|
| 42 |
{
|
| 43 |
"role": "assistant",
|
|
|
|
| 45 |
},
|
| 46 |
{
|
| 47 |
"role": "user",
|
| 48 |
+
"content": "What describes products in the text?"
|
| 49 |
}
|
| 50 |
]
|
| 51 |
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
|
|
|
| 60 |
# <|user|>
|
| 61 |
# What describes location in the text?</s>
|
| 62 |
# <|assistant|>
|
| 63 |
+
# ["ViVi", "VinBase", "Vizone", "VinDr"]
|
| 64 |
```
|
| 65 |
|
| 66 |
### Note: Inferences are based on one entity type at a time. For multiple entity types, create separate instances for each type.
|