You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before adding any of the three components, it is strongly recommended that you give the [Philosophy guide](philosophy) a read to better understand the design of any of the three components. Please be aware that
301
-
we cannot merge model, scheduler, or pipeline additions that strongly diverge from our design philosophy
302
-
as it will lead to API inconsistencies. If you fundamentally disagree with a design choice, please
303
-
open a [Feedback issue](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feedback.md&title=) instead so that it can be discussed whether a certain design
304
-
pattern/design choice shall be changed everywhere in the library and whether we shall update our design philosophy. Consistency across the library is very important for us.
300
+
Before adding any of the three components, it is strongly recommended that you give the [Philosophy guide](philosophy) a read to better understand the design of any of the three components. Please be aware that we cannot merge model, scheduler, or pipeline additions that strongly diverge from our design philosophy
301
+
as it will lead to API inconsistencies. If you fundamentally disagree with a design choice, please open a [Feedback issue](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feedback.md&title=) instead so that it can be discussed whether a certain design pattern/design choice shall be changed everywhere in the library and whether we shall update our design philosophy. Consistency across the library is very important for us.
305
302
306
-
Please make sure to add links to the original codebase/paper to the PR and ideally also ping the
307
-
original author directly on the PR so that they can follow the progress and potentially help with questions.
303
+
Please make sure to add links to the original codebase/paper to the PR and ideally also ping the original author directly on the PR so that they can follow the progress and potentially help with questions.
308
304
309
305
If you are unsure or stuck in the PR, don't hesitate to leave a message to ask for a first review or help.
310
306
307
+
#### Copied from mechanism
308
+
309
+
A unique and important feature to understand when adding any pipeline, model or scheduler code is the `# Copied from` mechanism. You'll see this all over the Diffusers codebase, and the reason we use it is to keep the codebase easy to understand and maintain. Marking code with the `# Copied from` mechanism forces the marked code to be identical to the code it was copied from. This makes it easy to update and propagate changes across many files whenever you run `make fix-copies`.
310
+
311
+
For example, in the code example below, [`~diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput`] is the original code and `AltDiffusionPipelineOutput` uses the `# Copied from` mechanism to copy it. The only difference is changing the class prefix from `Stable` to `Alt`.
312
+
313
+
```py
314
+
# Copied from diffusers.pipelines.stable_diffusion.pipeline_output.StableDiffusionPipelineOutput with Stable->Alt
315
+
classAltDiffusionPipelineOutput(BaseOutput):
316
+
"""
317
+
Output class for Alt Diffusion pipelines.
318
+
319
+
Args:
320
+
images (`List[PIL.Image.Image]` or `np.ndarray`)
321
+
List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width,
322
+
num_channels)`.
323
+
nsfw_content_detected (`List[bool]`)
324
+
List indicating whether the corresponding generated image contains "not-safe-for-work" (nsfw) content or
325
+
`None` if safety checking could not be performed.
326
+
"""
327
+
```
328
+
329
+
To learn more, read this section of the [~Don't~ Repeat Yourself*](https://huggingface.co/blog/transformers-design-philosophy#4-machine-learning-models-are-static) blog post.
330
+
311
331
## How to write a good issue
312
332
313
333
**The better your issue is written, the higher the chances that it will be quickly resolved.**
0 commit comments