File size: 3,307 Bytes
01d52df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
license: apache-2.0
language:
- en
- zh
tags:
- image-to-video
- lora
- replicate
- text-to-video
- video
- video-generation
base_model: "Wan-AI/Wan2.1-T2V-14B-Diffusers"
pipeline_tag: text-to-video
# widget:
#   - text: >-
#       prompt
#     output:
#       url: https://...
instance_prompt: MY_SUBCONSCIOUS
---

# Wan 14B My Subconscious

<Gallery />

## About this LoRA

This is a [LoRA](https://replicate.com/docs/guides/working-with-loras) for the Wan2.1 14b video generation model.

It can be used with diffusers or ComfyUI, and can be loaded against both the text-to-video and image-to-video Wan2.1 models.

It was trained on [Replicate](https://replicate.com/) using AI toolkit: https://replicate.com/ostris/wan-lora-trainer/train


## Trigger words

You should use `MY_SUBCONSCIOUS` to trigger the video generation.


## Use this LoRA

Replicate has a collection of Wan2.1 models that are optimised for speed and cost. They can also be used with this LoRA:

- https://replicate.com/collections/wan-video
- https://replicate.com/fofr/wan2.1-with-lora

### Run this LoRA with an API using Replicate

```py
import replicate

input = {
    "prompt": "MY_SUBCONSCIOUS",
    "lora_url": "https://huggingface.co/fofr/wan-14b-my-subconscious/resolve/main/wan2.1-14b-my-subconscious-lora.safetensors"
}

output = replicate.run(
    "fofr/wan2.1-with-lora:f83b84064136a38415a3aff66c326f94c66859b8ad7a2cb432e2822774f07b08",
    model="14b",
    input=input
)
for index, item in enumerate(output):
    with open(f"output_{index}.mp4", "wb") as file:
        file.write(item.read())
```

### Using with Diffusers

```py
pip install git+https://github.com/huggingface/diffusers.git
```

```py
import torch
from diffusers.utils import export_to_video
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler

model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
flow_shift = 3.0  # 5.0 for 720P, 3.0 for 480P
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
pipe.to("cuda")

pipe.load_lora_weights("fofr/wan-14b-my-subconscious")

pipe.enable_model_cpu_offload() #for low-vram environments

prompt = "MY_SUBCONSCIOUS"
negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"

output = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    height=480,
    width=832,
    num_frames=81,
    guidance_scale=5.0,
).frames[0]
export_to_video(output, "output.mp4", fps=16)
```


## Training details

- Steps: 4000
- Learning rate: 0.0001
- LoRA rank: 32


## Contribute your own examples

You can use the [community tab](https://huggingface.co/fofr/wan-14b-my-subconscious/discussions) to add videos that show off what you’ve made with this LoRA.