Skip to main content

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.

Metadata

Release files for sled-geo 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sled-geo 0.1.2
File Size Uploaded
sled_geo-0.1.2.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sled-geo 0.1.2
File Interpreter ABI Platform
sled_geo-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / sled_geo-0.1.2.tar.gz

Download URL sled_geo-0.1.2.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b0ec1f0d28ed4f820cf15feb261dca6e5cf35e9c6ea93e5b7d864f74514d2e6c
BLAKE2b-256 checksum
How to use checksums
f7d1fb8d62595da61253597a744170c51721d4da69a7b6598c991b2ba95ddfca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / sled_geo-0.1.2-py3-none-any.whl

Download URL sled_geo-0.1.2-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7546332590a8be562d2d5efa8299a0a703b291e9fde89b999d0b61a0833fa3a
BLAKE2b-256 checksum
How to use checksums
d69ce193c21877b5a0b5668401e8f88ff99ce9a1670694817ba5f98aef161eec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page