Spaces:
Running
Running
title: ZeroGPU | |
emoji: 🖼 | |
colorFrom: purple | |
colorTo: red | |
sdk: gradio | |
sdk_version: 5.25.2 | |
app_file: app.py | |
pinned: false | |
license: apache-2.0 | |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |
commands: | |
pip install git+https://github.com/huggingface/diffusers | |
accelerate launch \ | |
--deepspeed_config_file ds_config.json \ | |
diffusers/examples/dreambooth/train_dreambooth.py \ | |
--pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" \ | |
--instance_data_dir="./nyc_ads_dataset" \ | |
--instance_prompt="a photo of an urbanad nyc" \ | |
--output_dir="./nyc-ad-model" \ | |
--resolution=100 \ | |
--train_batch_size=1 \ | |
--gradient_accumulation_steps=1 \ | |
--gradient_checkpointing \ | |
--learning_rate=5e-6 \ | |
--lr_scheduler="constant" \ | |
--lr_warmup_steps=0 \ | |
--max_train_steps=400 \ | |
--mixed_precision="fp16" \ | |
--checkpointing_steps=100 \ | |
--checkpoints_total_limit=1 \ | |
--report_to="tensorboard" \ | |
--logging_dir="./nyc-ad-model/logs" | |
fine tune a trained model: --pretrained_model_name_or_path="./nyc-ad-model/checkpoint-400" \ | |
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True | |
import torch | |
torch.cuda.empty_cache() | |
torch.cuda.reset_peak_memory_stats() | |
7/12 | |
# 1 Fine‑tune image model LoRA+QLoRA | |
accelerate launch --deepspeed_config_file=ds_config_zero3.json train_lora.py | |
python train_lora.py | |
# 2 SFT 语言模型 | |
python sft_train.py | |
# 3 Build RAG index | |
python build_embeddings.py | |
# 4 (可选) 收集偏好 → 训练 reward model | |
python reward_model.py | |
# 5 PPO RLHF 微调 | |
python ppo_tune.py | |
# 6 Inference with RAG | |
python rag_infer.py |