add openai version requirement (openai<1.0)

This commit is contained in:
兼欣
2023-12-21 10:37:27 +08:00
parent 5aa84bdfd3
commit 508acdeb88
5 changed files with 30 additions and 30 deletions

View File

@@ -636,7 +636,7 @@ pip install peft deepspeed
```bash
# 分布式训练。由于显存限制将导致单卡训练失败,我们不提供单卡训练脚本。
sh finetune/finetune_ds.sh
bash finetune/finetune_ds.sh
```
尤其注意你需要在脚本中指定正确的模型名称或路径、数据路径、以及模型输出的文件夹路径。在这个脚本中我们使用了DeepSpeed ZeRO 3。如果你想修改这个配置可以删除掉`--deepspeed`这个输入或者自行根据需求修改DeepSpeed配置json文件。此外我们支持混合精度训练因此你可以设置`--bf16 True`或者`--fp16 True`。在使用fp16时请使用DeepSpeed支持混合精度训练。经验上如果你的机器支持bf16我们建议使用bf16这样可以和我们的预训练和对齐训练保持一致这也是为什么我们把默认配置设为它的原因。
@@ -645,9 +645,9 @@ sh finetune/finetune_ds.sh
```bash
# 单卡训练
sh finetune/finetune_lora_single_gpu.sh
bash finetune/finetune_lora_single_gpu.sh
# 分布式训练
sh finetune/finetune_lora_ds.sh
bash finetune/finetune_lora_ds.sh
```
与全参数微调不同LoRA ([论文](https://arxiv.org/abs/2106.09685)) 只更新adapter层的参数而无需更新原有语言模型的参数。这种方法允许用户用更低的显存开销来训练模型也意味着更小的计算开销。
@@ -662,9 +662,9 @@ sh finetune/finetune_lora_ds.sh
```bash
# 单卡训练
sh finetune/finetune_qlora_single_gpu.sh
bash finetune/finetune_qlora_single_gpu.sh
# 分布式训练
sh finetune/finetune_qlora_ds.sh
bash finetune/finetune_qlora_ds.sh
```
我们建议你使用我们提供的Int4量化模型进行训练即Qwen-7B-Chat-Int4。请**不要使用**非量化模型与全参数微调以及LoRA不同Q-LoRA仅支持fp16。注意由于我们发现torch amp支持的fp16混合精度训练存在问题因此当前的单卡训练Q-LoRA必须使用DeepSpeed。此外上述LoRA关于特殊token的问题在Q-LoRA依然存在。并且Int4模型的参数无法被设为可训练的参数。所幸的是我们只提供了Chat模型的Int4模型因此你不用担心这个问题。但是如果你执意要在Q-LoRA中引入新的特殊token很抱歉我们无法保证你能成功训练。
@@ -890,7 +890,7 @@ python cli_demo.py
我们提供了OpenAI API格式的本地API部署方法感谢@hanpenggit。在开始之前先安装必要的代码库
```bash
pip install fastapi uvicorn openai pydantic sse_starlette
pip install fastapi uvicorn "openai<1.0" pydantic sse_starlette
```
随后即可运行以下命令部署你的本地API