repo_id
stringlengths
15
86
file_path
stringlengths
28
180
content
stringlengths
1
1.75M
__index_level_0__
int64
0
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/causal_language_modeling/peft_prefix_tuning_clm.ipynb
from transformers import AutoModelForCausalLM from peft import get_peft_config, get_peft_model, PrefixTuningConfig, TaskType, PeftType import torch from datasets import load_dataset import os from transformers import AutoTokenizer from torch.utils.data import DataLoader from transformers import default_data_collator, g...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/multi_adapter_examples/PEFT_Multi_LoRA_Inference.ipynb
import os os.environ["CUDA_VISIBLE_DEVICES"] = "0"from huggingface_hub import notebook_login import torch notebook_login()from peft import PeftModel from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig model_name = "decapoda-research/llama-7b-hf" tokenizer = LlamaTokenizer.from_pretrained(mode...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb
# Select CUDA device index import os import torch os.environ["CUDA_VISIBLE_DEVICES"] = "0" from datasets import load_dataset from transformers import AutoModelForSeq2SeqLM, AutoTokenizer model_name = "google/flan-t5-large" model = AutoModelForSeq2SeqLM.from_pretrained(model_name, load_in_8bit=True) tokenizer = Auto...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/int8_training/Finetune_opt_bnb_peft.ipynb
import os import torch import torch.nn as nn import bitsandbytes as bnb from transformers import AutoTokenizer, AutoConfig, AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("facebook/opt-6.7b", load_in_8bit=True) tokenizer = AutoTokenizer.from_pretrained("facebook/opt-6.7b")from peft import prepare_...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/int8_training/peft_bnb_whisper_large_v2_training.ipynb
from huggingface_hub import notebook_login notebook_login()# Select CUDA device index import os os.environ["CUDA_VISIBLE_DEVICES"] = "0" model_name_or_path = "openai/whisper-large-v2" language = "Marathi" language_abbr = "mr" task = "transcribe" dataset_name = "mozilla-foundation/common_voice_11_0"from datasets impor...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/int8_training/fine_tune_blip2_int8.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/int8_training/peft_adalora_whisper_large_training.py
import argparse import gc import json import logging import math import os from dataclasses import dataclass from datetime import datetime from pathlib import Path from random import randint from typing import Any, Dict, List, Union # datasets imports import datasets # metric imports import evaluate import numpy as n...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/int8_training/run_adalora_whisper_int8.sh
accelerate launch --config_file config.yaml peft_adalora_whisper_large_training.py \ --model_name_or_path "openai/whisper-large-v2" \ --language "Marathi" \ --language_abbr "mr" \ --task "transcribe" \ --dataset_name "mozilla-foundation/common_voice_11_0" \ --push_to_hub \ --preprocessing_nu...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/token_classification/requirements.txt
transformers accelerate evaluate tqdm datasets Pillow torchvision
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/token_classification/peft_lora_token_cls.ipynb
# ! rm -r unilm # ! pip install unilm# ! wget https://guillaumejaume.github.io/FUNSD/dataset.zip # ! unzip dataset.zip && mv dataset data && rm -rf dataset.zip __MACOSXfrom PIL import Image, ImageDraw, ImageFont import os base_path = "/home/sourab/temp/data/dataset" image = Image.open(os.path.join(base_path, "trainin...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/feature_extraction/requirements.txt
git+https://github.com/huggingface/peft git+https://github.com/huggingface/accelerate git+https://github.com/huggingface/transformers datasets evaluate hnswlib pandas tqdm huggingface_hub wandb
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/feature_extraction/peft_lora_embedding_semantic_search.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/feature_extraction/peft_lora_embedding_semantic_similarity_inference.ipynb
import argparse import json import logging import math import os import random from pathlib import Path from tqdm import tqdm import datasets from datasets import load_dataset, DatasetDict import evaluate import torch from torch import nn from torch.utils.data import DataLoader import transformers from transformers ...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb
from huggingface_hub import notebook_login notebook_login()from datasets import load_dataset ds = load_dataset("scene_parse_150", split="train[:150]")ds = ds.train_test_split(test_size=0.1) train_ds = ds["train"] test_ds = ds["test"]import json from huggingface_hub import cached_download, hf_hub_url repo_id = "huggi...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/semantic_segmentation/README.md
# Fine-tuning for semantic segmentation using LoRA and 🤗 PEFT [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/peft/blob/main/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb) We provide a notebook (`semantic_segmen...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/fp4_finetuning/finetune_fp4_opt_bnb_peft.py
import os import torch import torch.nn as nn import transformers from datasets import load_dataset from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig from peft import LoraConfig, get_peft_model os.environ["CUDA_VISIBLE_DEVICES"] = "0" # -*- coding: utf-8 -*- """Finetune-opt-bnb-peft.i...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/requirements.txt
transformers accelerate evaluate deepspeed tqdm datasets
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_prompt_tuning_seq2seq_with_generate.ipynb
import os import torch from transformers import ( AutoTokenizer, default_data_collator, AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer, GenerationConfig, ) from peft import get_peft_model, PromptTuningInit, PromptTuningConfig, TaskType from datasets import load_dataset os.envi...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/accelerate_ds_zero3_cpu_offload_config.yaml
compute_environment: LOCAL_MACHINE deepspeed_config: gradient_accumulation_steps: 1 gradient_clipping: 1.0 offload_optimizer_device: none offload_param_device: none zero3_init_flag: true zero3_save_16bit_model: true zero_stage: 3 distributed_type: DEEPSPEED downcast_bf16: 'no' dynamo_backend: 'NO' fsdp_co...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_ds_zero3_offload.py
import gc import os import sys import threading import numpy as np import psutil import torch from accelerate import Accelerator from datasets import load_dataset from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, get_linear_schedule_with_warmup...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_adalora_seq2seq.py
import os import torch from datasets import load_dataset from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import AdaLoraConfig, PeftConfig, PeftModel, TaskType, get_peft_model ...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_prompt_tuning_seq2seq.ipynb
import os import torch from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import get_peft_model, PromptTuningConfig, TaskType, PromptTuningInit from torch.utils.data import DataLoader from tqdm import tqdm from datasets import load_dataset o...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_big_model_inference.ipynb
from transformers import AutoModelForSeq2SeqLM from peft import PeftModel, PeftConfig import torch from datasets import load_dataset import os from transformers import AutoTokenizer from torch.utils.data import DataLoader from transformers import default_data_collator, get_linear_schedule_with_warmup from tqdm import t...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_fsdp.py
import os import torch from accelerate import Accelerator from datasets import load_dataset from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import LoraConfig, TaskType, get_pef...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_ia3_seq2seq.ipynb
from transformers import AutoModelForSeq2SeqLM import peft from peft import get_peft_config, get_peft_model, get_peft_model_state_dict, IA3Config, TaskType import torch from datasets import load_dataset import os os.environ["TOKENIZERS_PARALLELISM"] = "false" from transformers import AutoTokenizer from torch.utils.dat...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_lora_seq2seq.ipynb
from transformers import AutoModelForSeq2SeqLM from peft import get_peft_config, get_peft_model, get_peft_model_state_dict, LoraConfig, TaskType import torch from datasets import load_dataset import os os.environ["TOKENIZERS_PARALLELISM"] = "false" from transformers import AutoTokenizer from torch.utils.data import Da...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/conditional_generation/peft_prefix_tuning_seq2seq.ipynb
from transformers import AutoModelForSeq2SeqLM from peft import get_peft_config, get_peft_model, get_peft_model_state_dict, PrefixTuningConfig, TaskType import torch from datasets import load_dataset import os os.environ["TOKENIZERS_PARALLELISM"] = "false" os.environ["CUDA_VISIBLE_DEVICES"] = "3" from transformers imp...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/sequence_classification/requirements.txt
transformers accelerate evaluate tqdm datasets
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/sequence_classification/P_Tuning.ipynb
import argparse import os import torch from torch.optim import AdamW from torch.utils.data import DataLoader from peft import ( get_peft_config, get_peft_model, get_peft_model_state_dict, set_peft_model_state_dict, PeftType, PrefixTuningConfig, PromptEncoderConfig, ) import evaluate from d...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/sequence_classification/Prompt_Tuning.ipynb
import argparse import os import torch from torch.optim import AdamW from torch.utils.data import DataLoader from peft import ( get_peft_config, get_peft_model, get_peft_model_state_dict, set_peft_model_state_dict, PeftType, PrefixTuningConfig, PromptEncoderConfig, PromptTuningConfig, )...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/sequence_classification/LoRA.ipynb
import argparse import os import torch from torch.optim import AdamW from torch.utils.data import DataLoader from peft import ( get_peft_config, get_peft_model, get_peft_model_state_dict, set_peft_model_state_dict, LoraConfig, PeftType, PrefixTuningConfig, PromptEncoderConfig, ) import...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/sequence_classification/prefix_tuning.ipynb
import argparse import os import torch from torch.optim import AdamW from torch.utils.data import DataLoader from peft import ( get_peft_config, get_peft_model, get_peft_model_state_dict, set_peft_model_state_dict, PeftType, PrefixTuningConfig, PromptEncoderConfig, ) import evaluate from d...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/sequence_classification/IA3.ipynb
import argparse import os import torch from torch.optim import AdamW from torch.utils.data import DataLoader import peft import evaluate from datasets import load_dataset from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from tqdm import tqdmbatch_si...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/sequence_classification/peft_no_lora_accelerate.py
import argparse import evaluate import torch from accelerate import Accelerator, DistributedDataParallelKwargs from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_li...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/lora_dreambooth/requirements.txt
transformers accelerate evaluate tqdm datasets diffusers Pillow torchvision huggingface_hub safetensors wandb
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/lora_dreambooth/train_dreambooth.py
import argparse import gc import hashlib import itertools import logging import math import os import threading import warnings from pathlib import Path from typing import Optional import datasets import diffusers import numpy as np import psutil import torch import torch.nn.functional as F import torch.utils.checkpoi...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py
import argparse import os from typing import Dict import torch from diffusers import UNet2DConditionModel from safetensors.torch import save_file from transformers import CLIPTextModel from peft import PeftModel, get_peft_model_state_dict # Default kohya_ss LoRA replacement modules # https://github.com/kohya-ss/sd-...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/lora_dreambooth/lora_dreambooth_inference.ipynb
import argparse import gc import hashlib import itertools import logging import math import os import threading import warnings from pathlib import Path from typing import Optional import psutil import json import torch import torch.nn.functional as F import torch.utils.checkpoint from torch.utils.data import Dataset ...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/lora_dreambooth/colab_notebook.ipynb
%cd "peft-lora-sd-dreambooth" !pip install -r requirements.txt
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/lora_dreambooth/convert_kohya_ss_sd_lora_to_peft.py
import argparse import os import re from typing import Callable, List, Optional, Union import safetensors import torch import torch.nn as nn from diffusers import UNet2DConditionModel from transformers import CLIPTextModel from peft import LoraConfig, get_peft_model, get_peft_model_state_dict, set_peft_model_state_di...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/image_classification/README.md
# Fine-tuning for image classification using LoRA and 🤗 PEFT [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/peft/blob/main/examples/image_classification/image_classification_peft_lora.ipynb) We provide a notebook (`image_classificati...
0
hf_public_repos/peft/examples
hf_public_repos/peft/examples/image_classification/image_classification_peft_lora.ipynb
from huggingface_hub import notebook_login notebook_login()import transformers import accelerate import peftprint(f"Transformers version: {transformers.__version__}") print(f"Accelerate version: {accelerate.__version__}") print(f"PEFT version: {peft.__version__}")model_checkpoint = "google/vit-base-patch16-224-in21k" ...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_decoder_models.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_adaption_prompt.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_encoder_decoder_models.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_hub_features.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_common_gpu.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_gpu_examples.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_auto.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_config.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/testing_utils.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_custom_models.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_feature_extraction_models.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/testing_common.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/tests/test_stablediffusion.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft
hf_public_repos/peft/docs/README.md
<!--- Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
0
hf_public_repos/peft
hf_public_repos/peft/docs/Makefile
# Minimal makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build SOURCEDIR = source BUILDDIR = _build # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" ...
0
hf_public_repos/peft/docs
hf_public_repos/peft/docs/source/install.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs
hf_public_repos/peft/docs/source/index.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs
hf_public_repos/peft/docs/source/_toctree.yml
- title: Get started sections: - local: index title: 🤗 PEFT - local: quicktour title: Quicktour - local: install title: Installation - title: Task guides sections: - local: task_guides/image_classification_lora title: Image classification using LoRA - local: task_guides/seq2seq-prefix-tu...
0
hf_public_repos/peft/docs
hf_public_repos/peft/docs/source/quicktour.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs
hf_public_repos/peft/docs/source/_config.py
# docstyle-ignore INSTALL_CONTENT = """ # PEFT installation ! pip install peft accelerate transformers # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/peft.git """
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/accelerate/deepspeed-zero3-offload.mdx
# DeepSpeed [DeepSpeed](https://www.deepspeed.ai/) is a library designed for speed and scale for distributed training of large models with billions of parameters. At its core is the Zero Redundancy Optimizer (ZeRO) that shards optimizer states (ZeRO-1), gradients (ZeRO-2), and parameters (ZeRO-3) across data parallel ...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/accelerate/fsdp.mdx
# Fully Sharded Data Parallel [Fully sharded data parallel](https://pytorch.org/docs/stable/fsdp.html) (FSDP) is developed for distributed training of large pretrained models up to 1T parameters. FSDP achieves this by sharding the model parameters, gradients, and optimizer states across data parallel processes and it ...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/seq2seq-prefix-tuning.mdx
# Prefix tuning for conditional generation [[open-in-colab]] Prefix tuning is an additive method where only a sequence of continuous task-specific vectors is attached to the beginning of the input, or *prefix*. Only the prefix parameters are optimized and added to the hidden states in every layer of the model. The to...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/semantic-similarity-lora.md
# LoRA for semantic similarity tasks Low-Rank Adaptation (LoRA) is a reparametrization method that aims to reduce the number of trainable parameters with low-rank representations. The weight matrix is broken down into low-rank matrices that are trained and updated. All the pretrained model parameters remain frozen. Af...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/int8-asr.mdx
# int8 training for automatic speech recognition Quantization reduces the precision of floating point data types, decreasing the memory required to store model weights. However, quantization degrades inference performance because you lose information when you reduce the precision. 8-bit or `int8` quantization uses onl...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/dreambooth_lora.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/clm-prompt-tuning.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/semantic_segmentation_lora.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/image_classification_lora.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/token-classification-lora.mdx
# LoRA for token classification Low-Rank Adaptation (LoRA) is a reparametrization method that aims to reduce the number of trainable parameters with low-rank representations. The weight matrix is broken down into low-rank matrices that are trained and updated. All the pretrained model parameters remain frozen. After t...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/task_guides/ptuning-seq-classification.mdx
# P-tuning for sequence classification It is challenging to finetune large language models for downstream tasks because they have so many parameters. To work around this, you can use *prompts* to steer the model toward a particular downstream task without fully finetuning a model. Typically, these prompts are handcraf...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/conceptual_guides/ia3.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/conceptual_guides/lora.mdx
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/conceptual_guides/prompting.mdx
# Prompting Training large pretrained language models is very time-consuming and compute-intensive. As they continue to grow in size, there is increasing interest in more efficient training methods such as *prompting*. Prompting primes a frozen pretrained model for a specific downstream task by including a text prompt...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/package_reference/peft_model.mdx
# Models [`PeftModel`] is the base model class for specifying the base Transformer model and configuration to apply a PEFT method to. The base `PeftModel` contains methods for loading and saving models from the Hub, and supports the [`PromptEncoder`] for prompt learning. ## PeftModel [[autodoc]] PeftModel - all ...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/package_reference/tuners.mdx
# Tuners Each tuner (or PEFT method) has a configuration and model. ## LoRA For finetuning a model with LoRA. [[autodoc]] LoraConfig [[autodoc]] LoraModel [[autodoc]] tuners.lora.LoraLayer [[autodoc]] tuners.lora.Linear ## P-tuning [[autodoc]] tuners.p_tuning.PromptEncoderConfig [[autodoc]] tuners.p_tuning.Pr...
0
hf_public_repos/peft/docs/source
hf_public_repos/peft/docs/source/package_reference/config.mdx
# Configuration The configuration classes stores the configuration of a [`PeftModel`], PEFT adapter models, and the configurations of [`PrefixTuning`], [`PromptTuning`], and [`PromptEncoder`]. They contain methods for saving and loading model configurations from the Hub, specifying the PEFT method to use, type of task...
0
hf_public_repos/peft
hf_public_repos/peft/scripts/stale.py
# Copyright 2023 The HuggingFace Team, the AllenNLP library authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
0
hf_public_repos/peft
hf_public_repos/peft/scripts/log_reports.py
import json, os from pathlib import Path from datetime import date from tabulate import tabulate failed = [] passed = [] group_info = [] total_num_failed = 0 empty_file = False or len(list(Path().glob("*.log"))) == 0 for log in Path().glob("*.log"): section_num_failed = 0 with open(log, "r") as f: nb...
0
hf_public_repos/peft/docker
hf_public_repos/peft/docker/peft-cpu/Dockerfile
# Builds GPU docker image of PyTorch # Uses multi-staged approach to reduce size # Stage 1 # Use base conda image to reduce time FROM continuumio/miniconda3:latest AS compile-image # Specify py version ENV PYTHON_VERSION=3.8 # Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/acc...
0
hf_public_repos/peft/docker
hf_public_repos/peft/docker/peft-gpu/Dockerfile
# Builds GPU docker image of PyTorch # Uses multi-staged approach to reduce size # Stage 1 # Use base conda image to reduce time FROM continuumio/miniconda3:latest AS compile-image # Specify py version ENV PYTHON_VERSION=3.8 # Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/acc...
0
hf_public_repos/peft/src
hf_public_repos/peft/src/peft/__init__.py
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not ...
0
hf_public_repos/peft/src
hf_public_repos/peft/src/peft/auto.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src
hf_public_repos/peft/src/peft/mapping.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src
hf_public_repos/peft/src/peft/import_utils.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src
hf_public_repos/peft/src/peft/peft_model.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/__init__.py
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all # coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not u...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/adalora.py
import re import warnings from dataclasses import dataclass, field from typing import Optional import torch import torch.nn as nn import torch.nn.functional as F from transformers.pytorch_utils import Conv1D from ..import_utils import is_bnb_4bit_available, is_bnb_available from ..utils import ( TRANSFORMERS_MODE...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/p_tuning.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/prompt_tuning.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/prefix_tuning.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/adaption_prompt.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/lora.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/tuners/ia3.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/utils/save_and_load.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/utils/__init__.py
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all # coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not u...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/utils/config.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0
hf_public_repos/peft/src/peft
hf_public_repos/peft/src/peft/utils/other.py
# coding=utf-8 # Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
0