mirror of
https://github.com/modelscope/DiffSynth-Studio.git
synced 2026-03-19 06:23:43 +00:00
23 lines
823 B
Python
23 lines
823 B
Python
import torch
|
|
from PIL import Image
|
|
from diffsynth import save_video, VideoData
|
|
from diffsynth.pipelines.flux_image_new import FluxImagePipeline, ModelConfig
|
|
from modelscope import dataset_snapshot_download
|
|
|
|
|
|
pipe = FluxImagePipeline.from_pretrained(
|
|
torch_dtype=torch.bfloat16,
|
|
device="cuda",
|
|
model_configs=[
|
|
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="flux1-dev.safetensors"),
|
|
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder/model.safetensors"),
|
|
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder_2/"),
|
|
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="ae.safetensors"),
|
|
],
|
|
)
|
|
|
|
image = pipe(
|
|
prompt="a girl",
|
|
seed=0,
|
|
)
|
|
image.save("0.jpg") |