huggingface / huggingface/diffusers
Eliminate code ambiguity in models.transformers.FluxAttention
- Lingua principale
- Python
- Stelle
- 34.5k
- Fork
- 7.3k
- Merge medio
- 3g 3h
- PR unite (30g)
- 91
Descrizione
In the initialization of [FluxAttention](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_flux.py#L319), we determine whether to create to_out based on the parameter pre_only.
However, during inference, we decide whether to call to_out based on whether [encoder_hidden_states](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_flux.py#L129) is provided.
This asymmetry can be somewhat confusing for beginners.
Although this does not actually cause any runtime errors.
Only [FluxTransformerBlock](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_flux.py#L410) sets pre_only to False, and likewise, only FluxTransformerBlock passes encoder_hidden_states during inference.
Another issue is that context_pre_only appears to be an unused parameter.
I was wondering if it might be better to:
- Remove context_pre_only
- During inference, rely on self.pre_only to decide whether to_out should be called
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia in src/diffusers/models/transformers/transformer_flux.py, all'inizializzazione di FluxAttention e nel relativo percorso di inferenza, quindi confronta il modo in cui FluxTransformerBlock imposta pre_only e passa encoder_hidden_states. Rimuovi il parametro non utilizzato context_pre_only e fai in modo che la decisione di inferenza utilizzi self.pre_only, preservando il comportamento di FluxTransformerBlock.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python, pytorch
- Ambito
- machine-learning
- Tipo di issue
- Refactoring
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100