ad-sensor6ty/simplellm
0
1---2title: Simple LLM Finetuner3emoji: ๐ฆ4colorFrom: yellow5colorTo: orange6sdk: gradio7app_file: app.py8pinned: false9---10 11# ๐ฆ Simple LLM Finetuner12 13[](https://colab.research.google.com/github/lxe/simple-llama-finetuner/blob/master/Simple_LLaMA_FineTuner.ipynb)14[](https://huggingface.co/spaces/lxe/simple-llama-finetuner)15[](https://github.com/lxe/no-bugs) 16[](https://github.com/lxe/onehundred/tree/master)17 18Simple LLM Finetuner is a beginner-friendly interface designed to facilitate fine-tuning various language models using [LoRA](https://arxiv.org/abs/2106.09685) method via the [PEFT library](https://github.com/huggingface/peft) on commodity NVIDIA GPUs. With small dataset and sample lengths of 256, you can even run this on a regular Colab Tesla T4 instance.19 20With this intuitive UI, you can easily manage your dataset, customize parameters, train, and evaluate the model's inference capabilities.21 22## Acknowledgements23 24 - https://github.com/zphang/minimal-llama/25 - https://github.com/tloen/alpaca-lora26 - https://github.com/huggingface/peft27 28## Features29 30- Simply paste datasets in the UI, separated by double blank lines31- Adjustable parameters for fine-tuning and inference32- Beginner-friendly UI with explanations for each parameter33 34## Getting Started35 36### Prerequisites37 38- Linux or WSL39- Modern NVIDIA GPU with >= 16 GB of VRAM (but it might be possible to run with less for smaller sample lengths)40 41### Usage42 43I recommend using a virtual environment to install the required packages. Conda preferred.44 45```46conda create -n simple-llm-finetuner python=3.1047conda activate simple-llm-finetuner48conda install -y cuda -c nvidia/label/cuda-11.7.049conda install -y pytorch=2 pytorch-cuda=11.7 -c pytorch50```51 52On WSL, you might need to install CUDA manually by following [these steps](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local), then running the following before you launch:53 54```55export LD_LIBRARY_PATH=/usr/lib/wsl/lib56```57 58Clone the repository and install the required packages.59 60```61git clone https://github.com/lxe/simple-llm-finetuner.git62cd simple-llm-finetuner63pip install -r requirements.txt64```65 66Launch it67 68```69python main.py70```71 72Open http://127.0.0.1:7860/ in your browser. Prepare your training data by separating each sample with 2 blank lines. Paste the whole training dataset into the textbox. Specify the new LoRA adapter name in the "New PEFT Adapter Name" textbox, then click train. You might need to adjust the max sequence length and batch size to fit your GPU memory. The model will be saved in the `lora/` directory.73 74After training is done, navigate to "Inference" tab, select your LoRA, and play with it.75 76Have fun!77 78## YouTube Walkthough79 80https://www.youtube.com/watch?v=yM1wanDkNz881 82## License83 84MIT License85 