This message was deleted.
# ask-for-help
s
This message was deleted.
a
trying to achieve the same as
Copy code
upscaling_scheduler = EulerDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-x4-upscaler", subfolder="scheduler")
pipe = StableDiffusionUpscalePipeline.from_pretrained(
    "stabilityai/stable-diffusion-x4-upscaler",
    torch_dtype=torch.float16,
    scheduler=upscaling_scheduler
)
bentoml.diffusers.save_model("upscale_model", pipe)
j
@larme would you mind taking a look at this?
a
when using picklable_model works as expected
solved.
Copy code
bentoml.diffusersload_model("upscale_model",pipeline_class=StableDiffusionUpscalePipeline,
                                                                                    torch_dtype=torch.float16,
                                                                                    device_id="cuda")
l
Hi Amit, the best way to use bentoml.diffusers is:
Copy code
bento_model = bentoml.diffusers.get("upscale_model:latest")
runner = bento_model.to_runner()
then the runner will automatically do optimization like using half precision and put model to GPU. It can be used as computation unit. You can test it locally by
Copy code
runner.init_local()
runner.run(prompt="a bento box", ...)
Later you can use the runner inside a bentoml service, this will run the model in a separated process. So you can have multiple api workers handling image pre-processing and post-processing utilizing CPU resource, while runner process utilizing GPU resource for image generation/upscaling one example may related to your usage is at: https://github.com/bentoml/diffusers-examples/blob/main/sd2_with_upscaler/service.py