An easy to use, open-source LLM finetuning library that handles all the complexities of the process for you.
Project description
🌟 Simplifine 🌟
The easiest, fully open-source LLM finetuning library!
Simplifine lets you invoke LLM finetuning with just one line of code using any Hugging Face dataset or model.
Updates
🔄 Updates
v0.0.71 (2024-07-25)
- Bug Fixes: Resolved issues that prevented the library from loading on certain configurations.
- New Feature: Added support for installing directly from git. Added support for Hugging Face API Tokens to access restricted models.
- Documentation: Updated examples.
🚀 Features
- Supervised Fine Tuning 🧑🏫
- Question-Answer Finetuning ❓➕
- Contrastive Loss for Embedding Tasks 🌌
- Multi-label Classification Finetuning 🏷️
- WandB Logging 📊
- In-built Evaluation Tools 📈
- Automated Finetuning Parameters 🤖
- State-of-the-art Optimization Techniques (DeepSpeed, FDSP) 🏎️
📦 Installation
pip install simplifine-alpha
Or you can install the package from source. To do so, simply download the content of this repository and navigate to the installation folder and run the following command:
pip install .
You can also directly install from github using the following command:
pip install git+https://github.com/simplifine-llm/Simplifine.git
🏁 Quickstart
For a more comprehensive example, see this notebook in the examples folder:
Further examples on how to use train engine are also located in the examples folder.
🤝 Contributing
We are looking for contributors! Please send an email to founders@simplifine.com to get onboarded, or add your name to the waitlist on www.simplifine.com.
📄 License
Simplifine is licensed under the GNU General Public License Version 3. See the LICENSE file for more details.
📚 Documentation
Find our full documentation at docs.simplifine.com.
💬 Support
Please raise issues for any new features you would like to see implemented—we will work hard to make it happen ASAP! For any other questions, contact us at founders@simplifine.com.
⛮ General comput considerations
We currently support DistributedDataParallel (DDP) and ZeRO from DeepSpeed. TL;DR DDP is usefull when a model can fit on GPU memory (this includes gradients and activation states), and ZeRO is usefull when model requires sharding across multiple GPUs.
Longer Version: DDP creates a replica on each processor (GPU). Imagine 8 GPUs, each being fed with a single data point. This would make a batch size of 8. The model replicas are then updated on each device. DDP speeds up training via parallelising the data-feeding process. DDP fails if the replica cannot fit in the GPU memory. Note that the memory does not only host parameters, but gradients and optizmier states.
ZeRO is a powerfull optimization developed by DeepSpeed. It comes in different stages (1,2 and 3). Each stage shards the different parts of the training process (params, grads, activation states). This is really usefull if a model cannot fit on the GPU memory. ZeRO also supports offloading to the CPU, which makes even more room for training larger models.
Here are some examples and the appropriate optimization method:
- A llama-3-8b model with 16 bit percision: ZeRO stage 3 on 8 A100s.
- A llama-3-8b model with LoRA adapters: Usually fine with DDP on A100s.
- A GPT-2 with 16 bit percision: DDP
🪲 FAQs and bugs
RuntimeError: Error building extension 'cpu_adam' python dev: This happens when python-dev is not installed and offload is being used by ZeRO. simple try
sudo apt-get install python-dev # for python2.x installs
sudo apt-get install python3-dev # for python3.x installs
See this link
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file simplifine_alpha-0.0.74.tar.gz
.
File metadata
- Download URL: simplifine_alpha-0.0.74.tar.gz
- Upload date:
- Size: 67.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65e9a104150cf6d22b280e85bc98d835691c90c22026acdc9ad9fb7350b01f5c |
|
MD5 | d95b53c00db65c2389c8827e71fbd21e |
|
BLAKE2b-256 | 811c9a710335b5f5bb3470e71bf8c9336350e59ea27aec697df141c81a2e3532 |
File details
Details for the file simplifine_alpha-0.0.74-py3-none-any.whl
.
File metadata
- Download URL: simplifine_alpha-0.0.74-py3-none-any.whl
- Upload date:
- Size: 55.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bfbff4f2b525b7408a17396f0b8d88c20aa6a6acb63ff7e4707b55fe32227ac |
|
MD5 | 9d870e85d596c3ae0329af23e1cb1353 |
|
BLAKE2b-256 | 33d85d4688eae194fc77daa8908c2daa975b3b161876f6fff9d738ce2ddfe1b9 |