GithubHelp home page GithubHelp logo

sorokinvld / xturing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stochasticai/xturing

0.0 1.0 0.0 17.5 MB

Easily build, customize and control your own LLMs

Home Page: https://xturing.stochastic.ai

License: Apache License 2.0

Python 100.00%

xturing's Introduction

Stochastic.ai Stochastic.ai

Build, customize and control your own personal LLMs



xTuring provides fast, efficient and simple fine-tuning of LLMs, such as LLaMA, GPT-J, Galactica, and more. By providing an easy-to-use interface for fine-tuning LLMs to your own data and application, xTuring makes it simple to build, customize and control LLMs. The entire process can be done inside your computer or in your private cloud, ensuring data privacy and security.

With xTuring you can,

  • Ingest data from different sources and preprocess them to a format LLMs can understand
  • Scale from single to multiple GPUs for faster fine-tuning
  • Leverage memory-efficient methods (i.e. INT4, LoRA fine-tuning) to reduce hardware costs by up to 90%
  • Explore different fine-tuning methods and benchmark them to find the best performing model
  • Evaluate fine-tuned models on well-defined metrics for in-depth analysis

๐ŸŒŸ INT4 fine-tuning and generation with LLaMA LoRA

We are excited to announce the latest enhancement to our xTuring library: INT4 fine-tuning and generation integration. With this update, you can fine-tune LLMs like LLaMA with LoRA architecture in INT4 precision with less than 6 GB of VRAM. This breakthrough significantly reduces memory requirements and accelerates the fine-tuning process, allowing you to achieve state-of-the-art performance with less computational resources.

More information about INT4 fine-tuning and benchmarks can be found in the INT4 README.

You can check out the LLaMA INT4 fine-tuning example to see how it works.


CLI playground

UI playground


โš™๏ธ Installation

pip install xturing

๐Ÿš€ Quickstart

from xturing.datasets import InstructionDataset
from xturing.models import BaseModel

# Load the dataset
instruction_dataset = InstructionDataset("./alpaca_data")

# Initialize the model
model = BaseModel.create("llama_lora")

# Finetune the model
model.finetune(dataset=instruction_dataset)

# Perform inference
output = model.generate(texts=["Why LLM models are becoming so important?"])

print("Generated output by the model: {}".format(output))

You can find the data folder here.


๐Ÿ“š Tutorials


๐Ÿ“Š Performance

Here is a comparison for the performance of different fine-tuning techniques on the LLaMA 7B model. We use the Alpaca dataset for fine-tuning. The dataset contains 52K instructions.

Hardware:

4xA100 40GB GPU, 335GB CPU RAM

Fine-tuning parameters:

{
  'maximum sequence length': 512,
  'batch size': 1,
}
LLaMA 7B DeepSpeed + CPU Offloading LoRA + DeepSpeed LoRA + DeepSpeed + CPU Offloading
GPU 33.5 GB 23.7 GB 21.9 GB
CPU 190 GB 10.2 GB 14.9 GB
Time per epoch 21 hours 20 mins 20 mins

Contribute to this by submitting your performance results on other GPUs by creating an issue with your hardware specifications, memory consumption and time per epoch.


๐Ÿ“Ž Fine-tuned model checkpoints

We have already fine-tuned some models that you can use as your base or start playing with. Here is how you would load them:

from xturing.models import BaseModel
model = BaseModel.load("x/distilgpt2_lora_finetuned_alpaca")
model dataset Path
DistilGPT-2 LoRA alpaca x/distilgpt2_lora_finetuned_alpaca
LLaMA LoRA alpaca x/llama_lora_finetuned_alpaca

๐Ÿ“ˆ Roadmap

  • Support for LLaMA, GPT-J, GPT-2, OPT, Cerebras-GPT, Galactica and Bloom models
  • Dataset generation using self-instruction
  • Low-precision LoRA fine-tuning and unsupervised fine-tuning
  • INT8 low-precision fine-tuning support
  • OpenAI, Cohere and AI21 Studio model APIs for dataset generation
  • Added fine-tuned checkpoints for some models to the hub
  • INT4 LLaMA LoRA fine-tuning demo
  • INT4 LLaMA LoRA fine-tuning with INT4 generation
  • Evaluation of LLM models
  • Support for Stable Diffusion

๐Ÿค Help and Support

If you have any questions, you can create an issue on this repository.

You can also join our Discord server and start a discussion in the #xturing channel.


๐Ÿ“ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


๐ŸŒŽ Contributing

As an open source project in a rapidly evolving field, we welcome contributions of all kinds, including new features and better documentation. Please read our contributing guide to learn how you can get involved.

xturing's People

Contributors

stochasticromanageev avatar sarthaklangde avatar marcosriveramartinez avatar subhash-stc avatar toan-do avatar riccardoromagnoli avatar glennko avatar yujichai avatar eltociear avatar j0hngou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.