|  | 
|  | 1 | +<!-- Copyright 2024 The HuggingFace Team. All rights reserved. | 
|  | 2 | +# | 
|  | 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | +# you may not use this file except in compliance with the License. | 
|  | 5 | +# You may obtain a copy of the License at | 
|  | 6 | +# | 
|  | 7 | +#     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | +# | 
|  | 9 | +# Unless required by applicable law or agreed to in writing, software | 
|  | 10 | +# distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | +# See the License for the specific language governing permissions and | 
|  | 13 | +# limitations under the License. --> | 
|  | 14 | + | 
|  | 15 | +# Wan | 
|  | 16 | + | 
|  | 17 | +[Wan 2.1](https://github.com/Wan-Video/Wan2.1) by the Alibaba Wan Team. | 
|  | 18 | + | 
|  | 19 | +<!-- TODO(aryan): update abstract once paper is out --> | 
|  | 20 | + | 
|  | 21 | +<Tip> | 
|  | 22 | + | 
|  | 23 | +Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers) to learn how to explore the tradeoff between scheduler speed and quality, and see the [reuse components across pipelines](../../using-diffusers/loading#reuse-a-pipeline) section to learn how to efficiently load the same components into multiple pipelines. | 
|  | 24 | + | 
|  | 25 | +</Tip> | 
|  | 26 | + | 
|  | 27 | +Recommendations for inference: | 
|  | 28 | +- VAE in `torch.float32` for better decoding quality. | 
|  | 29 | +- `num_frames` should be of the form `4 * k + 1`, for example `49` or `81`. | 
|  | 30 | +- For smaller resolution videos, try lower values of `shift` (between `2.0` to `5.0`) in the [Scheduler](https://huggingface.co/docs/diffusers/main/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler.shift). For larger resolution videos, try higher values (between `7.0` and `12.0`). The default value is `3.0` for Wan. | 
|  | 31 | + | 
|  | 32 | +### Using a custom scheduler | 
|  | 33 | + | 
|  | 34 | +Wan can be used with many different schedulers, each with their own benefits regarding speed and generation quality. By default, Wan uses the `UniPCMultistepScheduler(prediction_type="flow_prediction", use_flow_sigmas=True, flow_shift=3.0)` scheduler. You can use a different scheduler as follows: | 
|  | 35 | + | 
|  | 36 | +```python | 
|  | 37 | +from diffusers import FlowMatchEulerDiscreteScheduler, UniPCMultistepScheduler, WanPipeline | 
|  | 38 | + | 
|  | 39 | +scheduler_a = FlowMatchEulerDiscreteScheduler(shift=5.0) | 
|  | 40 | +scheduler_b = UniPCMultistepScheduler(prediction_type="flow_prediction", use_flow_sigmas=True, flow_shift=4.0) | 
|  | 41 | + | 
|  | 42 | +pipe = WanPipeline.from_pretrained("Wan-AI/Wan2.1-T2V-1.3B-Diffusers", scheduler=<CUSTOM_SCHEDULER_HERE>) | 
|  | 43 | + | 
|  | 44 | +# or, | 
|  | 45 | +pipe.scheduler = <CUSTOM_SCHEDULER_HERE> | 
|  | 46 | +``` | 
|  | 47 | + | 
|  | 48 | +## WanPipeline | 
|  | 49 | + | 
|  | 50 | +[[autodoc]] WanPipeline | 
|  | 51 | +  - all | 
|  | 52 | +  - __call__ | 
|  | 53 | + | 
|  | 54 | +## WanImageToVideoPipeline | 
|  | 55 | + | 
|  | 56 | +[[autodoc]] WanImageToVideoPipeline | 
|  | 57 | +  - all | 
|  | 58 | +  - __call__ | 
|  | 59 | + | 
|  | 60 | +## WanPipelineOutput | 
|  | 61 | + | 
|  | 62 | +[[autodoc]] pipelines.wan.pipeline_output.WanPipelineOutput | 
0 commit comments