Source code for "De-Biased Representation Learning for Long-tailed PEFT in Remote Sensing".
Clone the repository
git clone https://github.com/doem97/deblora.gitThe folder structure should be like:
./
|-- data
|-- exp
|-- output
|-- scripts
|-- src
|-- .gitignore
`-- README.md
Please download datasets with huggingface-cli script and symbol link to ./data folder. See Datasets Documentation for more details.
To set up the deblora environment, follow these steps:
-
Create a new conda environment (recommended):
conda create -n deblora python=3.8 conda activate deblora -
Install the required packages using pip:
pip install -r requirements.txt
Feature extraction for 0 Shot, Fine-tuned, and LoRA:
# feature extraction for 0 shot and fine-tuned
bash ./exp/extract_0shot_feat.sh
bash ./exp/extract_finetune_feat.sh
# feature extraction for LoRA (feature calibration source for pLoRA)
bash ./exp/extract_lora_feat.shFor easy re-produce, we also provided the ready-to-use extracted features (download links in hf_features.sh). You could directly download the 0shot/fine-tuned/LoRA/pLoRA features by executing the script.
Linear probing for 0 Shot:
bash ./exp/0shot_linprob.shLinear probing for Fine-tuned:
bash ./exp/ft_linprob.shLinear probing for LoRA:
bash ./exp/lora_linprob.shFeature clustering and calibration for pLoRA:
bash ./exp/feat_cluster_lora_kmeans.shLinear probing for pLoRA:
bash ./exp/plora_linprob.shPlease note that the current code may be poorly organized and is in separate modules. The remaining CLIP code and data will be released in our upcoming work Meta-LoRA (https://github.com/doem97/metalora) with more streamlined pipelines. Please do not hesitate to raise repo issues if you have problems.