Views
No views yet
transformer/diffusion_pytorch_model.safetensors and put into ComfyUI/models/checkpoints
1import torch
2from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
3from diffusers.models import PixArtTransformer2DModel
4
5
6model_id = "TensorFamily/SigmaJourney"
7negative_prompt = "malformed, disgusting, overexposed, washed-out"
8
9pipeline = DiffusionPipeline.from_pretrained("PixArt-alpha/PixArt-Sigma-XL-2-1024-MS", torch_dtype=torch.float16)
10pipeline.transformer = PixArtTransformer2DModel.from_pretrained(model_id, subfolder="transformer", torch_dtype=torch.float16)
11pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipeline.scheduler.config)
12pipeline.to('cuda' if torch.cuda.is_available() else 'cpu')
13
14prompt = "On the left, there is a red cube. On the right, there is a blue sphere. On top of the red cube is a dog. On top of the blue sphere is a cat"
15image = pipeline(
16 prompt=prompt,
17 negative_prompt='blurry, cropped, ugly',
18 num_inference_steps=30,
19 generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(1641421826),
20 width=1024,
21 height=1024,
22 guidance_scale=5.5,
23).images[0]
24image.save("output.png", format="JPEG")