From 563acf0832ba25284e09ffdc9d89c7856f0cef50 Mon Sep 17 00:00:00 2001 From: Benjamin Bossan Date: Wed, 28 Jun 2023 08:53:09 +0200 Subject: [PATCH] Remove loralib reqs from examples, small fixes (#640) - As discussed, loralib is no longer required, so the examples from the docs have been updated to no longer require loralib as dependencies - In one example, a missing torch import was added - In another example, a missing line was added (output of that line is shown, but not the line itself) --- docs/source/task_guides/clm-prompt-tuning.mdx | 1 + docs/source/task_guides/image_classification_lora.mdx | 2 +- docs/source/task_guides/semantic_segmentation_lora.mdx | 2 +- docs/source/task_guides/seq2seq-prefix-tuning.mdx | 1 + examples/causal_language_modeling/requirements.txt | 1 - examples/conditional_generation/requirements.txt | 1 - .../image_classification/image_classification_peft_lora.ipynb | 2 +- examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb | 2 +- examples/int8_training/Finetune_opt_bnb_peft.ipynb | 2 +- examples/int8_training/peft_bnb_whisper_large_v2_training.ipynb | 2 +- examples/lora_dreambooth/requirements.txt | 1 - .../semantic_segmentation/semantic_segmentation_peft_lora.ipynb | 2 +- examples/sequence_classification/requirements.txt | 1 - examples/token_classification/requirements.txt | 1 - 14 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/source/task_guides/clm-prompt-tuning.mdx b/docs/source/task_guides/clm-prompt-tuning.mdx index 3cd1fd82e4..0d3c7d09a8 100644 --- a/docs/source/task_guides/clm-prompt-tuning.mdx +++ b/docs/source/task_guides/clm-prompt-tuning.mdx @@ -85,6 +85,7 @@ dataset = dataset.map( batched=True, num_proc=1, ) +dataset["train"][0] {"Tweet text": "@HMRCcustomers No this is my first job", "ID": 0, "Label": 2, "text_label": "no complaint"} ``` diff --git a/docs/source/task_guides/image_classification_lora.mdx b/docs/source/task_guides/image_classification_lora.mdx index 3d47509b46..1c4ea77ce1 100644 --- a/docs/source/task_guides/image_classification_lora.mdx +++ b/docs/source/task_guides/image_classification_lora.mdx @@ -26,7 +26,7 @@ For more information on LoRA, please refer to the [original LoRA paper](https:// Install the libraries required for model training: ```bash -!pip install transformers accelerate evaluate datasets loralib peft -q +!pip install transformers accelerate evaluate datasets peft -q ``` Check the versions of all required libraries to make sure you are up to date: diff --git a/docs/source/task_guides/semantic_segmentation_lora.mdx b/docs/source/task_guides/semantic_segmentation_lora.mdx index 8be08494b9..05d6bb86b9 100644 --- a/docs/source/task_guides/semantic_segmentation_lora.mdx +++ b/docs/source/task_guides/semantic_segmentation_lora.mdx @@ -26,7 +26,7 @@ For more information on LoRA, please refer to the [original LoRA paper](https:// Install the libraries required for model training: ```bash -!pip install transformers accelerate evaluate datasets loralib peft -q +!pip install transformers accelerate evaluate datasets peft -q ``` ## Authenticate to share your model diff --git a/docs/source/task_guides/seq2seq-prefix-tuning.mdx b/docs/source/task_guides/seq2seq-prefix-tuning.mdx index 5297a0f1cf..993ec74a2a 100644 --- a/docs/source/task_guides/seq2seq-prefix-tuning.mdx +++ b/docs/source/task_guides/seq2seq-prefix-tuning.mdx @@ -28,6 +28,7 @@ from peft import get_peft_config, get_peft_model, get_peft_model_state_dict, Pre from datasets import load_dataset from torch.utils.data import DataLoader from tqdm import tqdm +import torch import os os.environ["TOKENIZERS_PARALLELISM"] = "false" diff --git a/examples/causal_language_modeling/requirements.txt b/examples/causal_language_modeling/requirements.txt index 5e53d13816..8dcf534a99 100644 --- a/examples/causal_language_modeling/requirements.txt +++ b/examples/causal_language_modeling/requirements.txt @@ -1,6 +1,5 @@ transformers accelerate -loralib evaluate deepspeed tqdm diff --git a/examples/conditional_generation/requirements.txt b/examples/conditional_generation/requirements.txt index 5e53d13816..8dcf534a99 100644 --- a/examples/conditional_generation/requirements.txt +++ b/examples/conditional_generation/requirements.txt @@ -1,6 +1,5 @@ transformers accelerate -loralib evaluate deepspeed tqdm diff --git a/examples/image_classification/image_classification_peft_lora.ipynb b/examples/image_classification/image_classification_peft_lora.ipynb index dc7ac4bfab..7b1e72fcc2 100644 --- a/examples/image_classification/image_classification_peft_lora.ipynb +++ b/examples/image_classification/image_classification_peft_lora.ipynb @@ -61,7 +61,7 @@ } ], "source": [ - "!pip install transformers accelerate evaluate datasets loralib git+https://github.com/huggingface/peft -q" + "!pip install transformers accelerate evaluate datasets git+https://github.com/huggingface/peft -q" ] }, { diff --git a/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb b/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb index cdb35d8037..98d497d6db 100644 --- a/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb +++ b/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb @@ -71,7 +71,7 @@ } ], "source": [ - "!pip install -q bitsandbytes datasets accelerate loralib\n", + "!pip install -q bitsandbytes datasets accelerate\n", "!pip install -q git+https://github.com/huggingface/transformers.git@main git+https://github.com/huggingface/peft.git@main" ] }, diff --git a/examples/int8_training/Finetune_opt_bnb_peft.ipynb b/examples/int8_training/Finetune_opt_bnb_peft.ipynb index 145ed434fc..b3d4303afd 100644 --- a/examples/int8_training/Finetune_opt_bnb_peft.ipynb +++ b/examples/int8_training/Finetune_opt_bnb_peft.ipynb @@ -59,7 +59,7 @@ } ], "source": [ - "!pip install -q bitsandbytes datasets accelerate loralib\n", + "!pip install -q bitsandbytes datasets accelerate\n", "!pip install -q git+https://github.com/huggingface/transformers.git@main git+https://github.com/huggingface/peft.git" ] }, diff --git a/examples/int8_training/peft_bnb_whisper_large_v2_training.ipynb b/examples/int8_training/peft_bnb_whisper_large_v2_training.ipynb index 7e51542a66..10084a978f 100644 --- a/examples/int8_training/peft_bnb_whisper_large_v2_training.ipynb +++ b/examples/int8_training/peft_bnb_whisper_large_v2_training.ipynb @@ -64,7 +64,7 @@ "!pip install evaluate>=0.30\n", "!pip install jiwer\n", "!pip install gradio\n", - "!pip install -q bitsandbytes datasets accelerate loralib\n", + "!pip install -q bitsandbytes datasets accelerate\n", "!pip install -q git+https://github.com/huggingface/transformers.git@main git+https://github.com/huggingface/peft.git@main" ] }, diff --git a/examples/lora_dreambooth/requirements.txt b/examples/lora_dreambooth/requirements.txt index 0a5f78cdb4..84ae47b6e6 100644 --- a/examples/lora_dreambooth/requirements.txt +++ b/examples/lora_dreambooth/requirements.txt @@ -1,6 +1,5 @@ transformers accelerate -loralib evaluate tqdm datasets diff --git a/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb b/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb index 09ccbb8201..edb1872947 100644 --- a/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb +++ b/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb @@ -38,7 +38,7 @@ }, "outputs": [], "source": [ - "!pip install transformers accelerate evaluate datasets loralib git+https://github.com/huggingface/peft -q" + "!pip install transformers accelerate evaluate datasets git+https://github.com/huggingface/peft -q" ] }, { diff --git a/examples/sequence_classification/requirements.txt b/examples/sequence_classification/requirements.txt index 4b7ca3427e..2c17235b14 100644 --- a/examples/sequence_classification/requirements.txt +++ b/examples/sequence_classification/requirements.txt @@ -1,6 +1,5 @@ transformers accelerate -loralib evaluate tqdm datasets \ No newline at end of file diff --git a/examples/token_classification/requirements.txt b/examples/token_classification/requirements.txt index dc9e3c1902..2cde65e152 100644 --- a/examples/token_classification/requirements.txt +++ b/examples/token_classification/requirements.txt @@ -1,6 +1,5 @@ transformers accelerate -loralib evaluate tqdm datasets