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
As far as I could see, the Swift CLI implementation currently doesn't support negative prompts.
In the Python implementation, the negative prompt argument is tokenised, encoded into uncond_embeddings, and prepended to the text embeddings of the regular prompt:
// Encode the input prompt as well as a blank unconditioned input
letpromptEmbedding=try textEncoder.encode(prompt)
letblankEmbedding=try textEncoder.encode("")
// Convert to Unet hidden state representation
letconcatEmbedding=MLShapedArray<Float32>(
concatenating:[blankEmbedding, promptEmbedding],
alongAxis:0
)
I don't really know how Stable Diffusion (v2) deals with negative prompts but how would one add support for them to the Swift implementation? The Core ML model seems to support it after all.
The text was updated successfully, but these errors were encountered:
As far as I could see, the Swift CLI implementation currently doesn't support negative prompts.
In the Python implementation, the negative prompt argument is tokenised, encoded into
uncond_embeddings
, and prepended to the text embeddings of the regular prompt:ml-stable-diffusion/python_coreml_stable_diffusion/pipeline.py
Lines 145 to 165 in 583cc04
The Swift implementation on the other hand does not handle a negative prompt argument:
ml-stable-diffusion/swift/StableDiffusion/pipeline/StableDiffusionPipeline.swift
Lines 76 to 84 in 583cc04
I don't really know how Stable Diffusion (v2) deals with negative prompts but how would one add support for them to the Swift implementation? The Core ML model seems to support it after all.
The text was updated successfully, but these errors were encountered: