Instructions to use BiomedicalEvidencePlatform/pico-extractor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BiomedicalEvidencePlatform/pico-extractor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="BiomedicalEvidencePlatform/pico-extractor")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("BiomedicalEvidencePlatform/pico-extractor") model = AutoModelForTokenClassification.from_pretrained("BiomedicalEvidencePlatform/pico-extractor", device_map="auto") - MLX
How to use BiomedicalEvidencePlatform/pico-extractor with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download BiomedicalEvidencePlatform/pico-extractor --local-dir pico-extractor
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
v1.0.0: convert zuzab/pico-extractor@ed4df86
Browse files- README.md +73 -0
- config.json +53 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +21 -0
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: zuzab/pico-extractor
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: token-classification
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- mlx
|
| 10 |
+
- safetensors
|
| 11 |
+
- fp16
|
| 12 |
+
- biomedical
|
| 13 |
+
- pico
|
| 14 |
+
- ner
|
| 15 |
+
- bert
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# pico-extractor
|
| 19 |
+
|
| 20 |
+
BIO token classifier tagging PICO elements (Population, Intervention, Comparator, Outcome) in clinical-trial abstracts; used by Mineris for PICO span extraction.
|
| 21 |
+
|
| 22 |
+
This is a **format conversion** of [`zuzab/pico-extractor`](https://huggingface.co/zuzab/pico-extractor)
|
| 23 |
+
for Mineris' MLX inference stack (`mineris_inference`) — not a fine-tune. Weights are
|
| 24 |
+
the full upstream `BertForTokenClassification` (encoder + classification head) cast to fp16 and stored as `model.safetensors`; a
|
| 25 |
+
`tokenizer.json` is included so the model loads without `transformers` or `torch`.
|
| 26 |
+
|
| 27 |
+
## Labels
|
| 28 |
+
|
| 29 |
+
| id | label |
|
| 30 |
+
|---|---|
|
| 31 |
+
| 0 | `O` |
|
| 32 |
+
| 1 | `B-P` |
|
| 33 |
+
| 2 | `B-I` |
|
| 34 |
+
| 3 | `B-C` |
|
| 35 |
+
| 4 | `B-O` |
|
| 36 |
+
| 5 | `I-P` |
|
| 37 |
+
| 6 | `I-I` |
|
| 38 |
+
| 7 | `I-C` |
|
| 39 |
+
| 8 | `I-O` |
|
| 40 |
+
|
| 41 |
+
## Provenance
|
| 42 |
+
|
| 43 |
+
| | |
|
| 44 |
+
|---|---|
|
| 45 |
+
| Upstream repo | [`zuzab/pico-extractor`](https://huggingface.co/zuzab/pico-extractor) |
|
| 46 |
+
| Upstream commit | `ed4df86e482d9c53d953791a71c15caa5a687d96` |
|
| 47 |
+
| License | `apache-2.0` (declared by Mineris, the upstream owner) |
|
| 48 |
+
| Conversion notebook | `notebook/notebooks/converter/convert_pico_extractor.ipynb` (mineris repo) |
|
| 49 |
+
| Mineris commit | `9817fe7bbeb2a4b23fd683144a28a5843af94af9` |
|
| 50 |
+
| Version | `v1.0.0` |
|
| 51 |
+
| dtype | fp16 |
|
| 52 |
+
| Tensors / size | 199 / 215.3 MB |
|
| 53 |
+
|
| 54 |
+
## Conversion parity (fp16 mirror vs fp32 upstream, PyTorch)
|
| 55 |
+
|
| 56 |
+
| Metric | Value |
|
| 57 |
+
|---|---|
|
| 58 |
+
| Texts | 18 |
|
| 59 |
+
| Tokenizer id mismatches (`tokenizer.json` via `tokenizers` vs upstream tokenizer) | 0 |
|
| 60 |
+
| Token argmax label agreement, per text — min / mean | 1.000000 / 1.000000 |
|
| 61 |
+
| Logits, non-padding tokens — max abs diff / median relative diff | 9.82e-03 / 5.09e-04 |
|
| 62 |
+
| Threshold (min token argmax label agreement) | 0.995 |
|
| 63 |
+
|
| 64 |
+
MLX-runtime parity is tracked separately in the mineris `notebook/notebooks/benchmark/` notebooks.
|
| 65 |
+
|
| 66 |
+
## Versioning
|
| 67 |
+
|
| 68 |
+
Releases are semver git tags on this repo (`vMAJOR.MINOR.PATCH`); consumers pin a tag. MAJOR =
|
| 69 |
+
output-incompatible change, MINOR = compatible re-conversion, PATCH = card/metadata only.
|
| 70 |
+
|
| 71 |
+
## CHANGELOG
|
| 72 |
+
|
| 73 |
+
- `v1.0.0` — initial conversion from `zuzab/pico-extractor@ed4df86`.
|
config.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertForTokenClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": null,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_dropout_prob": 0.1,
|
| 14 |
+
"hidden_size": 768,
|
| 15 |
+
"id2label": {
|
| 16 |
+
"0": "O",
|
| 17 |
+
"1": "B-P",
|
| 18 |
+
"2": "B-I",
|
| 19 |
+
"3": "B-C",
|
| 20 |
+
"4": "B-O",
|
| 21 |
+
"5": "I-P",
|
| 22 |
+
"6": "I-I",
|
| 23 |
+
"7": "I-C",
|
| 24 |
+
"8": "I-O"
|
| 25 |
+
},
|
| 26 |
+
"initializer_range": 0.02,
|
| 27 |
+
"intermediate_size": 3072,
|
| 28 |
+
"is_decoder": false,
|
| 29 |
+
"label2id": {
|
| 30 |
+
"B-C": 3,
|
| 31 |
+
"B-I": 2,
|
| 32 |
+
"B-O": 4,
|
| 33 |
+
"B-P": 1,
|
| 34 |
+
"I-C": 7,
|
| 35 |
+
"I-I": 6,
|
| 36 |
+
"I-O": 8,
|
| 37 |
+
"I-P": 5,
|
| 38 |
+
"O": 0
|
| 39 |
+
},
|
| 40 |
+
"layer_norm_eps": 1e-12,
|
| 41 |
+
"max_position_embeddings": 512,
|
| 42 |
+
"model_type": "bert",
|
| 43 |
+
"num_attention_heads": 12,
|
| 44 |
+
"num_hidden_layers": 12,
|
| 45 |
+
"pad_token_id": 0,
|
| 46 |
+
"position_embedding_type": "absolute",
|
| 47 |
+
"tie_word_embeddings": true,
|
| 48 |
+
"transformers_version": "5.5.0",
|
| 49 |
+
"type_vocab_size": 2,
|
| 50 |
+
"use_cache": false,
|
| 51 |
+
"vocab_size": 28895,
|
| 52 |
+
"torch_dtype": "float16"
|
| 53 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7ec14a22bad28f1e13c6f6348b33a13fd9601b808f78aa6dcd6b8e001ce2deff
|
| 3 |
+
size 215321290
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"do_basic_tokenize": true,
|
| 5 |
+
"do_lower_case": true,
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"local_files_only": false,
|
| 8 |
+
"mask_token": "[MASK]",
|
| 9 |
+
"max_length": 512,
|
| 10 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 11 |
+
"never_split": null,
|
| 12 |
+
"pad_token": "[PAD]",
|
| 13 |
+
"sep_token": "[SEP]",
|
| 14 |
+
"stride": 0,
|
| 15 |
+
"strip_accents": null,
|
| 16 |
+
"tokenize_chinese_chars": true,
|
| 17 |
+
"tokenizer_class": "BertTokenizer",
|
| 18 |
+
"truncation_side": "right",
|
| 19 |
+
"truncation_strategy": "longest_first",
|
| 20 |
+
"unk_token": "[UNK]"
|
| 21 |
+
}
|