Downloads · 30 days
20
65% of all-time downloads
lujin/search-ner-lora-model
search-ner-lora-model is a token classification model from lujin. Use it when you need labels on individual words, such as names. It is set up for transformers.
这是一个使用 LoRA (Low-Rank Adaptation) 技术微调的中文命名实体识别 (NER) 模型。
Downloads · 30 days
20
65% of all-time downloads
All-time downloads
31
Public
Parameters
102M
407 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors407 MB · 100%
From the Hugging Face model README
这是一个使用 LoRA (Low-Rank Adaptation) 技术微调的中文命名实体识别 (NER) 模型。
uer/roberta-base-finetuned-cluener2020-chineser: 8lora_alpha: 16lora_dropout: 0.1您可以使用 Hugging Face Transformers 库加载和使用此模型进行推理:
from transformers import AutoModelForTokenClassification,AutoTokenizer,pipeline
model = AutoModelForTokenClassification.from_pretrained('lujin/search-ner-lora-model')
tokenizer = AutoTokenizer.from_pretrained('lujin/search-ner-lora-model')
ner_pipe = pipeline(
"token-classification",
model=model,
tokenizer=tokenizer,
aggregation_strategy="simple",
device=0 if torch.cuda.is_available() else -1
)
# 示例文本
text = "对比 MacBook Pro 和 MacBook Air"
predictions = ner_pipe(text)
for entity in predictions:
print(f"实体: {entity['word']}, 标签: {entity['entity_group']}, 置信度: {entity['score']:.4f}")
text = "明天在北京故宫博物院举行长城文化论坛"
predictions = ner_pipe(text)
for entity in predictions:
print(f"实体: {entity['word']}, 标签: {entity['entity_group']}, 置信度: {entity['score']:.4f}")
此模型在训练时使用的私有数据集上表现良好。在其他领域或特定语料上可能需要进一步微调。