For example here, it is using from dataclasses import dataclass
|
@dataclass |
|
class FlaxUNet2DConditionOutput(BaseOutput): |
But transformers equivalents use @flax.struct.dataclass. For example here
@flax.struct.dataclass
class FlaxBertForPreTrainingOutput(ModelOutput):
The benefit of using @flax.struct.dataclass over naive python dataclass is that: jax.jit can consume @flax.struct.dataclass
So the question is: should we use @flax.struct.dataclass on diffusers as well ?
For example here, it is using
from dataclasses import dataclassdiffusers/src/diffusers/models/unet_2d_condition_flax.py
Lines 22 to 23 in d8b0e4f
But transformers equivalents use
@flax.struct.dataclass. For example hereThe benefit of using
@flax.struct.dataclassover naivepython dataclassis that:jax.jitcan consume @flax.struct.dataclassSo the question is: should we use
@flax.struct.dataclassondiffusersas well ?