Metadata-Version: 2.4
Name: sled_geo
Version: 0.1.2
Summary: A framework for Scalable Location Encoding via Distillation (SLED)
Home-page: https://github.com/geohai/sled
Author: Kevin Lane
Author-email: kevin.lane@colorado.edu
Keywords: SLED,Remote Sensing,Huggingface
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rshf>=0.2.2
Requires-Dist: torch>=2.12.0
Requires-Dist: lightning>=2.6.5
Requires-Dist: numpy>=2.0
Requires-Dist: einops>=0.8.0
Requires-Dist: huggingface_hub>=0.23.1
Dynamic: license-file

# 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.
    
    
