Instructions to use vidfom/Wan-T2V_14B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use vidfom/Wan-T2V_14B with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("vidfom/Wan-T2V_14B", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download DiffSynth-Studio/diffsynth/models/flux_text_encoder.py from vidfom/Wan-T2V_14B: direct link, hf CLI and curl.
- Browser
- Download file 775 Bytes
-
https://huggingface.co/vidfom/Wan-T2V_14B/resolve/main/DiffSynth-Studio/diffsynth/models/flux_text_encoder.py
- Command line
-
hf download hf://vidfom/Wan-T2V_14B/DiffSynth-Studio/diffsynth/models/flux_text_encoder.py
-
curl -L -o flux_text_encoder.py https://huggingface.co/vidfom/Wan-T2V_14B/resolve/main/DiffSynth-Studio/diffsynth/models/flux_text_encoder.py
775 Bytes
| import torch | |
| from transformers import T5EncoderModel, T5Config | |
| from .sd_text_encoder import SDTextEncoder | |
| class FluxTextEncoder2(T5EncoderModel): | |
| def __init__(self, config): | |
| super().__init__(config) | |
| self.eval() | |
| def forward(self, input_ids): | |
| outputs = super().forward(input_ids=input_ids) | |
| prompt_emb = outputs.last_hidden_state | |
| return prompt_emb | |
| def state_dict_converter(): | |
| return FluxTextEncoder2StateDictConverter() | |
| class FluxTextEncoder2StateDictConverter(): | |
| def __init__(self): | |
| pass | |
| def from_diffusers(self, state_dict): | |
| state_dict_ = state_dict | |
| return state_dict_ | |
| def from_civitai(self, state_dict): | |
| return self.from_diffusers(state_dict) | |