From d72ff835fba8acd673ec6e47b6a0ef476612eef7 Mon Sep 17 00:00:00 2001 From: tanmayshishodia Date: Sun, 4 Aug 2024 09:56:11 +0530 Subject: [PATCH] keep only a single bash script --- peft/fft.sh | 22 ---------------------- peft/finetune.py | 14 ++++++++------ peft/{dora.sh => finetune.sh} | 11 ++++++++--- peft/linear_probing.sh | 23 ----------------------- peft/lora.sh | 25 ------------------------- 5 files changed, 16 insertions(+), 79 deletions(-) delete mode 100644 peft/fft.sh rename peft/{dora.sh => finetune.sh} (65%) delete mode 100644 peft/linear_probing.sh delete mode 100644 peft/lora.sh diff --git a/peft/fft.sh b/peft/fft.sh deleted file mode 100644 index ed2eb5e..0000000 --- a/peft/fft.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -export TF_CPP_MIN_LOG_LEVEL=2 XLA_PYTHON_CLIENT_PREALLOCATE=false - -python3 finetune.py \ - --model-name="google/timesfm-1.0-200m" \ - --backend="gpu" \ - --horizon-len=128 \ - --context-len=512 \ - --freq="15min" \ - --data-path="../datasets/ETT-small/ETTm1.csv" \ - --num-epochs=1 \ - --learning-rate=1e-3 \ - --adam-epsilon=1e-7 \ - --adam-clip-threshold=1e2 \ - --early-stop-patience=10 \ - --datetime-col="date" \ - --boundaries=34560 46080 57600 \ - --cos-initial-decay-value=1e-4 \ - --cos-decay-steps=40000 \ - --cos-final-decay-value=1e-5 \ - --ema-decay=0.9999 \ No newline at end of file diff --git a/peft/finetune.py b/peft/finetune.py index 09afa38..84c59f9 100644 --- a/peft/finetune.py +++ b/peft/finetune.py @@ -62,12 +62,12 @@ RANDOM_SEED = 1234 def finetune( *, - checkpoint_path: Annotated[ - str, typer.Option(help="The path to the model checkpoint.") - ] = None, model_name: Annotated[ str, typer.Option(help="Specify the name of the huggingface model.") ] = "google/timesfm-1.0-200m", + checkpoint_path: Annotated[ + str, typer.Option(help="The path to the local model checkpoint.") + ] = None, datetime_col: Annotated[str, typer.Option(help="Column having datetime.")] = "ds", ts_cols: Annotated[ list[str], typer.Option(help="Columns of time-series features.") @@ -115,7 +115,7 @@ def finetune( use_lora: Annotated[ bool, typer.Option( - help="Train low rank adapters. Freeze all other params in model", + help="Train low rank adapters for stacked transformer block", ), ] = False, lora_rank: Annotated[ @@ -126,7 +126,9 @@ def finetune( ] = 8, lora_target_modules: Annotated[ str, - typer.Option(help="LoRA target modules. Allowed values: [all, attention, mlp]"), + typer.Option( + help="LoRA target modules of the transformer block. Allowed values: [all, attention, mlp]" + ), ] = "all", use_dora: Annotated[ bool, @@ -137,7 +139,7 @@ def finetune( use_linear_probing: Annotated[ bool, typer.Option( - help="Linear Probing. Train only input/output and embedding params. Freeze params in self attention modules.", + help="Linear Probing. Train only input/output and embedding params. Freeze params in stack transformer block.", ), ] = False, checkpoint_dir: Annotated[ diff --git a/peft/dora.sh b/peft/finetune.sh similarity index 65% rename from peft/dora.sh rename to peft/finetune.sh index f01d876..3ada1c3 100644 --- a/peft/dora.sh +++ b/peft/finetune.sh @@ -1,10 +1,13 @@ #!/bin/bash +# Script to finetune a model with specific configurations +# Adjust the parameters below as needed. For a full list of options and descriptions, run the script with the --help flag. + export TF_CPP_MIN_LOG_LEVEL=2 XLA_PYTHON_CLIENT_PREALLOCATE=false python3 finetune.py \ --model-name="google/timesfm-1.0-200m" \ - --backend="gpu" \ + --backend="cpu" \ --horizon-len=128 \ --context-len=512 \ --freq="15min" \ @@ -15,7 +18,6 @@ python3 finetune.py \ --adam-clip-threshold=1e2 \ --early-stop-patience=10 \ --datetime-col="date" \ - --boundaries=34560 46080 57600 \ --use-lora \ --lora-rank=1 \ --lora-target-modules="all" \ @@ -23,4 +25,7 @@ python3 finetune.py \ --cos-initial-decay-value=1e-4 \ --cos-decay-steps=40000 \ --cos-final-decay-value=1e-5 \ - --ema-decay=0.9999 \ No newline at end of file + --ema-decay=0.9999 + +# To see all available options and their descriptions, use the --help flag +# python3 finetune.py --help diff --git a/peft/linear_probing.sh b/peft/linear_probing.sh deleted file mode 100644 index c46ee79..0000000 --- a/peft/linear_probing.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -export TF_CPP_MIN_LOG_LEVEL=2 XLA_PYTHON_CLIENT_PREALLOCATE=false - -python3 finetune.py \ - --model-name="google/timesfm-1.0-200m" \ - --backend="gpu" \ - --horizon-len=128 \ - --context-len=512 \ - --freq="15min" \ - --data-path="../datasets/ETT-small/ETTm1.csv" \ - --num-epochs=100 \ - --learning-rate=1e-2 \ - --adam-epsilon=1e-7 \ - --adam-clip-threshold=1e2 \ - --early-stop-patience=10 \ - --datetime-col="date" \ - --boundaries=1000 46080 57600 \ - --use-linear-probing \ - --cos-initial-decay-value=1e-4 \ - --cos-decay-steps=40000 \ - --cos-final-decay-value=1e-5 \ - --ema-decay=0.9999 \ No newline at end of file diff --git a/peft/lora.sh b/peft/lora.sh deleted file mode 100644 index 6927deb..0000000 --- a/peft/lora.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -export TF_CPP_MIN_LOG_LEVEL=2 XLA_PYTHON_CLIENT_PREALLOCATE=false - -python3 finetune.py \ - --model-name="google/timesfm-1.0-200m" \ - --backend="gpu" \ - --horizon-len=128 \ - --context-len=512 \ - --freq="15min" \ - --data-path="../datasets/ETT-small/ETTm1.csv" \ - --num-epochs=100 \ - --learning-rate=1e-3 \ - --adam-epsilon=1e-7 \ - --adam-clip-threshold=1e2 \ - --early-stop-patience=10 \ - --datetime-col="date" \ - --boundaries=34560 46080 57600 \ - --use-lora \ - --lora-rank=1 \ - --lora-target-modules="all" \ - --cos-initial-decay-value=1e-4 \ - --cos-decay-steps=40000 \ - --cos-final-decay-value=1e-5 \ - --ema-decay=0.9999 \ No newline at end of file