迁移前准备

  1. 单击链接下载代码仓压缩包并上传至服务器任意目录并解压,例如“/home”。
  2. 进入代码目录修改代码文件。

    1. 修改"FastChat/pyproject.toml"文件。
      cd FastChat-76f0424d1add61aadc8e5bdeed5ebe540f266ba3
      vi pyproject.toml
      修改前:
      [project]
      name = "fschat"
      version = "0.2.2"
      description = "An open platform for training,serving,and evaluating large language model based chatbots."
      readme = "README.md"
      requires-python = ">=3.8"             
      classifiers = [
          "Programming Language :: Python :: 3",
          "License :: OSI Approved :: Apache Software License",
      ]
      dependencies = [
          "accelerate", "fastAPI", "gradio==3.23", "markdown2[all]", "numpy",
          "prompt_toolkit>=3.0.0", "requests", "rich>=10.0.0", "sentencepiece",
          "shortuuid", "transformers>=4.28.0", "tokenizers>=0.12.1", "torch",
          "uvicorn", "wandb", "httpx", "shortuuid", "pydantic",
      ]

      修改后(python 一般使用3.7较多,并固定transformers版本):

      [project]
      name = "fschat"
      version = "0.2.2"
      description = "An open platform for training, serving, and evaluating large language model based chatbots."
      readme = "README.md"
      requires-python = ">=3.7"          # 当前 NPU python3.7使用较多
      classifiers = [
          "Programming Language :: Python :: 3",
          "License :: OSI Approved :: Apache Software License",
      ]
      dependencies = [
          "accelerate", "fastAPI", "gradio==3.23", "markdown2[all]", "numpy",
          "prompt_toolkit>=3.0.0", "requests", "rich>=10.0.0", "sentencepiece",
          "shortuuid", "transformers==4.28.1", "tokenizers>=0.12.1",    # 锁定修改版本
          "uvicorn", "httpx", "shortuuid", "pydantic",
      ]

  3. 执行以下命令安装依赖与模型套件。

    pip3 install einops sympy regex decorator scipy setuptools_scm prompt_toolkit
    pip3 install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple
    cd ..

  4. 安装deepspeed模型套件。

    pip3 install deepspeed==0.9.2 
    git clone https://gitee.com/ascend/DeepSpeed.git
    cd DeepSpeed
    pip3 install .  # 安装deepspeed_npu
    cd ..