--- datasets: - eurecom-ds/shapes3d library_name: diffusers --- ```python # !pip install diffusers from diffusers import DiffusionPipeline import torch from PIL import Image device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model_id = "eurecom-ds/scoresdeve-conditional-ema-shapes3d-64" # load model and scheduler pipe = DiffusionPipeline.from_pretrained(model_id, trust_remote_code=True) pipe.to(device) # run pipeline in inference (sample random noise and denoise) generator = torch.Generator(device=device).manual_seed(46) class_labels = torch.tensor([[0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 2, 0], # condition on shape cylinder [0, 0, 0, 0, 3, 0], # condition on shape sphere [0, 0, 0, 0, 4, 0], # condition on shape capsule [0, 0, 0, 0, 0, 0], # unconditional [1, 1, 1, 1, 1, 1], # condition on red floor, object red, orientation right, small scale, shape cube, wall red [0, 0, 0, 0, 0, 0], # unconditional [0, 0, 0, 0, 0, 0], # uncondtional [0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 1, 0], # condition on shape cube [0, 0, 0, 0, 1, 0] # condition on shape cube ]).to(device=pipe.device) image = pipe( generator=generator, batch_size=16, class_labels=class_labels, num_inference_steps=1000 ).images width, height = image[0].size # Create a new image with enough space for 2 rows x 8 columns grid = Image.new('RGB', (width * 8, height * 2)) for index, img in enumerate(image): x = index % 8 * width # Column index (0-7) times width of one image y = index // 8 * height # Row index (0-1) times height of one image grid.paste(img, (x, y)) # Save the final grid image grid.save("sde_ve_conditional_generated_grid.png") ``` ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62c88e75a5ac2974c0a5c8ea/9hqCBwJe0dO4v9H67ZMMK.png)