File tree 2 files changed +48
-0
lines changed 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,48 @@ export const diffusers = (model: ModelData): string[] => {
170
170
}
171
171
} ;
172
172
173
+ export const diffusionkit = ( model : ModelData ) : string [ ] => {
174
+ const sd3Snippet = `# Pipeline for Stable Diffusion 3
175
+ from diffusionkit.mlx import DiffusionPipeline
176
+
177
+ pipeline = DiffusionPipeline(
178
+ shift=3.0,
179
+ use_t5=False,
180
+ model_version=${ model . id } ,
181
+ low_memory_mode=True,
182
+ a16=True,
183
+ w16=True,
184
+ )` ;
185
+
186
+ const fluxSnippet = `# Pipeline for Flux
187
+ from diffusionkit.mlx import FluxPipeline
188
+
189
+ pipeline = FluxPipeline(
190
+ shift=1.0,
191
+ model_version=${ model . id } ,
192
+ low_memory_mode=True,
193
+ a16=True,
194
+ w16=True,
195
+ )` ;
196
+
197
+ const generateSnippet = `# Image Generation
198
+ HEIGHT = 512
199
+ WIDTH = 512
200
+ NUM_STEPS = ${ model . tags . includes ( "flux" ) ? 4 : 50 }
201
+ CFG_WEIGHT = ${ model . tags . includes ( "flux" ) ? 0 : 5 }
202
+
203
+ image, _ = pipeline.generate_image(
204
+ "a photo of a cat",
205
+ cfg_weight=CFG_WEIGHT,
206
+ num_steps=NUM_STEPS,
207
+ latent_size=(HEIGHT // 8, WIDTH // 8),
208
+ )` ;
209
+
210
+ const pipelineSnippet = model . tags . includes ( "flux" ) ? fluxSnippet : sd3Snippet ;
211
+
212
+ return [ pipelineSnippet , generateSnippet ] ;
213
+ } ;
214
+
173
215
export const cartesia_pytorch = ( model : ModelData ) : string [ ] => [
174
216
`# pip install --no-binary :all: cartesia-pytorch
175
217
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 = {
181
181
filter : true ,
182
182
/// diffusers has its own more complex "countDownloads" query
183
183
} ,
184
+ diffusionkit : {
185
+ prettyLabel : "DiffusionKit" ,
186
+ repoName : "DiffusionKit" ,
187
+ repoUrl : "https://github.com/argmaxinc/DiffusionKit" ,
188
+ snippets : snippets . diffusionkit ,
189
+ } ,
184
190
doctr : {
185
191
prettyLabel : "docTR" ,
186
192
repoName : "doctr" ,
You can’t perform that action at this time.
0 commit comments