{"id":20619836,"url":"https://github.com/mafda/lightweight_fine_tuning_project","last_synced_at":"2026-04-20T15:04:33.252Z","repository":{"id":262265685,"uuid":"879084528","full_name":"mafda/lightweight_fine_tuning_project","owner":"mafda","description":"This repository provides a Jupyter notebook demonstrating parameter-efficient fine-tuning (PEFT) with LoRA on Hugging Face models.","archived":false,"fork":false,"pushed_at":"2024-11-11T13:34:20.000Z","size":2731,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T20:14:18.467Z","etag":null,"topics":["huggingface","huggingface-datasets","huggingface-transformers","lora","peft","peft-fine-tuning-llm","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mafda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-26T23:35:17.000Z","updated_at":"2024-11-11T13:34:24.000Z","dependencies_parsed_at":"2024-11-11T14:43:57.927Z","dependency_job_id":null,"html_url":"https://github.com/mafda/lightweight_fine_tuning_project","commit_stats":null,"previous_names":["mafda/lightweight_fine_tuning_project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mafda/lightweight_fine_tuning_project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Flightweight_fine_tuning_project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Flightweight_fine_tuning_project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Flightweight_fine_tuning_project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Flightweight_fine_tuning_project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mafda","download_url":"https://codeload.github.com/mafda/lightweight_fine_tuning_project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Flightweight_fine_tuning_project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32052551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["huggingface","huggingface-datasets","huggingface-transformers","lora","peft","peft-fine-tuning-llm","pytorch"],"created_at":"2024-11-16T12:12:37.927Z","updated_at":"2026-04-20T15:04:33.233Z","avatar_url":"https://github.com/mafda.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lightweight Fine-Tuning Project\n\nLightweight fine-tuning is one of the most important techniques for adapting\nfoundation models, because it allows you to modify foundation models for your\nneeds without needing substantial computational resources.\n\nIn this project, I will apply parameter-efficient fine-tuning using the\nHugging Face `peft` library.\n\n\u003e [See notebook](src/lightweight_finetuning.ipynb)\n\n## Methodology\n\nIn this project, I will bring together all of the essential components of a\nPyTorch + Hugging Face training and inference process. Specifically, I will:\n\n1. Load a pre-trained model and evaluate its performance Perform\n2. parameter-efficient fine tuning using the pre-trained model Perform inference\n3. using the fine-tuned model and compare its performance to the original model\n\n## Description\n\n* PEFT technique: I used **LoRA** as my PEFT technique. LoRA is the only PEFT\n  technique that is compatible with all models at this time.\n* Model: I used **distilbert-base-uncased** as my model. This is a relatively\n  small model that is compatible with sequence classification and **LoRA**.\n* Evaluation approach: The evaluation approach covered in this project was the\n  `evaluate` method with a **Hugging Face** `Trainer`.\n* Fine-tuning dataset: I use a dataset from Hugging Face's datasets library\n  [stanfordnlp/imdb](https://huggingface.co/datasets/stanfordnlp/imdb).\n\n## Project Setup\n\n### Clone this repository\n\n```shell\n(base)$: git@github.com:mafda/lightweight_fine_tuning_project.git\n(base)$: cd lightweight_fine_tuning_project\n```\n\n### Configure environment\n\n- Create the conda environment\n\n    ```shell\n    (base)$: conda env create -f environment.yml\n    ```\n\n- Activate the environment\n\n    ```shell\n    (base)$: conda activate peft\n    ```\n\n- Download the [base\n  model](https://drive.google.com/drive/folders/10oHiSKabEgOMj1p88Dw0hSIN1gSHoyvG?usp=share_link).\n  Unzip the folder and place it in the repo, at location\n  `path/to/lightweight_fine_tuning_project/model/`.\n\n- Download the [peft\n  model](https://drive.google.com/drive/folders/10oHiSKabEgOMj1p88Dw0hSIN1gSHoyvG?usp=share_link).\n  Unzip the folder and place it in the repo, at location\n  `path/to/lightweight_fine_tuning_project/model/`.\n\n- Donwload the [lora\n  model](https://drive.google.com/drive/folders/10oHiSKabEgOMj1p88Dw0hSIN1gSHoyvG?usp=share_link)\n  for the dog dataset.  Place it in the repo, at location\n  `path/to/lightweight_fine_tuning_project/model/`.\n\n## Project Structure\n\n```shell\n.\n├── README.md\n├── environment.yml\n├── model\n│   ├── base\n│   ├── lora\n│   └── peft\n└── src\n    └── lightweight_finetuning.ipynb\n```\n\n## References\n\n- [Generative AI Nanodegree\n  Program](https://www.udacity.com/course/generative-ai--nd608)\n\n---\n\nmade with 💙 by [mafda](https://mafda.github.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafda%2Flightweight_fine_tuning_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmafda%2Flightweight_fine_tuning_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafda%2Flightweight_fine_tuning_project/lists"}