Instructions to use harpertoken/name with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use harpertoken/name with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="harpertoken/name")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("harpertoken/name") model = AutoModelForTokenClassification.from_pretrained("harpertoken/name", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,87 +1,44 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
-
|
| 4 |
-
- generated_from_trainer
|
| 5 |
-
- token-classification
|
| 6 |
-
- ner
|
| 7 |
-
- nlp
|
| 8 |
-
datasets:
|
| 9 |
-
- conll2003
|
| 10 |
-
language:
|
| 11 |
-
- en
|
| 12 |
-
pipeline_tag: token-classification
|
| 13 |
library_name: transformers
|
|
|
|
| 14 |
base_model: bert-base-uncased
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
name: CoNLL-2003
|
| 23 |
-
type: conll2003
|
| 24 |
-
metrics:
|
| 25 |
-
- name: Validation Loss
|
| 26 |
-
type: loss
|
| 27 |
-
value: 0.0474
|
| 28 |
widget:
|
| 29 |
-
|
| 30 |
---
|
| 31 |
|
| 32 |
-
>
|
| 33 |
-
|
| 34 |
-
# harpertokenNER
|
| 35 |
-
|
| 36 |
-
This model is a fine-tuned version of [bert-base-uncased](https://huggingface.co/bert-base-uncased) on the [CoNLL-2003](https://huggingface.co/datasets/eriktks/conll2003) dataset. It achieves a validation loss of **0.0474** on the evaluation set.
|
| 37 |
-
|
| 38 |
-
## Model Description
|
| 39 |
-
|
| 40 |
-
This is a token classification model fine-tuned for **Named Entity Recognition (NER)** on the CoNLL-2003 dataset, built on the `bert-base-uncased` architecture. It identifies entities like people, organizations, and locations in text. Optimized for CPU use. Uploaded by [harpertoken](https://huggingface.co/harpertoken).
|
| 41 |
-
|
| 42 |
-
## Intended Uses & Limitations
|
| 43 |
-
|
| 44 |
-
### Intended Uses
|
| 45 |
-
- Extracting named entities from unstructured text (e.g., news articles, reports)
|
| 46 |
-
- Powering NLP pipelines on CPU-based systems
|
| 47 |
-
- Research or lightweight production use
|
| 48 |
-
|
| 49 |
-
### Limitations
|
| 50 |
-
- Trained on English text from CoNLL-2003, so it may not generalize well to other languages or domains
|
| 51 |
-
- Uses `bert-base-uncased` tokenization (lowercase-only), potentially missing case-sensitive nuances
|
| 52 |
-
- Optimized for NER; additional tuning needed for other token-classification tasks
|
| 53 |
|
| 54 |
-
#
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
- **learning_rate**: 2e-05
|
| 64 |
-
- **train_batch_size**: 8
|
| 65 |
-
- **eval_batch_size**: 8
|
| 66 |
-
- **seed**: 42
|
| 67 |
-
- **optimizer**: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
| 68 |
-
- **lr_scheduler_type**: linear
|
| 69 |
-
- **lr_scheduler_warmup_steps**: 500
|
| 70 |
-
- **num_epochs**: 3
|
| 71 |
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
| 0.016 | 3.0 | 5268 | 0.0474 |
|
| 79 |
|
| 80 |
-
##
|
| 81 |
|
| 82 |
-
-
|
| 83 |
-
- **PyTorch**: 2.0.1
|
| 84 |
-
- **Datasets**: 1.18.3
|
| 85 |
-
- **Tokenizers**: 0.13.3
|
| 86 |
|
|
|
|
| 87 |
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
language: en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
library_name: transformers
|
| 5 |
+
pipeline_tag: token-classification
|
| 6 |
base_model: bert-base-uncased
|
| 7 |
+
datasets:
|
| 8 |
+
- conll2003
|
| 9 |
+
tags:
|
| 10 |
+
- bert
|
| 11 |
+
- conll2003
|
| 12 |
+
- ner
|
| 13 |
+
- token-classification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
widget:
|
| 15 |
+
- text: "Apple is buying a U.K. startup for $1 billion"
|
| 16 |
---
|
| 17 |
|
| 18 |
+
> Previously published as `harpertoken/harpertokenNER`. The old identifier still redirects here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
# name
|
| 21 |
|
| 22 |
+
A `bert-base-uncased` encoder with a token-classification head, fine-tuned on CoNLL-2003 for named entity recognition. It assigns a label to each token and reports the spans it considers to be people, organisations, locations and miscellaneous entities. Training ran for three epochs at a learning rate of 2e-5 with batch size eight and a linear schedule with 500 warmup steps, reaching a validation loss of 0.0474.
|
| 23 |
|
| 24 |
+
One thing is worth knowing before you use it. The label map in `config.json` is generic — `LABEL_0` through `LABEL_8` — rather than the CoNLL entity names. The nine classes are the CoNLL scheme, and the conventional ordering is `O`, `B-PER`, `I-PER`, `B-ORG`, `I-ORG`, `B-LOC`, `I-LOC`, `B-MISC`, `I-MISC`, but that mapping is not recorded in the repository, so predictions come back as `LABEL_3` rather than `B-ORG`. Anyone relying on `pipeline` output will need to supply their own mapping, and until one is written down the ordering should be treated as unverified.
|
| 25 |
|
| 26 |
+
The repository also carries `pytorch_model.bin` alongside `model.safetensors` with the same parameters, a `training_args.bin`, and a `runs/` directory of TensorBoard event files. None of these are read at inference time.
|
| 27 |
|
| 28 |
+
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
```python
|
| 31 |
+
from transformers import pipeline
|
| 32 |
|
| 33 |
+
ner = pipeline("token-classification", model="harpertoken/name")
|
| 34 |
+
for entity in ner("Apple is buying a U.K. startup for $1 billion"):
|
| 35 |
+
print(entity["word"], entity["entity"])
|
| 36 |
+
```
|
|
|
|
| 37 |
|
| 38 |
+
## Limitations
|
| 39 |
|
| 40 |
+
CoNLL-2003 consists of English newswire from 2003, and entity boundaries in that data reflect contemporary editorial conventions. The model should not be expected to transfer to other languages, to literary or conversational prose, or to domains with unfamiliar entity types, and its results will depend heavily on the unresolved label mapping above. Case is discarded by the uncased vocabulary, which costs it the ability to distinguish `Jordan` the person from `jordan` the country.
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
## Attribution
|
| 43 |
|
| 44 |
+
BERT follows Devlin et al., *BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding* (2019). CoNLL-2003 is described in CoNLL-2003 shared task papers from Nanyeong Bang et al. and Tjong Kim Sang et al.
|