Spaces:
Running
Running
File size: 2,457 Bytes
7066d20 be305fb 7066d20 61bd54d 7066d20 635940d 7066d20 635940d 7066d20 635940d 7066d20 635940d 7066d20 635940d 7066d20 635940d 07a7833 c1c9e88 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
---
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:
download images: python download.py -i 1 -r 2 -o /home/user/app/image_tmp -z
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
pipeline:
# 1 Fully Fine‑tune image model with ZeRO
accelerate launch --deepspeed_config_file=ds_config_zero3.json train_lora.py
fully_fine_tine_stablediffusion
# 2 SFT 120B OSS 语言模型 with QLoRA
lauguage_model_fine_tuning
# 3 RLHF PPO 120B OSS 语言模型 with QLoRA : 训练 reward model
lauguage_model_fine_tuning
# 4 distill 120B OSS模型给20B OSS模型
lauguage_model_fine_tuning
用 Teacher 生成 Response,student模型用LoRA fine tuning
# 5 Build RAG index embedding table
retrieval_augmented_generation
# 6 Inference with RAG
inference.py
system flow:
input: business or product description text
1. 根据input用RAG取embedding
1. GPT‑OSS 生成 4 个广告文案 + 标题 + 口号(可选语气:专业/活泼/极简)
2. GPT‑OSS 基于选中文案生成 扩展视觉提示词(主体、配色、镜头、艺术风格)
3. stablediffusion model 生成 4 张草图(可选 ControlNet-Layout/Logo 插入)
4. 返回4张海报+后处理
output: an advertisement sentence and post image
design details:
LoRA fine tune teacher OSS 120B model using smangrul/ad-copy-generation (广告文案生成)
LoRA distill knowledge to OSS 20B model |