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.8 (2024-08-08)
- Bug Fixes: Code clean up and trainer fixes.
- New Feature: Ability to define more complex configuration files for the trainer.
- Documentation: -New examples on training cloud and training a fake news detector.
- COMPREHENSIVE UPDATE of DOCUMENTATIONS on docs.simplifine.com.
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
If you have any suggestions for new features you'd like to see implemented, please raise an issue—we will work hard to make it happen ASAP! For any other questions, feel free to contact us at founders@simplifine.com.
⛮ General Compute Considerations
We currently support both DistributedDataParallel (DDP) and ZeRO from DeepSpeed.
TL;DR:
- DDP is useful when a model can fit in GPU memory (this includes gradients and activation states).
- ZeRO is useful when a model requires sharding across multiple GPUs.
Longer Version:
-
DDP: Distributed Data Parallel (DDP) creates a replica of the model on each processor (GPU). For example, imagine 8 GPUs, each being fed 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 by parallelizing the data-feeding process. However, DDP fails if the replica cannot fit in GPU memory. Remember, the memory not only hosts parameters but also gradients and optimizer states.
-
ZeRO: ZeRO is a powerful optimization developed by DeepSpeed and comes in different stages (1, 2, and 3). Each stage shards different parts of the training process (parameters, gradients, and activation states). This is really useful if a model cannot fit in GPU memory. ZeRO also supports offloading to the CPU, making even more room for training larger models.
Example Scenarios and Appropriate Optimization Methods:
- LLaMA-3-8b model with 16-bit precision: Use ZeRO Stage 3 on 8 A100s.
- LLaMA-3-8b model with LoRA adapters: Usually fine with DDP on A100s.
- GPT-2 with 16-bit precision: Use DDP.
🪲 FAQs and Bugs
Issue: RuntimeError: Error building extension 'cpu_adam' python dev
This error occurs when python-dev
is not installed, and ZeRO is using offload. To resolve this, try:
# Try sudo apt-get install python3-dev if the following fails.
apt-get install python-dev # for Python 2.x installs
apt-get install python3-dev # for Python 3.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.81.tar.gz
.
File metadata
- Download URL: simplifine_alpha-0.0.81.tar.gz
- Upload date:
- Size: 89.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10b6d8c053139394a5878a7e6c7b880a896258711f7703ea2d0bb96cb2614dc0 |
|
MD5 | 43aeeba7b4f2ddcc021e9a0525ee0cc0 |
|
BLAKE2b-256 | b64c36bfb886d21b0e3e92e3e3a42f0de5eca56734ed29401fbc32bdeac0b594 |
File details
Details for the file simplifine_alpha-0.0.81-py3-none-any.whl
.
File metadata
- Download URL: simplifine_alpha-0.0.81-py3-none-any.whl
- Upload date:
- Size: 52.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c84e785d5c18b0ad9ad650870f8e181b1f50eaf9f61e1cfed091b9daa9e9706d |
|
MD5 | e5359e3599a8fc2c65fba6845e4c27d2 |
|
BLAKE2b-256 | 4a9869156633a5ecee6f9399cdbf6e6d6e9df26cf7038e37132ac359ea4dc0f8 |