type
status
date
slug
tags
summary
category
password
icon
💡
FastChat is an open platform for training, serving, and evaluating chatbots based on large language models. This tutorial shows you how to use FastChat for a simple fine-tuning demonstration.

1. Installation

  1. Clone the repository. git clone https://github.com/lm-sys/FastChat.git
  1. Navigate into the project directory. cd FastChat
  1. Create a new conda environment. conda create -n fastchat python==3.10.0
  1. Activate the environment. conda activate fastchat
  1. Verify the pip and Python paths to ensure that packages are installed in the correct environment. which pip or which python
  1. Install FastChat
    1. pip3 install --upgrade pip
      pip3 install -e ".[model_worker,webui]"
      To speed up the installation, you can use the Tsinghua source by appending
      -i https://pypi.tuna.tsinghua.edu.cn/simple to the command. For example,
      pip3 install ".[model_worker,webui]" -i https://pypi.tuna.tsinghua.edu.cn/simple
  1. Optional packages
      • For inference using fine-tuned models: pip install -e ".[model_worker,llm_judge]"
      • For memory efficiency with FlashAttn:
        • Ensure you have:
          • CUDA 11.6 and above. Use the command nvcc --version to check the CUDA version.
          • PyTorch 1.12 and above. Use the import torch print(torch.__version__)
        • Install FlashAttn with the command pip install flash-attn
      • If you want to use lora or qlora, install the required packages with the command pip install deepspeed bitsandbytes scipy

2. Download the model weights

Refer to https://zhuanlan.zhihu.com/p/648377325 for more instructions.
  1. We use Llama2 models for fine-tuning. Start by filling out this form to obtain access.
  1. After downloading the weights, they will need to be converted to the Hugging Face Transformers format using the conversion script. The script can be called with the following (example) command:

    3. Fine-tune Llama2

    Use the script train_vicuna_7b.sh in directory scripts/ . Modify the following as per your setup:
    1. nproc_per_node : your GPU_number;
    1. model_name_or_path : the path of fine-tune model
    1. data_path: the path of fine-tune datasets
    If you do not want to use FlashAtt, replace fastchat/train/train_mem.py as fastchat/train/train.py
    Note: Use default datasets data/dummy_conversation.json for a test run or use your own datasets with the same format.
     
    Others:
    1. If you want to modify the prompt, you can edit get_conversation_template("vicuna") in file fastchat/train/train.py
    1. If you want to use lora, use the following script:

      Tips

      1. Quick Test Run: You can reducing the number of layers of model to make it simpler, ensuring a faster execution to verify if everything is set up correctly without waiting for a full-scale training.
        1. Open the config.json file located in the model directory.
        2. modify num_hidden_layers to 2 or other small number.
       

      Bugs??

      1. Version Mismatch: If the outputs of nvcc -V and nvidia-smi don't align, run:
        1. Note: Replace cuda-12.2 with your version, ensuring it exists in /usr/local/.
       
      Happy Chatbotting with FastChat! 😃
       
      腾讯会议教育版PaperWithCode
      GraphPKU
      GraphPKU
      北京大学张牧涵老师团队
      公告
      type
      status
      date
      slug
      tags
      summary
      category
      password
      icon
      组会排期:
      分享者1
      分享者2
      日期
      毛彦升
      杨昊桐
      2.21
      刘晔玮
      2.28
      王雨轩
      江凡
      3.7
      汤平之
      3.14
      何梓源
      3.21
      华羽宸
      孙一可
      4.11
      张雪峰
      4.18
      施沛廷
      马唯硕
      李自安
      胡逸
      亢世嘉
      王弈丁
      毛彦升
      张孝辉
      杨奇滨
      王彦博
      彭鑫港
      王希元
      徐宇飞
      孟繁续
      陈立斌
      吴青阳
      地点:资源西楼2202
      腾讯会议:694-682-1555
      线下午餐时间 12:00
      会议开始时间 12:30