Update README.md
Browse files
README.md
CHANGED
|
@@ -74,6 +74,45 @@ Climate performance model card:
|
|
| 74 |
- Non-scientific general-purpose text
|
| 75 |
- Multilingual applications
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
## ⚠️ Limitations
|
| 78 |
- May reflect scientific publication biases
|
| 79 |
|
|
|
|
| 74 |
- Non-scientific general-purpose text
|
| 75 |
- Multilingual applications
|
| 76 |
|
| 77 |
+
Example:
|
| 78 |
+
``` python
|
| 79 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM, pipeline
|
| 80 |
+
import torch
|
| 81 |
+
|
| 82 |
+
# Load the pretrained model and tokenizer
|
| 83 |
+
model_name = "P0L3/clirebert_clirevocab_uncased"
|
| 84 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 85 |
+
model = AutoModelForMaskedLM.from_pretrained(model_name)
|
| 86 |
+
|
| 87 |
+
# Move model to GPU if available
|
| 88 |
+
device = 0 if torch.cuda.is_available() else -1
|
| 89 |
+
|
| 90 |
+
# Create a fill-mask pipeline
|
| 91 |
+
fill_mask = pipeline("fill-mask", model=model, tokenizer=tokenizer, device=device)
|
| 92 |
+
|
| 93 |
+
# Example input from scientific climate literature
|
| 94 |
+
text = "The increase in greenhouse gas emissions has significantly affected the <mask> balance of the Earth."
|
| 95 |
+
|
| 96 |
+
# Run prediction
|
| 97 |
+
predictions = fill_mask(text)
|
| 98 |
+
|
| 99 |
+
# Show top predictions
|
| 100 |
+
print(text)
|
| 101 |
+
print(10*">")
|
| 102 |
+
for p in predictions:
|
| 103 |
+
print(f"{p['sequence']} — {p['score']:.4f}")
|
| 104 |
+
```
|
| 105 |
+
Output:
|
| 106 |
+
``` shell
|
| 107 |
+
The increase in greenhouse gas emissions has significantly affected the <mask> balance of the Earth.
|
| 108 |
+
>>>>>>>>>>
|
| 109 |
+
The increase in greenhouse gas ... affected the energy balance of the Earth. — 0.7897
|
| 110 |
+
The increase in greenhouse gas ... affected the radiation balance of the Earth. — 0.0522
|
| 111 |
+
The increase in greenhouse gas ... affected the mass balance of the Earth. — 0.0401
|
| 112 |
+
The increase in greenhouse gas ... affected the water balance of the Earth. — 0.0359
|
| 113 |
+
The increase in greenhouse gas ... affected the carbon balance of the Earth. — 0.0190
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
## ⚠️ Limitations
|
| 117 |
- May reflect scientific publication biases
|
| 118 |
|