Instructions to use lfoppiano/MatTPUSciBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lfoppiano/MatTPUSciBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="lfoppiano/MatTPUSciBERT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("lfoppiano/MatTPUSciBERT") model = AutoModelForMaskedLM.from_pretrained("lfoppiano/MatTPUSciBERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add HF card metadata; fix duplicate metrics row; polish
#2
by lfoppiano - opened
README.md
CHANGED
|
@@ -1,22 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Material SciBERT (TPU): Improving language understanding in materials science
|
| 2 |
|
| 3 |
**Work in progress**
|
| 4 |
|
| 5 |
-
## Introduction
|
| 6 |
-
SciBERT-based model pre-trained with materials
|
| 7 |
|
| 8 |
## Authors
|
| 9 |
Luca Foppiano
|
| 10 |
Pedro Ortiz Suarez
|
| 11 |
|
| 12 |
## TLDR
|
| 13 |
-
- Collected full
|
| 14 |
-
- We added to the SciBERT vocabulary (32k tokens)
|
| 15 |
-
- Starting conditions: original SciBERT weights
|
| 16 |
-
- Pre-
|
| 17 |
-
-
|
| 18 |
-
-
|
| 19 |
-
- Fine-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## Related work
|
| 22 |
|
|
@@ -26,14 +51,14 @@ Pedro Ortiz Suarez
|
|
| 26 |
|
| 27 |
### Relevant models
|
| 28 |
- SciBERT: BERT, from scratch, scientific articles (biology + CS) https://github.com/allenai/scibert
|
| 29 |
-
- MatSciBERT (Gupta): RoBERTa, from scratch, SciBERT vocab and weights, ~150 K
|
| 30 |
- MaterialBERT: Not yet published
|
| 31 |
-
- MatBERT (CEDER): BERT, from scratch, 2M documents on materials science
|
| 32 |
- BatteryBERT (Cole): BERT, mixed from scratch and with predefined weights https://github.com/ShuHuang/batterybert/
|
| 33 |
|
| 34 |
-
### Results
|
| 35 |
|
| 36 |
-
Results obtained via 10-fold cross-validation, using DeLFT (https://github.com/kermitt2/delft)
|
| 37 |
|
| 38 |
#### NER Superconductors
|
| 39 |
|
|
@@ -54,13 +79,11 @@ Results obtained via 10-fold cross-validation, using DeLFT (https://github.com/k
|
|
| 54 |
| MatTPUSciBERT | 88.62% | 86.33% | 87.46% |
|
| 55 |
| MatBERT (Ceder) | 85.08% | 89.93% | 87.44% |
|
| 56 |
| BatteryScibert-cased | 85.02% | 89.30% | 87.11% |
|
| 57 |
-
| BatteryScibert-cased | 81.09% | 84.14% | 82.59% |
|
| 58 |
-
|
| 59 |
|
| 60 |
## References
|
| 61 |
|
| 62 |
-
This work was supported by Google, through the researchers program https://cloud.google.com/edu/researchers
|
| 63 |
|
| 64 |
## Acknowledgements
|
| 65 |
|
| 66 |
-
TBA
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
pipeline_tag: fill-mask
|
| 4 |
+
tags:
|
| 5 |
+
- materials-science
|
| 6 |
+
- science
|
| 7 |
+
- bert
|
| 8 |
+
- fill-mask
|
| 9 |
+
- scientific-text
|
| 10 |
+
base_model: allenai/scibert_scivocab_cased
|
| 11 |
+
# TODO: set an explicit `license:` (the repo currently declares none).
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
# Material SciBERT (TPU): Improving language understanding in materials science
|
| 15 |
|
| 16 |
**Work in progress**
|
| 17 |
|
| 18 |
+
## Introduction
|
| 19 |
+
SciBERT-based model pre-trained with materials-science scientific full text.
|
| 20 |
|
| 21 |
## Authors
|
| 22 |
Luca Foppiano
|
| 23 |
Pedro Ortiz Suarez
|
| 24 |
|
| 25 |
## TLDR
|
| 26 |
+
- Collected full text from ~700,000 articles provided by the National Institute for Materials Science (NIMS) TDM platform (https://dice.nims.go.jp/services/TDM-PF/en/), a dataset called ScienceCorpus (SciCorpus)
|
| 27 |
+
- We added to the SciBERT vocabulary (32k tokens) 100 domain-specific unknown words extracted from SciCorpus with a keyword modeller (KeyBERT)
|
| 28 |
+
- Starting conditions: original SciBERT weights
|
| 29 |
+
- Pre-trained the MatTPUSciBERT model on Google Cloud with a TPU (Tensor Processing Unit) as follows:
|
| 30 |
+
- 800,000 steps with batch_size 256, max_seq_length 512
|
| 31 |
+
- 100,000 steps with batch_size 2048, max_seq_length 128
|
| 32 |
+
- Fine-tuned and tested on NER for superconductors (https://github.com/lfoppiano/grobid-superconductors) and physical quantities (https://github.com/kermitt2/grobid-quantities)
|
| 33 |
+
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
| 38 |
+
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained("lfoppiano/MatTPUSciBERT")
|
| 40 |
+
model = AutoModelForMaskedLM.from_pretrained("lfoppiano/MatTPUSciBERT")
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
The repository ships both PyTorch (`pytorch_model.bin`, `model.safetensors`) and the original
|
| 44 |
+
TensorFlow checkpoint (`bert_model.ckpt.*`).
|
| 45 |
|
| 46 |
## Related work
|
| 47 |
|
|
|
|
| 51 |
|
| 52 |
### Relevant models
|
| 53 |
- SciBERT: BERT, from scratch, scientific articles (biology + CS) https://github.com/allenai/scibert
|
| 54 |
+
- MatSciBERT (Gupta): RoBERTa, from scratch, SciBERT vocab and weights, ~150 K papers limited to 4 MS families http://github.com/m3rg-iitd/matscibert
|
| 55 |
- MaterialBERT: Not yet published
|
| 56 |
+
- MatBERT (CEDER): BERT, from scratch, 2M documents on materials science (~60M paragraphs) https://github.com/lbnlp/MatBERT
|
| 57 |
- BatteryBERT (Cole): BERT, mixed from scratch and with predefined weights https://github.com/ShuHuang/batterybert/
|
| 58 |
|
| 59 |
+
### Results
|
| 60 |
|
| 61 |
+
Results obtained via 10-fold cross-validation, using DeLFT (https://github.com/kermitt2/delft).
|
| 62 |
|
| 63 |
#### NER Superconductors
|
| 64 |
|
|
|
|
| 79 |
| MatTPUSciBERT | 88.62% | 86.33% | 87.46% |
|
| 80 |
| MatBERT (Ceder) | 85.08% | 89.93% | 87.44% |
|
| 81 |
| BatteryScibert-cased | 85.02% | 89.30% | 87.11% |
|
|
|
|
|
|
|
| 82 |
|
| 83 |
## References
|
| 84 |
|
| 85 |
+
This work was supported by Google, through the researchers program https://cloud.google.com/edu/researchers
|
| 86 |
|
| 87 |
## Acknowledgements
|
| 88 |
|
| 89 |
+
TBA
|