You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Use Pytorch 2!importtorchfromdiffusersimport (
StableDiffusionPipeline,
DiffusionPipeline,
AutoencoderKL,
UNet2DConditionModel,
DDPMScheduler,
)
fromtransformersimportCLIPTextModel# Any model currently on Huggingface Hub.model_id="stabilityai/stable-diffusion-xl-base-1.0"pipeline=DiffusionPipeline.from_pretrained(model_id)
# Optimize!pipeline.unet=torch.compile(pipeline.unet)
scheduler=DDPMScheduler.from_pretrained(model_id, subfolder="scheduler")
# Remove this if you get an error.torch.set_float32_matmul_precision("high")
pipeline.to("cuda")
prompts= {
"car": "car",
}
forshortname, promptinprompts.items():
# old prompt: ''image=pipeline(
prompt=prompt,
negative_prompt="",
num_inference_steps=35,
generator=torch.Generator(device="cuda").manual_seed(42),
width=832,
height=1216,
guidance_scale=5,
).images[0]
image.save(f"./{shortname}_nobetas.png", format="PNG")
Which yields this image:
Trying to replicate this in ComfyUI (719fb2c):
I'm not sure what I'm missing here but although both setups seem to be using the same model and parameters, the results are quite different.
The text was updated successfully, but these errors were encountered:
ComfyUI is likely generating the seed on CPU, vs that code performing it on the GPU (in the comfy samplers dropdown, any sampler that says GPU in it is generating the seed on the GPU instead of the CPU). A seed of 42 on a GPU isn't the same as it is for a CPU. Also, when performed on GPU, they can be driver or architecture specific. That's why most people recommend using CPU based seeding for reproducibility.
I'm using this Python script:
Which yields this image:
![car_nobetas](https://private-user-images.githubusercontent.com/29049104/331694993-a7f60d54-d0da-4ade-b485-74483be4d546.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzNDc1OTEsIm5iZiI6MTcxOTM0NzI5MSwicGF0aCI6Ii8yOTA0OTEwNC8zMzE2OTQ5OTMtYTdmNjBkNTQtZDBkYS00YWRlLWI0ODUtNzQ0ODNiZTRkNTQ2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI1VDIwMjgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlkOTQ0Yjk0YjQyMTQ5NGU3ZTU1NTEzYTA4ZWUyNjJlYWFiNDM0YjY0Y2I0OThkY2ExNzUyZGQ1ZDEyODFjMzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0aWO2fabVvQCszOh0C9IWRlMZnaokSzJdjGFML2akfM)
Trying to replicate this in ComfyUI (
![CleanShot 2024-05-17 at 21 25 06](https://private-user-images.githubusercontent.com/29049104/331696349-7e62322e-42bc-44b6-bd95-de25dec789e1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzNDc1OTEsIm5iZiI6MTcxOTM0NzI5MSwicGF0aCI6Ii8yOTA0OTEwNC8zMzE2OTYzNDktN2U2MjMyMmUtNDJiYy00NGI2LWJkOTUtZGUyNWRlYzc4OWUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI1VDIwMjgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA4NzhkMjE1ZTQ3NTdhMTFiMWU0Yjg0YzBmMzhiMzhkM2M3ODcxYTA2ZDczOWRjYmViYmNjZmE0MDIxM2Q4MDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TVYZIQNhGlQ3is3uM2ePogEorJ27YdkIwDCX2-cj9z4)
719fb2c
):I'm not sure what I'm missing here but although both setups seem to be using the same model and parameters, the results are quite different.
The text was updated successfully, but these errors were encountered: