Update README.md
Browse files
README.md
CHANGED
@@ -76,6 +76,45 @@ Climate performance model card:
|
|
76 |
- Non-English corpora
|
77 |
- Highly informal or colloquial text
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
## ⚠️ Limitations
|
80 |
|
81 |
- Retains SciBERT’s limitations outside the scientific domain
|
|
|
76 |
- Non-English corpora
|
77 |
- Highly informal or colloquial text
|
78 |
|
79 |
+
Example:
|
80 |
+
``` python
|
81 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM, pipeline
|
82 |
+
import torch
|
83 |
+
|
84 |
+
# Load the pretrained model and tokenizer
|
85 |
+
model_name = "P0L3/clirebert_clirevocab_uncased"
|
86 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
87 |
+
model = AutoModelForMaskedLM.from_pretrained(model_name)
|
88 |
+
|
89 |
+
# Move model to GPU if available
|
90 |
+
device = 0 if torch.cuda.is_available() else -1
|
91 |
+
|
92 |
+
# Create a fill-mask pipeline
|
93 |
+
fill_mask = pipeline("fill-mask", model=model, tokenizer=tokenizer, device=device)
|
94 |
+
|
95 |
+
# Example input from scientific climate literature
|
96 |
+
text = "The increase in greenhouse gas emissions has significantly affected the [MASK] balance of the Earth."
|
97 |
+
|
98 |
+
# Run prediction
|
99 |
+
predictions = fill_mask(text)
|
100 |
+
|
101 |
+
# Show top predictions
|
102 |
+
print(text)
|
103 |
+
print(10*">")
|
104 |
+
for p in predictions:
|
105 |
+
print(f"{p['sequence']} — {p['score']:.4f}")
|
106 |
+
```
|
107 |
+
Output:
|
108 |
+
``` shell
|
109 |
+
The increase in greenhouse gas emissions has significantly affected the [MASK] balance of the Earth.
|
110 |
+
>>>>>>>>>>
|
111 |
+
the increase in greenhouse gas ... affected the energy balance of the earth. — 0.3911
|
112 |
+
the increase in greenhouse gas ... affected the radiative balance of the earth. — 0.2640
|
113 |
+
the increase in greenhouse gas ... affected the radiation balance of the earth. — 0.1233
|
114 |
+
the increase in greenhouse gas ... affected the carbon balance of the earth. — 0.0589
|
115 |
+
the increase in greenhouse gas ... affected the ecological balance of the earth. — 0.0332
|
116 |
+
```
|
117 |
+
|
118 |
## ⚠️ Limitations
|
119 |
|
120 |
- Retains SciBERT’s limitations outside the scientific domain
|