-
Notifications
You must be signed in to change notification settings - Fork 411
Add Argmax DiffusionKit Snippet #869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c47f27
44a5f8b
57c93ca
031b28d
6055b69
9d55cdd
49b810c
6b983bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,48 @@ export const diffusers = (model: ModelData): string[] => { | |
} | ||
}; | ||
|
||
export const diffusionkit = (model: ModelData): string[] => { | ||
const sd3Snippet = `# Pipeline for Stable Diffusion 3 | ||
from diffusionkit.mlx import DiffusionPipeline | ||
|
||
pipeline = DiffusionPipeline( | ||
shift=3.0, | ||
use_t5=False, | ||
model_version=${model.id}, | ||
low_memory_mode=True, | ||
a16=True, | ||
w16=True, | ||
)`; | ||
|
||
const fluxSnippet = `# Pipeline for Flux | ||
from diffusionkit.mlx import FluxPipeline | ||
|
||
pipeline = FluxPipeline( | ||
shift=1.0, | ||
model_version=${model.id}, | ||
low_memory_mode=True, | ||
a16=True, | ||
w16=True, | ||
)`; | ||
|
||
const generateSnippet = `# Image Generation | ||
HEIGHT = 512 | ||
WIDTH = 512 | ||
NUM_STEPS = ${model.tags.includes("flux") ? 4 : 50} | ||
CFG_WEIGHT = ${model.tags.includes("flux") ? 0 : 5} | ||
|
||
image, _ = pipeline.generate_image( | ||
"a photo of a cat", | ||
cfg_weight=CFG_WEIGHT, | ||
num_steps=NUM_STEPS, | ||
latent_size=(HEIGHT // 8, WIDTH // 8), | ||
)`; | ||
|
||
const pipelineSnippet = model.tags.includes("flux") ? fluxSnippet : sd3Snippet; | ||
|
||
return [pipelineSnippet, generateSnippet]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We usually show a single snippet per task (in this case it would be pipeline preparation followed by generation), but I'm not opposed to using two to differentiate instantiation from generation. |
||
}; | ||
|
||
export const cartesia_pytorch = (model: ModelData): string[] => [ | ||
`# pip install --no-binary :all: cartesia-pytorch | ||
from cartesia_pytorch import ReneLMHeadModel | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,12 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = { | |
filter: true, | ||
/// diffusers has its own more complex "countDownloads" query | ||
}, | ||
diffusionkit: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to have some models listed in https://huggingface.co/models?other=diffusionkit before merging this PR. You can do that by tagging models as I opened a first PR to do that: https://huggingface.co/argmaxinc/mlx-FLUX.1-schnell/discussions/2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merged 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that the SD3 models have the (the correct key is the key defined here, so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We generated these models with diffusionkit much before we had an MLX implementation, and in fact don't yet have a public CoreML inference implementation of DiffusionKit (in the works). These models are actually more directly usable by the huggingface swift-coreml-diffusers app, although they were generated with diffusionkit. So in this case we might want to just remove the lowercase There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated our tags and model cards: https://huggingface.co/models?other=diffusionkit |
||
prettyLabel: "DiffusionKit", | ||
repoName: "DiffusionKit", | ||
repoUrl: "https://github.com/argmaxinc/DiffusionKit", | ||
snippets: snippets.diffusionkit, | ||
}, | ||
doctr: { | ||
prettyLabel: "docTR", | ||
repoName: "doctr", | ||
|
Uh oh!
There was an error while loading. Please reload this page.