EasyInstruct: An Easy-to-Use Instruction Processing Framework for LLMs
This repository profile is provided by osrepos.com, an open source repository discovery platform.
Summary
EasyInstruct is an open-source Python framework designed to simplify instruction processing for Large Language Models (LLMs). Accepted at ACL 2024, it offers modularized components for instruction generation, selection, and prompting, supporting various LLMs like GPT-4 and LLaMA. This framework is ideal for researchers and developers working on LLM-based experiments and applications.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
EasyInstruct is an open-source Python framework designed to simplify instruction processing for Large Language Models (LLMs). Accepted at ACL 2024, this project from zjunlp provides a modular and easy-to-use solution for researchers and developers. It streamlines the complex workflow of instruction generation, selection, and prompting, offering a comprehensive toolkit for experimenting with and enhancing LLM capabilities. EasyInstruct supports various state-of-the-art LLMs, including GPT-4, LLaMA, and Claude, making it a versatile choice for diverse NLP tasks.
Installation
Getting started with EasyInstruct is straightforward. You can install it directly from the GitHub repository or via PyPI.
Installation from git repo branch:
pip install git+https://github.com/zjunlp/EasyInstruct@main
Installation using PyPI (not the latest version):
pip install easyinstruct -i https://pypi.org/simple
For local development, clone the repository and install in editable mode:
git clone https://github.com/zjunlp/EasyInstruct
cd EasyInstruct
pip install -e .
Examples
EasyInstruct provides multiple ways to quickly get started, including shell scripts and a Gradio application. Here's a quick example using the SelfInstructGenerator to generate instruction data:
from easyinstruct import SelfInstructGenerator
from easyinstruct.utils.api import set_openai_key
# Step1: Set your own API-KEY
set_openai_key("YOUR-KEY")
# Step2: Declare a generator class
generator = SelfInstructGenerator(num_instructions_to_generate=10)
# Step3: Generate self-instruct data
generator.generate()
You can also explore the Gradio app for an interactive experience. Launch it locally or try the hosted version on HuggingFace Spaces:
python demo/app.py
Why Use EasyInstruct?
EasyInstruct stands out due to its modular design and comprehensive features for LLM instruction processing.
- Modular Architecture: It modularizes instruction generation, selection, and prompting, allowing for flexible combination and interaction of different techniques.
- Diverse Generation Methods: Supports popular instruction generation techniques like Self-Instruct, Evol-Instruct, Backtranslation, and KG2Instruct.
- Advanced Selection Metrics: Offers various metrics for selecting high-quality instruction datasets, including Length, Perplexity, ROUGE, GPT score, MTLD, and CIRS.
- Broad LLM Compatibility: Integrates with leading LLM API providers such as OpenAI (GPT-3.5, GPT-4), Anthropic (Claude), and Cohere (Command), along with local engine support.
- Ease of Use: Designed to be user-friendly, enabling researchers and developers to quickly set up and run experiments.
- Research-Oriented: Provides a robust framework for exploring and advancing research in LLM instruction tuning and prompt engineering.
Links
- Project Page: https://zjunlp.github.io/project/EasyInstruct
- Paper (arXiv): https://arxiv.org/abs/2402.03049
- HuggingFace Demo: https://huggingface.co/spaces/zjunlp/EasyInstruct
- Documentation: https://zjunlp.gitbook.io/easyinstruct/
- Video Overview: https://youtu.be/rfQOWYfziFo
- GitHub Repository: https://github.com/zjunlp/EasyInstruct
Source repository
Open the original repository on GitHub.