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
Accessing pre-trained SLED location encoders
You can get your own pre-trained SLED location encoder by doing the following:
from sled 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sled_geo-0.1.0.tar.gz.
File metadata
- Download URL: sled_geo-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b83b06abc14820e3b5fc4f3cdd12b7af5e322f6ac00f649021c2427db83dbe5
|
|
| MD5 |
44babfaa0f715f8c315eb8975044c4e8
|
|
| BLAKE2b-256 |
9a9979b82836331038d9ae729859f4fe45529ce942f4f2b71617bdbe8e3d55b4
|
File details
Details for the file sled_geo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sled_geo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e443d55e7a25fee47e08ccbfa1b1f3b5b1b1570758b8c2f616665804a459f43b
|
|
| MD5 |
19a6d33539dd5eb6e6da8ef466fa4882
|
|
| BLAKE2b-256 |
b0e1cf5ceba14e3eb9e015ccc47b30e94fbf7f0c84f479c3b85c404fdd9e0277
|