百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
H

HyperDreamBooth

> 编程语言
开源

HyperDreamBooth 概述 在此项目中,我提供了基于扩散器的 [HyperDreamBooth: HyperNetworks for Fast Personalization of Image Generation] 的实现。

100 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

HyperDreamBooth 概述 在此项目中,我提供了基于扩散器的 [HyperDreamBooth: HyperNetworks for Fast Personalization of Image Generation] 的实现。

HyperDreamBooth

Overview

In this project, I provide a diffusers based implementation of [HyperDreamBooth: HyperNetworks for Fast Personalization of Text-to-Image Models]https://arxiv.org/abs/2307.06949) Some of the codes come from this project:https://github.com/KohakuBlueleaf/HyperKohaku?tab=readme-ov-file

Main Steps

1.Lightweight DreamBooth

Run the scripts below to test if Lightweight DreamBooth is working properly. It should generate normal images just like a standard LoRA.

sh train_dreambooth_light_lora.sh python T2I_inference.py

2.Weight Pre-Optimization

Run the scripts for pre-optimization of weights, then export the corresponding LoRA according to the Identity. It supports batch training.

sh train_preoptnet.sh python export_preoptnet_weight.sh python T2I_inference.py

3.Hypernet Training

Run the scripts for hypernetwork training, then export the corresponding LoRA based on the input image.

sh train_hypernet.sh sh export_hypernet_weight.sh python T2I_inference.py

4.Rank Relaxed Fast Finetuning

The Rank-Relaxed Fast Finetuning can be executed by merely adjusting the LoRALinearLayer. It comprises two LoRA structures: a frozen LoRA(r=1), initialized with the weights predicted by the Hypernet, and a trainable LoRA(r>1) with zero initialization. The frozen and trainable LoRA need to be merged and exported as a standard LoRA, which is then restored for fast finetuning.

The detailed steps are as follows:

  1. Merge the linear layers in the frozen and trainable LoRA into a single linear layer. This can be achieved with simple multiplication or addition operations on their weight matrices, We can easily obtain: Rank(merged_lora) ≤ Rank(frozen_lora) + Rank(trainable_lora).

  2. Apply SVD decomposition (with the diagonal matrix absorbed to the left) to the weight matrix of this newly merged linear layer to derive the final LoRA's Up and Down matrices. By retaining all non-zero singular values (N=Rank(merged_lora)), the SVD truncation error becomes zero, which is exactly our objective.

  3. Restore the weights of the merged LoRA and perform a standard LoRA finetuning. It should take approximately 25 steps.

    python rank_relax.py sh fast_finetune.py python T2I_inference.py

5.Experiments

  1. Set appropriate hyperparameters to directly train light_lora, ensuring that the results are normal. Then, conduct batch training of light_lora in preoptnet for all IDs.

  2. When only utilizing the hypernetwork prediction, there are some flaws in the local details.

  3. Implementing rank-relaxed fast fine-tuning based on the hypernetwork prediction reduces the training steps to 25, significantly improving the results.

  4. If combined with the style of LoRA, the effect is as follows.

  5. If the Down Aux and Up Aux are set to be learnable, there is no need for the Weight Pre-Optimization and Fast-finetuning process, and the results are even better. sh train_hypernet_pro.sh sh export_hypernet_weight.sh python T2I_inference.py


Main Contributor

chenxinhua: [email protected]

Issues· 4 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言