Skip to main content

A framework for Scalable 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-s2-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: https://huggingface.co/geohai.

Each version specifies the type of location encoder used, teacher encoders, 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.ipypnb 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.2.tar.gz (12.2 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.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sled_geo-0.1.2.tar.gz
  • Upload date:
  • Size: 12.2 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.2.tar.gz
Algorithm Hash digest
SHA256 b0ec1f0d28ed4f820cf15feb261dca6e5cf35e9c6ea93e5b7d864f74514d2e6c
MD5 5ee1d150f8b6cbd9ea5750dc7c173737
BLAKE2b-256 f7d1fb8d62595da61253597a744170c51721d4da69a7b6598c991b2ba95ddfca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sled_geo-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b7546332590a8be562d2d5efa8299a0a703b291e9fde89b999d0b61a0833fa3a
MD5 d7e867a7eae9fcf0f84a8aad262b4c6d
BLAKE2b-256 d69ce193c21877b5a0b5668401e8f88ff99ce9a1670694817ba5f98aef161eec

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