Upload README.md
Browse files
README.md
CHANGED
|
@@ -41,22 +41,20 @@ A language model for detection toponyms (i.e. place names) from sentences. We pr
|
|
| 41 |
- [Model Details](#model-details)
|
| 42 |
- [Model Description](#model-description)
|
| 43 |
- [Uses](#uses)
|
| 44 |
-
- [Bias, Risks, and Limitations](#bias-risks-and-limitations)
|
| 45 |
-
- [Recommendations](#recommendations)
|
| 46 |
- [Training Details](#training-details)
|
| 47 |
- [Training Data](#training-data)
|
| 48 |
- [Training Procedure](#training-procedure)
|
| 49 |
- [Preprocessing](#preprocessing)
|
| 50 |
- [Speeds, Sizes, Times](#speeds-sizes-times)
|
| 51 |
- [Evaluation](#evaluation)
|
| 52 |
-
- [Testing Data,
|
| 53 |
- [Testing Data](#testing-data)
|
| 54 |
-
- [Factors](#factors)
|
| 55 |
- [Metrics](#metrics)
|
| 56 |
-
|
| 57 |
- [Technical Specifications [optional]](#technical-specifications-optional)
|
| 58 |
- [Model Architecture and Objective](#model-architecture-and-objective)
|
| 59 |
- [Compute Infrastructure](#compute-infrastructure)
|
|
|
|
| 60 |
- [Citation](#citation)
|
| 61 |
- [Model Card Authors [optional]](#model-card-authors-optional)
|
| 62 |
- [Model Card Contact](#model-card-contact)
|
|
@@ -82,7 +80,7 @@ Pretrain the GeoLM model on world-wide OpenStreetMap (OSM), WikiData and Wikiped
|
|
| 82 |
# Uses
|
| 83 |
|
| 84 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 85 |
-
This is a fine-tuned GeoLM model for toponym detection task. The inputs are sentences and outputs are detected toponyms.
|
| 86 |
|
| 87 |
|
| 88 |
|
|
@@ -90,17 +88,43 @@ This is a fine-tuned GeoLM model for toponym detection task. The inputs are sent
|
|
| 90 |
<!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
|
| 91 |
|
| 92 |
|
|
|
|
| 93 |
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
|
|
|
|
|
|
|
| 96 |
|
| 97 |
-
#
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
|
|
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
|
|
|
|
|
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
|
| 106 |
# Training Details
|
|
@@ -109,16 +133,14 @@ Significant research has explored bias and fairness issues with language models
|
|
| 109 |
|
| 110 |
<!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
|
| 115 |
## Training Procedure
|
| 116 |
|
| 117 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 118 |
|
| 119 |
-
### Preprocessing
|
| 120 |
|
| 121 |
-
More information needed
|
| 122 |
|
| 123 |
### Speeds, Sizes, Times
|
| 124 |
|
|
@@ -130,7 +152,7 @@ More information needed
|
|
| 130 |
|
| 131 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 132 |
|
| 133 |
-
## Testing Data
|
| 134 |
|
| 135 |
### Testing Data
|
| 136 |
|
|
@@ -139,19 +161,13 @@ More information needed
|
|
| 139 |
More information needed
|
| 140 |
|
| 141 |
|
| 142 |
-
### Factors
|
| 143 |
-
|
| 144 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 145 |
-
|
| 146 |
-
More information needed
|
| 147 |
-
|
| 148 |
### Metrics
|
| 149 |
|
| 150 |
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 151 |
|
| 152 |
More information needed
|
| 153 |
|
| 154 |
-
## Results
|
| 155 |
|
| 156 |
More information needed
|
| 157 |
|
|
@@ -168,6 +184,16 @@ More information needed
|
|
| 168 |
More information needed
|
| 169 |
|
| 170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
# Citation
|
| 172 |
|
| 173 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
|
@@ -182,23 +208,9 @@ More information needed
|
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
-
# Model Card
|
| 186 |
|
| 187 |
<!-- This section provides another layer of transparency and accountability. Whose views is this model card representing? How many voices were included in its construction? Etc. -->
|
| 188 |
|
| 189 |
-
Zekun Li
|
| 190 |
-
|
| 191 |
-
# Model Card Contact
|
| 192 |
-
|
| 193 |
-
li002666[Shift+2]umn.edu
|
| 194 |
-
|
| 195 |
-
# How to Get Started with the Model
|
| 196 |
-
|
| 197 |
-
Use the code below to get started with the model.
|
| 198 |
-
|
| 199 |
-
<details>
|
| 200 |
-
<summary> Click to expand </summary>
|
| 201 |
-
|
| 202 |
-
More information needed
|
| 203 |
|
| 204 |
-
</details>
|
|
|
|
| 41 |
- [Model Details](#model-details)
|
| 42 |
- [Model Description](#model-description)
|
| 43 |
- [Uses](#uses)
|
|
|
|
|
|
|
| 44 |
- [Training Details](#training-details)
|
| 45 |
- [Training Data](#training-data)
|
| 46 |
- [Training Procedure](#training-procedure)
|
| 47 |
- [Preprocessing](#preprocessing)
|
| 48 |
- [Speeds, Sizes, Times](#speeds-sizes-times)
|
| 49 |
- [Evaluation](#evaluation)
|
| 50 |
+
- [Testing Data, Metrics & Results](#testing-data-factors--metrics)
|
| 51 |
- [Testing Data](#testing-data)
|
|
|
|
| 52 |
- [Metrics](#metrics)
|
| 53 |
+
- [Results](#results)
|
| 54 |
- [Technical Specifications [optional]](#technical-specifications-optional)
|
| 55 |
- [Model Architecture and Objective](#model-architecture-and-objective)
|
| 56 |
- [Compute Infrastructure](#compute-infrastructure)
|
| 57 |
+
- [Bias, Risks, and Limitations](#bias-risks-and-limitations)
|
| 58 |
- [Citation](#citation)
|
| 59 |
- [Model Card Authors [optional]](#model-card-authors-optional)
|
| 60 |
- [Model Card Contact](#model-card-contact)
|
|
|
|
| 80 |
# Uses
|
| 81 |
|
| 82 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 83 |
+
This is a fine-tuned GeoLM model for toponym detection task. The inputs are sentences and outputs are detected toponyms.
|
| 84 |
|
| 85 |
|
| 86 |
|
|
|
|
| 88 |
<!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
|
| 89 |
|
| 90 |
|
| 91 |
+
To use this model, please refer to the code below.
|
| 92 |
|
| 93 |
+
* Option 1: Load weights to a BERT model (Same procedure as the demo on the right side panel)
|
| 94 |
+
```import torch
|
| 95 |
+
from transformers import AutoModelForTokenClassification, AutoTokenizer
|
| 96 |
|
| 97 |
|
| 98 |
+
# Model name from Hugging Face model hub
|
| 99 |
+
model_name = "zekun-li/geolm-base-toponym-recognition"
|
| 100 |
|
| 101 |
+
# Load tokenizer and model
|
| 102 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 103 |
+
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 104 |
|
| 105 |
+
# Example input sentence
|
| 106 |
+
input_sentence = "Minneapolis, officially the City of Minneapolis, is a city in the state of Minnesota and the county seat of Hennepin County."
|
| 107 |
|
| 108 |
+
# Tokenize input sentence
|
| 109 |
+
tokens = tokenizer.encode(input_sentence, truncation=True, padding=True, return_tensors="pt")
|
| 110 |
+
|
| 111 |
+
# Pass tokens through the model
|
| 112 |
+
outputs = model(tokens)
|
| 113 |
+
|
| 114 |
+
# Retrieve predicted labels for each token
|
| 115 |
+
predicted_labels = torch.argmax(outputs.logits, dim=2)
|
| 116 |
+
|
| 117 |
+
predicted_labels = predicted_labels.detach().cpu().numpy()
|
| 118 |
|
| 119 |
+
# Decode predicted labels
|
| 120 |
+
predicted_labels = [model.config.id2label[label] for label in predicted_labels[0]]
|
| 121 |
|
| 122 |
+
# Print predicted labels
|
| 123 |
+
print(predicted_labels)
|
| 124 |
+
```
|
| 125 |
+
* Option 2: Load weights to a GeoLM model
|
| 126 |
+
|
| 127 |
+
To appear soon
|
| 128 |
|
| 129 |
|
| 130 |
# Training Details
|
|
|
|
| 133 |
|
| 134 |
<!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 135 |
|
| 136 |
+
GeoWebNews (Credit to Gritta et al.)
|
| 137 |
+
Download link: https://github.com/milangritta/Pragmatic-Guide-to-Geoparsing-Evaluation/blob/master/data/GWN.xml
|
| 138 |
|
| 139 |
## Training Procedure
|
| 140 |
|
| 141 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 142 |
|
|
|
|
| 143 |
|
|
|
|
| 144 |
|
| 145 |
### Speeds, Sizes, Times
|
| 146 |
|
|
|
|
| 152 |
|
| 153 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 154 |
|
| 155 |
+
## Testing Data & Metrics & Results
|
| 156 |
|
| 157 |
### Testing Data
|
| 158 |
|
|
|
|
| 161 |
More information needed
|
| 162 |
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
### Metrics
|
| 165 |
|
| 166 |
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 167 |
|
| 168 |
More information needed
|
| 169 |
|
| 170 |
+
### Results
|
| 171 |
|
| 172 |
More information needed
|
| 173 |
|
|
|
|
| 184 |
More information needed
|
| 185 |
|
| 186 |
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
# Bias, Risks, and Limitations
|
| 190 |
+
|
| 191 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 192 |
+
|
| 193 |
+
Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
|
| 197 |
# Citation
|
| 198 |
|
| 199 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
|
|
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
+
# Model Card Author [optional]
|
| 212 |
|
| 213 |
<!-- This section provides another layer of transparency and accountability. Whose views is this model card representing? How many voices were included in its construction? Etc. -->
|
| 214 |
|
| 215 |
+
Zekun Li (li002666[Shift+2]umn.edu)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
|
|