微调大语言模型

Feihong1 / 2024-08-28 / 原文

准备步骤

1 安装所需包

pip install transformers
pip install accelerate
pip install huggingface_hub
pip install ipywidgets
pip install datasets
pip install trl
pip install peft
pip install swanlab

下载模型与数据集


import os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
from huggingface_hub import snapshot_download

  • 注意HF_ENDPOINT环境变量需在huggingface相关库之前