chore: import upstream snapshot with attribution
Python package / build (3.10) (push) Successful in 8m51s

This commit is contained in:
wehub-resource-sync
2026-07-13 12:35:30 +08:00
commit 8153d5ec9f
218 changed files with 38939 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
#!/bin/bash
# A rather convenient script for spinning up models behind screens
# Variables
PROJECT_DIR="$(pwd)"
CONDA_ENV_NAME="fastchat" #
MODEL_PATH="HuggingFaceH4/zephyr-7b-beta" #beta is better than the alpha version, base model w/o quantization
MODEL_PATH="lmsys/vicuna-7b-v1.5"
API_HOST="0.0.0.0"
API_PORT_NUMBER=8000
# init the screens
check_and_create_screen() {
local SCREENNAME="$1"
if screen -list | grep -q "$SCREENNAME"; then
echo "Screen session '$SCREENNAME' exists. Doing nothing."
else
echo "Screen session '$SCREENNAME' not found. Creating..."
screen -d -m -S "$SCREENNAME"
echo "created!"
fi
}
# convenience function for sending commands to named screens
send_cmd() {
local SCREENNAME="$1"
local CMD="$2"
screen -DRRS $SCREENNAME -X stuff '$2 \r'
}
# hardcoded names, for baby api
SCREENNAMES=(
"controller"
"api"
# Worker screens include the devices they are bound to, if 'd0' is only worker it has full GPU access
"worker-d0"
"worker-d1"
)
for screen in "${SCREENNAMES[@]}"; do
check_and_create_screen "$screen"
sleep 0.1
# also activate the conda compute environment for these
screen -DRRS "$screen" -X stuff "conda deactivate \r"
screen -DRRS "$screen" -X stuff "conda activate $CONDA_ENV_NAME \r"
done
# Send Commmands on a per Screen Basis
screen -DRRS controller -X stuff "python3 -m fastchat.serve.controller \r"
screen -DRRS worker-d0 -X stuff "CUDA_VISIBLE_DEVICES=0 python3 -m fastchat.serve.model_worker --model-path $MODEL_PATH --conv-template one_shot --limit-worker-concurrency 1 \r"
screen -DRRS worker-d1 -X stuff "CUDA_VISIBLE_DEVICES=1 python3 -m fastchat.serve.model_worker --model-path $MODEL_PATH --port 21003 --worker-address http://localhost:21003 --conv-template one_shot --limit-worker-concurrency 1 \r"
screen -DRRS api -X stuff "python3 -m fastchat.serve.openai_api_server --host $API_HOST --port $API_PORT_NUMBER \r"
+24
View File
@@ -0,0 +1,24 @@
torchrun --nproc_per_node=4 --master_port=20001 fastchat/train/train_mem.py \
--model_name_or_path meta-llama/Llama-2-7b-hf \
--data_path data/dummy_conversation.json \
--bf16 True \
--output_dir output_vicuna \
--num_train_epochs 3 \
--per_device_train_batch_size 2 \
--per_device_eval_batch_size 2 \
--gradient_accumulation_steps 16 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 1200 \
--save_total_limit 10 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--fsdp "full_shard auto_wrap" \
--fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--lazy_preprocess True
+29
View File
@@ -0,0 +1,29 @@
deepspeed fastchat/train/train_lora.py \
--model_name_or_path lmsys/vicuna-7b-v1.5 \
--lora_r 8 \
--lora_alpha 16 \
--lora_dropout 0.05 \
--data_path $DATA_PATH \
--output_dir ./checkpoints \
--num_train_epochs 150 \
--fp16 True \
--per_device_train_batch_size 2 \
--per_device_eval_batch_size 2 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "steps" \
--eval_steps 100 \
--save_strategy "steps" \
--save_steps 200 \
--save_total_limit 2 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_strategy "steps" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--q_lora False \
--deepspeed $PATH_TO_DEEPSPEED_CONFIG \
--gradient_checkpointing True \
--flash_attn False
+26
View File
@@ -0,0 +1,26 @@
torchrun --nproc_per_node=8 --master_port=20001 fastchat/train/train_mem.py \
--model_name_or_path ~/model_weights/llama-13b \
--data_path ~/datasets/sharegpt_20230422_clean_lang_split_identity.json \
--bf16 True \
--output_dir output_vicuna_13b \
--num_train_epochs 3 \
--per_device_train_batch_size 4 \
--per_device_eval_batch_size 32 \
--gradient_accumulation_steps 4 \
--evaluation_strategy "steps" \
--eval_steps 1500 \
--save_strategy "steps" \
--save_steps 1500 \
--save_total_limit 8 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.04 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--fsdp "full_shard auto_wrap offload" \
--fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--lazy_preprocess True
+26
View File
@@ -0,0 +1,26 @@
torchrun --nproc_per_node=4 --master_port=20001 fastchat/train/train_mem.py \
--model_name_or_path ~/model_weights/llama-7b \
--data_path ~/datasets/sharegpt_20230422_clean_lang_split_identity.json \
--bf16 True \
--output_dir output_vicuna_7b \
--num_train_epochs 3 \
--per_device_train_batch_size 2 \
--per_device_eval_batch_size 16 \
--gradient_accumulation_steps 16 \
--evaluation_strategy "steps" \
--eval_steps 1500 \
--save_strategy "steps" \
--save_steps 1500 \
--save_total_limit 8 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.04 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--fsdp "full_shard auto_wrap" \
--fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--lazy_preprocess True
+3
View File
@@ -0,0 +1,3 @@
rm -rf dist
python3 -m build
python3 -m twine upload dist/*