创新的大语言模型对齐调优命令行工具
InstructLab是为大语言模型(LLM)对齐调优设计的创新命令行工具。它采用合成数据方法,支持预训练模型下载、知识技能添加、合成数据生成、模型重训练和评估。工具兼容多种硬件平台,包括Apple M系列、AMD ROCm和NVIDIA CUDA,为LLM优化提供灵活高效的解决方案。
ilab
)
ilab
InstructLab 🐶 uses a novel synthetic data-based alignment tuning method for Large Language Models (LLMs.) The "lab" in InstructLab 🐶 stands for Large-Scale Alignment for ChatBots [1].
[1] Shivchander Sudalairaj*, Abhishek Bhandwaldar*, Aldo Pareja*, Kai Xu, David D. Cox, Akash Srivastava*. "LAB: Large-Scale Alignment for ChatBots", arXiv preprint arXiv: 2403.01081, 2024. (* denotes equal contributions)
InstructLab release 0.17.0 on June 14, 2024 contains updates to the ilab
CLI design. The ilab
commands now fall into groups for an easier workflow and understanding of the commands. For more information, see the InstructLab CLI reference To view all the available flags for each command group, use the --help
tag after the command. The original commands are still in effect, but will be deprecated in release 0.19.0 on July 11, 2024.
ilab
ilab
is a Command-Line Interface (CLI) tool that allows you to perform the following actions:
To add new knowledge and skills to the pre-trained LLM, add information to the companion taxonomy repository.
After you have added knowledge and skills to the taxonomy, you can perform the following actions:
ilab
to generate new synthetic training data based on the changes in your local taxonomy
repository.graph TD; download-->chat chat[Chat with the LLM]-->add add[Add new knowledge\nor skill to taxonomy]-->generate[generate new\nsynthetic training data] generate-->train train[Re-train]-->|Chat with\nthe re-trained LLM\nto see the results|chat
For an overview of the full workflow, see the workflow diagram.
[!IMPORTANT] We have optimized InstructLab so that community members with commodity hardware can perform these steps. However, running InstructLab on a laptop will provide a low-fidelity approximation of synthetic data generation (using the
ilab data generate
command) and model instruction tuning (using theilab model train
command, which uses QLoRA). To achieve higher quality, use more sophisticated hardware and configure InstructLab to use a larger teacher model such as Mixtral.
<!-- -->NOTE: Python 3.12 is currently not supported, because some dependencies don't work on Python 3.12, yet.
NOTE: When installing the
ilab
CLI on macOS, you may have to run thexcode-select --install
command, installing the required packages previously listed.
ilab
When installing on Fedora Linux, install C++, Python 3.10 or 3.11, and other necessary tools by running the following command:
sudo dnf install gcc gcc-c++ make git python3.11 python3.11-devel
If you are running on macOS, this installation is not necessary and you can begin your process with the following step.
Create a new directory called instructlab
to store the files the ilab
CLI needs when running and cd
into the directory by running the following command:
mkdir instructlab cd instructlab
NOTE: The following steps in this document use Python venv for virtual environments. However, if you use another tool such as pyenv or Conda Miniforge for managing Python environments on your machine continue to use that tool instead. Otherwise, you may have issues with packages that are installed but not found in
venv
.
There are a few ways you can locally install the ilab
CLI. Select your preferred installation method from the following instructions. You can then install ilab
and activate your venv
environment.
NOTE: ⏳
pip install
may take some time, depending on your internet connection. In case installation fails with errorunsupported instruction `vpdpbusd'
, append-C cmake.args="-DLLAMA_NATIVE=off"
topip install
command.
See the GPU acceleration documentation for how to to enable hardware acceleration for interaction and training on AMD ROCm, Apple Metal Performance Shaders (MPS), and Nvidia CUDA.
python3 -m venv --upgrade-deps venv source venv/bin/activate pip cache remove llama_cpp_python pip install 'instructlab[cpu]' \ --extra-index-url=https://download.pytorch.org/whl/cpu \ -C cmake.args="-DLLAMA_NATIVE=off"
NOTE: Additional Build Argument for Intel Macs
If you have an Mac with an Intel CPU, you must add a prefix of
CMAKE_ARGS="-DLLAMA_METAL=off"
to thepip install
command to ensure that the build is done without Apple M-series GPU support.
(venv) $ CMAKE_ARGS="-DLLAMA_METAL=off" pip install ...
python3 -m venv --upgrade-deps venv source venv/bin/activate pip cache remove llama_cpp_python pip install 'instructlab[rocm]' \ --extra-index-url https://download.pytorch.org/whl/rocm6.0 \ -C cmake.args="-DLLAMA_HIPBLAS=on" \ -C cmake.args="-DAMDGPU_TARGETS=all" \ -C cmake.args="-DCMAKE_C_COMPILER=/opt/rocm/llvm/bin/clang" \ -C cmake.args="-DCMAKE_CXX_COMPILER=/opt/rocm/llvm/bin/clang++" \ -C cmake.args="-DCMAKE_PREFIX_PATH=/opt/rocm" \ -C cmake.args="-DLLAMA_NATIVE=off"
On Fedora 40+, use -DCMAKE_C_COMPILER=clang-17
and -DCMAKE_CXX_COMPILER=clang++-17
.
NOTE: Make sure your system Python build is
Mach-O 64-bit executable arm64
by usingfile -b $(command -v python)
, or if your system is setup with pyenv by using thefile -b $(pyenv which python)
command.
python3 -m venv --upgrade-deps venv source venv/bin/activate pip cache remove llama_cpp_python pip install 'instructlab[mps]'
python3 -m venv --upgrade-deps venv source venv/bin/activate pip cache remove llama_cpp_python pip install 'instructlab[cuda]' \ -C cmake.args="-DLLAMA_CUDA=on" \ -C cmake.args="-DLLAMA_NATIVE=off"
From your venv
environment, verify ilab
is installed correctly, by running the ilab
command.
ilab
Example output of the ilab
command
(venv) $ ilab Usage: ilab [OPTIONS] COMMAND [ARGS]... CLI for interacting with InstructLab. If this is your first time running InstructLab, it's best to start with `ilab config init` to create the environment. Options: --config PATH Path to a configuration file. [default: config.yaml] --version Show the version and exit. --help Show this message and exit. Command: config Command group for Interacting with the Config of InstructLab data Command group for Interacting with the Data of generated by... model Command group for Interacting with the Models in InstructLab sysinfo Print system information taxonomy Command group for Interacting with the Taxonomy in InstructLab Aliases: chat: model chat convert: model convert diff: taxonomy diff download: model download generate: data generate init: config init serve: model serve test: model test train: model train
IMPORTANT Every
ilab
command needs to be run from within your Python virtual environment. You can enter the Python environment by running thesource venv/bin/activate
command.
Optional: You can enable tab completion for the ilab
command.
Enable tab completion in bash
with the following command:
eval "$(_ILAB_COMPLETE=bash_source ilab)"
To have this enabled automatically every time you open a new shell,
you can save the completion script and source it from ~/.bashrc
:
_ILAB_COMPLETE=bash_source ilab > ~/.ilab-complete.bash echo ". ~/.ilab-complete.bash" >> ~/.bashrc
Enable tab completion in zsh
with the following command:
eval "$(_ILAB_COMPLETE=zsh_source ilab)"
To have this enabled automatically every time you open a new shell,
you can save the completion script and source it from ~/.zshrc
:
_ILAB_COMPLETE=zsh_source ilab > ~/.ilab-complete.zsh echo ". ~/.ilab-complete.zsh" >> ~/.zshrc
Enable tab completion in fish
with the following command:
_ILAB_COMPLETE=fish_source ilab | source
To have this enabled automatically every time you open a new shell,
you can save the completion script and source it from ~/.bashrc
:
_ILAB_COMPLETE=fish_source ilab > ~/.config/fish/completions/ilab.fish
ilab
Initialize ilab
by running the following command:
ilab config init
Example output
Welcome to InstructLab CLI. This guide will help you set up your environment. Please provide the following values to initiate the environment [press Enter for defaults]: Path to taxonomy repo [taxonomy]: <ENTER>
When prompted by the interface, press Enter to add a new default config.yaml
file.
When prompted, clone the https://github.com/instructlab/taxonomy.git
repository into the current directory by typing y.
Optional: If you want to point to an existing local clone of the taxonomy
repository, you can pass the path interactively or alternatively with the --taxonomy-path
flag.
Example output after initializing ilab
(venv) $ ilab config init Welcome to InstructLab CLI. This guide will help you set up your environment. Please provide the following values to initiate the environment [press Enter for defaults]: Path to taxonomy repo [taxonomy]: <ENTER> `taxonomy` seems to not exists or is empty. Should I clone https://github.com/instructlab/taxonomy.git for you? [y/N]: y Cloning https://github.com/instructlab/taxonomy.git... Generating `config.yaml` in the current directory... Initialization completed successfully, you're ready to start using `ilab`. Enjoy!
ilab
will use the default configuration file unless otherwise specified. You can override this behavior with the --config
parameter for any ilab
command.
Run the ilab model download
command.
ilab model download
ilab model download
downloads a compact pre-trained version of the model (~4.4G) from HuggingFace:
(venv) $ ilab model download Downloading model from Hugging Face: instructlab/merlinite-7b-lab-GGUF@main to /home/user/.cache/instructlab/models... ... INFO 2024-08-01 15:05:48,464 huggingface_hub.file_download:1893: Download complete. Moving file to /home/user/.cache/instructlab/models/merlinite-7b-lab-Q4_K_M.gguf
NOTE ⏳ This command can take few minutes or immediately depending on your internet connection or model is cached. If you have issues connecting to Hugging Face, refer to the Hugging Face discussion forum for more details.
Specify repository, model, and a Hugging Face token if necessary. More information about Hugging Face tokens can be found here
HF_TOKEN=<YOUR HUGGINGFACE TOKEN GOES HERE> ilab model download
AI数字人视频创作平台
Keevx 一款开箱即用的AI数字人视频创作平台,广泛适用于电商广告、企业培训与社媒宣传,让全球企业与个人创作者无需拍摄剪辑,就能快速生成多语言、高质量的专业视频。
一站式AI创作平台
提供 AI 驱动的图片、视频生成及数字人等功能,助力创意创作
AI办公助手,复杂任务高效处理
AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!
AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。
AI小说写作助手,一站式润色、改写、扩写
蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。
全能AI智能助手,随时解答生活与工作的多样问题
问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。
实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。
一键生成PPT和Word,让学习生活更轻松
讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。
深度推理能力全新升级,全面对标OpenAI o1
科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。
一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型
Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。
最新AI工具、AI资讯
独家AI资源、AI项目落地
微信扫一扫关注公众号