Spaces:
Paused
Paused
Commit ·
6ccc881
1
Parent(s): 56afdcd
update
Browse files
examples/tutorials/dpo/ultrachat/step_2_train_sft_model_deepspeed.py
CHANGED
|
@@ -5,7 +5,24 @@ https://huggingface.co/docs/trl/v0.16.1/en/sft_trainer
|
|
| 5 |
|
| 6 |
多卡 V00 32G 全参微调
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"""
|
| 10 |
import argparse
|
| 11 |
import os
|
|
@@ -26,9 +43,12 @@ else:
|
|
| 26 |
|
| 27 |
from datasets import load_dataset
|
| 28 |
import torch
|
|
|
|
| 29 |
from transformers import AutoModelForCausalLM, AutoTokenizer, DataCollatorForLanguageModeling
|
| 30 |
from trl import SFTTrainer, SFTConfig, DataCollatorForCompletionOnlyLM
|
| 31 |
|
|
|
|
|
|
|
| 32 |
|
| 33 |
def get_args():
|
| 34 |
parser = argparse.ArgumentParser()
|
|
|
|
| 5 |
|
| 6 |
多卡 V00 32G 全参微调
|
| 7 |
|
| 8 |
+
#学术加速
|
| 9 |
+
source /etc/network_turbo
|
| 10 |
+
|
| 11 |
+
apt update
|
| 12 |
+
apt upgrade
|
| 13 |
+
apt install -y tmux
|
| 14 |
+
|
| 15 |
+
conda init
|
| 16 |
+
source ~/.bashrc
|
| 17 |
+
|
| 18 |
+
conda create -n OpenMiniMind python=3.12
|
| 19 |
+
conda activate OpenMiniMind
|
| 20 |
+
conda deactivate
|
| 21 |
+
|
| 22 |
+
安装支持的pytorch-cuda版本
|
| 23 |
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
|
| 24 |
+
|
| 25 |
+
deepspeed --num_gpus=4 step_2_train_sft_model_deepspeed.py
|
| 26 |
"""
|
| 27 |
import argparse
|
| 28 |
import os
|
|
|
|
| 43 |
|
| 44 |
from datasets import load_dataset
|
| 45 |
import torch
|
| 46 |
+
import transformers
|
| 47 |
from transformers import AutoModelForCausalLM, AutoTokenizer, DataCollatorForLanguageModeling
|
| 48 |
from trl import SFTTrainer, SFTConfig, DataCollatorForCompletionOnlyLM
|
| 49 |
|
| 50 |
+
transformers.logging.set_verbosity_error()
|
| 51 |
+
|
| 52 |
|
| 53 |
def get_args():
|
| 54 |
parser = argparse.ArgumentParser()
|