|
10 | 10 | - [Tuning Techniques](#tuning-techniques) |
11 | 11 | - [LoRA Tuning Example](#lora-tuning-example) |
12 | 12 | - [GPTQ-LoRA with AutoGPTQ Tuning Example](#gptq-lora-with-autogptq-tuning-example) |
13 | | - - [Prompt Tuning](#prompt-tuning) |
14 | 13 | - [Fine Tuning](#fine-tuning) |
15 | 14 | - [FMS Acceleration](#fms-acceleration) |
16 | 15 | - [Extended Pre-Training](#extended-pre-training) |
@@ -755,54 +754,6 @@ Note that with LoRA tuning technique, setting `all-linear` on `target_modules` r |
755 | 754 |
|
756 | 755 | _________________________ |
757 | 756 |
|
758 | | -### Prompt Tuning: |
759 | | - |
760 | | -Specify `peft_method` to `'pt'` . You can additionally pass any arguments from [PromptTuningConfig](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/tuning/config/peft_config.py#L63). |
761 | | -```py |
762 | | -# prompt_tuning_init can be either "TEXT" or "RANDOM" |
763 | | -prompt_tuning_init: str = "TEXT" |
764 | | -num_virtual_tokens: int = 8 |
765 | | -# prompt_tuning_init_text only applicable if prompt_tuning_init= "TEXT" |
766 | | -prompt_tuning_init_text: str = "Classify if the tweet is a complaint or not:" |
767 | | -tokenizer_name_or_path: str = "llama-7b-hf" |
768 | | -``` |
769 | | - |
770 | | -Example command you can run: |
771 | | - |
772 | | -```bash |
773 | | -python tuning/sft_trainer.py \ |
774 | | ---model_name_or_path $MODEL_PATH \ |
775 | | ---training_data_path $TRAIN_DATA_PATH \ |
776 | | ---output_dir $OUTPUT_PATH \ |
777 | | ---num_train_epochs 5 \ |
778 | | ---per_device_train_batch_size 1 \ |
779 | | ---learning_rate 0.03 \ |
780 | | ---response_template "\n### Label:" \ |
781 | | ---dataset_text_field "output" \ |
782 | | ---peft_method pt \ |
783 | | ---tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used |
784 | | ---prompt_tuning_init "RANDOM" \ |
785 | | ---prompt_tuning_init_text "From the following input, identify target sentiment of following types: neutral, negative, positive" |
786 | | -``` |
787 | | - |
788 | | -Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: |
789 | | -```json |
790 | | -{ |
791 | | - "model_name_or_path": $MODEL_PATH, |
792 | | - "training_data_path": $TRAIN_DATA_PATH, |
793 | | - "output_dir": $OUTPUT_PATH, |
794 | | - "num_train_epochs": 5.0, |
795 | | - "per_device_train_batch_size": 1, |
796 | | - "learning_rate": 0.03, |
797 | | - "response_template": "\n### Label:", |
798 | | - "dataset_text_field": "output", |
799 | | - "peft_method": "pt", |
800 | | - "tokenizer_name_or_path": $MODEL_PATH, |
801 | | - "prompt_tuning_init": "RANDOM", |
802 | | - "prompt_tuning_init_text": "From the following input, identify target sentiment of following types: neutral, negative, positive" |
803 | | -} |
804 | | -``` |
805 | | - |
806 | 757 | ### Fine Tuning: |
807 | 758 |
|
808 | 759 | Set `peft_method` to `'None'` or do not provide `peft_method` flag. |
@@ -1070,6 +1021,4 @@ Further details on enabling and using the trackers mentioned above can be found |
1070 | 1021 |
|
1071 | 1022 | ## More Examples |
1072 | 1023 |
|
1073 | | -[Prompt Tuning on Twitter Complaints](examples/prompt_tuning_twitter_complaints/README.md) |
1074 | | - |
1075 | 1024 | A good simple example can be found [here](examples/kfto-kueue-sft-trainer.yaml) which launches a Kubernetes-native `PyTorchJob` using the [Kubeflow Training Operator](https://github.com/kubeflow/training-operator/) with [Kueue](https://github.com/kubernetes-sigs/kueue) for the queue management of tuning jobs. |
0 commit comments