
创新的大语言模型对齐调优命令行工具
InstructLab是为大语言模型(LLM)对齐调优设计的创新命令行工具。它采用合成数据方法,支持预训练模型下载、知识技能添加、合成数据生成、模型重训练和评估。工具兼容多种硬件平台,包括Apple M系列、AMD ROCm和NVIDIA CUDA,为LLM优化提供灵活高效的解决方案。
ilab)
ilabInstructLab 🐶 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.
ilabilab 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 generatecommand) and model instruction tuning (using theilab model traincommand, 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
ilabCLI on macOS, you may have to run thexcode-select --installcommand, installing the required packages previously listed.
ilabWhen 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 installmay take some time, depending on your internet connection. In case installation fails with errorunsupported instruction `vpdpbusd', append-C cmake.args="-DLLAMA_NATIVE=off"topip installcommand.
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 installcommand 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 arm64by 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
ilabcommand needs to be run from within your Python virtual environment. You can enter the Python environment by running thesource venv/bin/activatecommand.
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
ilabInitialize 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


免费创建高清无水印Sora视频
Vora是一个免费创建高清无水印Sora视频的AI工具


最适合小白的AI自动化工作流平台
无需编码,轻松生成可复用、可变现的AI自动化工作流

大模型驱动的Excel数据处理工具
基于大模型交互的表格处理系统,允许用户通过对话方式完成数据整理和可视化分析。系统采用机器学习算法解析用户指令,自动执行排序、公式计算和数据透视等操作,支持多种文件格式导入导出。数据处理响应速度保持在0.8秒以内,支持超过100万行数据的即时分析。


AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。


AI论文写作指导平台
AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。


AI一键生成PPT,就用博思AIPPT!
博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。


AI赋能电商视觉革命,一站式智能商拍平台
潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。


企业专属的AI法律顾问
iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。


稳定高效的流量提升解决方案,助力品牌曝光
稳定高效的流量提升解决方案,助力品牌曝光


最新版Sora2模型免费使用,一键生成无水印视频
最新版Sora2模型免费使用,一键生成无水印视频
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号