huggingface / huggingface/diffusers
training example for instruct pix2pix doesn't zero out embeds
- Langage dominant
- Python
- Étoiles
- 34.5k
- Forks
- 7.3k
- Merge moyen
- 3 j 3 h
- PR mergées (30 j)
- 91
Description
### Describe the bug
When running inference on SDXL, the config specifies to zero out the embedding when the prompt is empty.
### Reproduction
```py
# Get null conditioning
def compute_null_conditioning():
null_conditioning_list = []
for a_tokenizer, a_text_encoder in zip(tokenizers, text_encoders):
null_conditioning_list.append(
a_text_encoder(
tokenize_captions([""], tokenizer=a_tokenizer).to(accelerator.device),
output_hidden_states=True,
).hidden_states[-2]
)
return torch.concat(null_conditioning_list, dim=-1)
null_conditioning = compute_null_conditioning()
```
this could likely be replaced with a probabilistic call to `torch.zeros_like()` inside the training loop instead.
I've checked the values of the embeds, and classifier-free guidance at inference time definitely makes use of the zero embed and not just `""`, which end up producing very different results.
other models though like deepfloyd just use `""` from eg. T5 and behave rather differently.
### Logs
_No response_
### System Info
N/A
### Who can help?
@sayakpaul
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par l’exemple d’entraînement instruct pix2pix, examinez compute_null_conditioning et la boucle d’entraînement, puis comparez leur comportement de conditioning avec la configuration d’inférence SDXL. C’est terminé lorsque l’exemple gère le conditioning des prompts vides de manière cohérente avec les zero embeddings configurés, sans modifier le comportement requis par les autres familles de modèles.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python, pytorch
- Domaine
- machine-learning
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100