Skip to content

Encoder.swift fatal error with image2image (possible .mlmodelc compatibility breaks) #176

Description

@keijiro

When I try image2image with ready-made Core ML models, it throws the following error.

StableDiffusion/Encoder.swift:96: Fatal error: Unexpectedly found nil while unwrapping an Optional value

You can reproduce this issue with the following steps:

  1. Download coreml-stable-diffusion-2-base.
  2. Create a 512x512 input image.
  3. swift run StableDiffusionSample --resource-path <resource dir> --image <input image> "test"

It doesn’t reproduce when I reconvert the model using the latest version of torch2coreml.

I also confirmed that it doesn’t reproduce when I revert the changes in 1147e87

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions