準備步驟
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相關庫之前