qgyd2021/few_shot_ner_sft
Updated • 391 • 41
How to use qgyd2021/few_shot_ner with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="qgyd2021/few_shot_ner") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("qgyd2021/few_shot_ner")
model = AutoModelForCausalLM.from_pretrained("qgyd2021/few_shot_ner")How to use qgyd2021/few_shot_ner with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "qgyd2021/few_shot_ner"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "qgyd2021/few_shot_ner",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/qgyd2021/few_shot_ner
How to use qgyd2021/few_shot_ner with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "qgyd2021/few_shot_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": "qgyd2021/few_shot_ner",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "qgyd2021/few_shot_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": "qgyd2021/few_shot_ner",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use qgyd2021/few_shot_ner with Docker Model Runner:
docker model run hf.co/qgyd2021/few_shot_ner
此模型是基于 uer/gpt2-chinese-cluecorpussmall 在数据集 qgyd2021/few_shot_ner_sft 上训练的.
可以在此处 qgyd2021/gpt2_chat 体验.
基于此模型或数据集, 你可以:
(1)小样本或零样本的实体识别.
(2)用于实体识别数据集的辅助构建. 即当你在自己的数据集上进行了部分数据标注后, 可以与此数据集混合并训练模型, 之后用于数据自动标注/辅助标注.