Instructions to use 1112lee/kaggle with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use 1112lee/kaggle with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-medium") model = PeftModel.from_pretrained(base_model, "1112lee/kaggle") - Notebooks
- Google Colab
- Kaggle
Download working/peft/examples/image_classification/README.md from 1112lee/kaggle: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/1112lee/kaggle/resolve/main/working/peft/examples/image_classification/README.md
- Command line
-
hf download hf://1112lee/kaggle/working/peft/examples/image_classification/README.md
-
curl -L -o README.md https://huggingface.co/1112lee/kaggle/resolve/main/working/peft/examples/image_classification/README.md
Fine-tuning for image classification using LoRA and 🤗 PEFT
Vision Transformer model from transformers
We provide a notebook (image_classification_peft_lora.ipynb) where we learn how to use LoRA from 🤗 PEFT to fine-tune an image classification model by ONLY using 0.7% of the original trainable parameters of the model.
LoRA adds low-rank "update matrices" to certain blocks in the underlying model (in this case the attention blocks) and ONLY trains those matrices during fine-tuning. During inference, these update matrices are merged with the original model parameters. For more details, check out the original LoRA paper.
PoolFormer model from timm
The notebook image_classification_timm_peft_lora.ipynb showcases fine-tuning an image classification model using from the timm library. Again, LoRA is used to reduce the numberof trainable parameters to a fraction of the total.