zekun-li's picture
Update README.md
8b80762
|
raw
history blame
6.35 kB
metadata
language:
  - en
thumbnail: url to a thumbnail used in social sharing
tags:
  - toponym detection
  - language model
  - geospatial understanding
  - geolm
license: cc-by-nc-2.0
datasets:
  - GeoWebNews
metrics:
  - f1
pipeline_tag: token-classification
widget:
  - text: >-
      Minneapolis, officially the City of Minneapolis, is a city in the state of
      Minnesota and the county seat of Hennepin County. As of the 2020 census
      the population was  429,954, making it the largest city in Minnesota and
      the 46th-most-populous in the  United States. Nicknamed the "City of
      Lakes", Minneapolis is abundant in water,  with thirteen lakes, wetlands,
      the Mississippi River, creeks, and waterfalls.
  - text: >-
      Los Angeles, often referred to by its initials L.A., is the most populous 
      city in California, the most populous U.S. state. It is the commercial,
      financial,  and cultural center of Southern California. Los Angeles is the
      second-most populous city in the United States after New York City, with a
      population of roughly 3.9  million residents within the city limits as of
      2020.

Model Card for GeoLM model for Toponym Recognition

A language model for detecting toponyms (i.e. place names) from sentences. We pretrain the GeoLM model on world-wide OpenStreetMap (OSM), WikiData and Wikipedia data, then fine-tune it for Toponym Recognition task on GeoWebNews dataset

Model Details

Model Description

Pretrain the GeoLM model on world-wide OpenStreetMap (OSM), WikiData and Wikipedia data, then fine-tune it for Toponym Recognition task on GeoWebNews dataset

Uses

This is a fine-tuned GeoLM model for toponym detection task. The inputs are sentences and outputs are detected toponyms.

To use this model, please refer to the code below.

  • Option 1: Load weights to a BERT model (Same procedure as the demo on the right side panel)

import torch
from transformers import AutoModelForTokenClassification, AutoTokenizer


# Model name from Hugging Face model hub
model_name = "zekun-li/geolm-base-toponym-recognition"

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

# Example input sentence
input_sentence = "Minneapolis, officially the City of Minneapolis, is a city in the state of Minnesota and the county seat of Hennepin County."

# Tokenize input sentence
tokens = tokenizer.encode(input_sentence, return_tensors="pt")

# Pass tokens through the model
outputs = model(tokens) 

# Retrieve predicted labels for each token
predicted_labels = torch.argmax(outputs.logits, dim=2)

predicted_labels = predicted_labels.detach().cpu().numpy()

# Decode predicted labels
predicted_labels = [model.config.id2label[label] for label in predicted_labels[0]]

# Print predicted labels
print(predicted_labels)
# ['O', 'B-Topo', 'O', 'O', 'O', 'O', 'O', 'B-Topo', 'O', 'O', 'O', 'O', 'O', 'O',
# 'O', 'O', 'B-Topo', 'O', 'O', 'O', 'O', 'O', 'B-Topo', 'I-Topo', 'I-Topo', 'O', 'O', 'O']
  • Option 2: Load weights to a GeoLM model

To appear soon

Training Details

Training Data

GeoWebNews (Credit to Gritta et al.)

Download link: https://github.com/milangritta/Pragmatic-Guide-to-Geoparsing-Evaluation/blob/master/data/GWN.xml

Training Procedure

Speeds, Sizes, Times

More information needed

Evaluation

Testing Data & Metrics & Results

Testing Data

More information needed

Metrics

More information needed

Results

More information needed

Technical Specifications [optional]

Model Architecture and Objective

More information needed

Compute Infrastructure

More information needed

Bias, Risks, and Limitations

Significant research has explored bias and fairness issues with language models (see, e.g., Sheng et al. (2021) and Bender et al. (2021)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.

Citation

BibTeX:

More information needed

APA:

More information needed

Model Card Author [optional]