Instructions to use microsoft/BiomedVLP-CXR-BERT-specialized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/BiomedVLP-CXR-BERT-specialized with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="microsoft/BiomedVLP-CXR-BERT-specialized", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("microsoft/BiomedVLP-CXR-BERT-specialized", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Ozan Oktay commited on
Commit ·
0fdcbd3
1
Parent(s): 8d4d877
add tokenizer
Browse files- configuration_cxrbert.py +7 -1
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.txt +0 -0
configuration_cxrbert.py
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
|
| 6 |
from typing import Any
|
| 7 |
|
| 8 |
-
from transformers import BertConfig
|
| 9 |
|
| 10 |
|
| 11 |
class CXRBertConfig(BertConfig):
|
|
@@ -19,3 +19,9 @@ class CXRBertConfig(BertConfig):
|
|
| 19 |
def __init__(self, projection_size: int = 128, **kwargs: Any) -> None:
|
| 20 |
super().__init__(**kwargs)
|
| 21 |
self.projection_size = projection_size
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
from typing import Any
|
| 7 |
|
| 8 |
+
from transformers import BertConfig, BertTokenizer
|
| 9 |
|
| 10 |
|
| 11 |
class CXRBertConfig(BertConfig):
|
|
|
|
| 19 |
def __init__(self, projection_size: int = 128, **kwargs: Any) -> None:
|
| 20 |
super().__init__(**kwargs)
|
| 21 |
self.projection_size = projection_size
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class CXRBertTokenizer(BertTokenizer):
|
| 25 |
+
def __init__(self, **kwargs: Any) -> None:
|
| 26 |
+
super().__init__(**kwargs)
|
| 27 |
+
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"do_lower_case": true, "do_basic_tokenize": true, "never_split": null, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "name_or_path": "/tmp/hf_demo_may_11th", "special_tokens_map_file": "/mnt/batch/tasks/shared/LS_root/jobs/innereye4ws/azureml/jcxr_1645574625_747e8d7b/wd/azureml/JCXR_1645574625_747e8d7b/pretrained_models/pretrained_bert_models/pubmed_mimic_bert_base/special_tokens_map.json", "tokenizer_file": null, "tokenizer_class": "CXRBertTokenizer", "auto_map": {"AutoTokenizer": ["configuration_cxrbert.CXRBertTokenizer", null]}}
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|