Skip to main content

A framework for Sclable Location Encoding via Distillation (SLED)

Project description

Scalable Location Encoding via Distillation (SLED)

This module is designed for two primary purposes:

  • Accessing location encoders that have been pre-trained with the SLED framework
  • Pre-training your own location encoders with the SLED framework

This repository directly references the work available in this paper: LINK

This module can be downloaded via pip

python3 -m pip install sled_geo

Accessing pre-trained SLED location encoders

You can get your own pre-trained SLED location encoder by doing the following:

from sled_geo import get_encoder

my_sled_model = get_encoder.get_rff_encoder(embed_dim=768)
my_sled_model.from_pretrained("geohai/sled-rff-s12+ls")
new_york_location = torch.tensor([[-73.935242, 40.730610]]) #lon,lat
my_sled_model(new_york_location) #returns a tensor of [1, 768] shape

All pre-trained versions of SLED can be found here: LINK.

Each version specifies the type of location encoder used, the number of embedding dimensions, and the modalities trained on.

Training your own location encoder with SLED

The model.py class contains a pytorch lightning module for distilling a multi-modal location encoder. While we make several location encoder options available in the get_encoder file, users are welcome to plug in their own. Any torch.nn.Module that takes in input in the form of (lon, lat) then returns an embedding of some size is valid.

Users are also welcome to specify what teacher encoder they would like per modality. Any torch.nn.Module will suffice, so long as it matches the input shape of your dataset. All teacher encoders are frozen during pre-training. In the event of distilling against pre-trained embeddings, set the encoder for that mode to None.

Sample code for training with SLED can be found in the sample.iypnb file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sled_geo-0.1.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sled_geo-0.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file sled_geo-0.1.1.tar.gz.

File metadata

  • Download URL: sled_geo-0.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for sled_geo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 802887f77b95af4a697700d6f02a188891bf579f82f6c80df0774da35dc0b247
MD5 389ddb1b6ac22a3b56e4631a741e7c0a
BLAKE2b-256 5b2d3b073dbf8b3fdfd5161d8a07904585e920e7214dc8432295a5ffc95eab3d

See more details on using hashes here.

File details

Details for the file sled_geo-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sled_geo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for sled_geo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f222b02fa63ef01cec8de6bd9b79fe082c4e7a21feb0cacce9edda94b26bbff
MD5 1c725c171614eaa3531f437b979be877
BLAKE2b-256 71149ceb6cee811a1c55cdfb90827950286dc81d2f58c5bbb9722f33dc232fa8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page