-
Notifications
You must be signed in to change notification settings - Fork 432
Update diffusers default snippets to be complete. #907
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d05764b
Update diffusers default snippets to be complete.
Vaibhavs10 84ededa
Lint.
Vaibhavs10 1d055b4
pnpm format
mishig25 57a4dac
Suggestions from review.
Vaibhavs10 5ea7abb
fkn lint.
Vaibhavs10 2bf47fa
Merge branch 'main' into vb/fix-diffusers-snippet
Vaibhavs10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,30 +132,36 @@ depth = model.infer_image(raw_img) # HxW raw depth map in numpy | |
const diffusers_default = (model: ModelData) => [ | ||
`from diffusers import DiffusionPipeline | ||
|
||
pipeline = DiffusionPipeline.from_pretrained("${model.id}")`, | ||
pipe = DiffusionPipeline.from_pretrained("${model.id}") | ||
|
||
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" | ||
image = pipe(prompt).images[0]`, | ||
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. Nit: as discussed in Slack, having a prompt might be a bit confusing due to many models expecting certain tokens. In any case, this is fine I think to showcase usage |
||
]; | ||
|
||
const diffusers_controlnet = (model: ModelData) => [ | ||
`from diffusers import ControlNetModel, StableDiffusionControlNetPipeline | ||
|
||
controlnet = ControlNetModel.from_pretrained("${model.id}") | ||
pipeline = StableDiffusionControlNetPipeline.from_pretrained( | ||
pipe = StableDiffusionControlNetPipeline.from_pretrained( | ||
"${get_base_diffusers_model(model)}", controlnet=controlnet | ||
)`, | ||
]; | ||
|
||
const diffusers_lora = (model: ModelData) => [ | ||
`from diffusers import DiffusionPipeline | ||
|
||
pipeline = DiffusionPipeline.from_pretrained("${get_base_diffusers_model(model)}") | ||
pipeline.load_lora_weights("${model.id}")`, | ||
pipe = DiffusionPipeline.from_pretrained("${get_base_diffusers_model(model)}") | ||
pipe.load_lora_weights("${model.id}") | ||
|
||
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" | ||
image = pipe(prompt).images[0]`, | ||
]; | ||
|
||
const diffusers_textual_inversion = (model: ModelData) => [ | ||
`from diffusers import DiffusionPipeline | ||
|
||
pipeline = DiffusionPipeline.from_pretrained("${get_base_diffusers_model(model)}") | ||
pipeline.load_textual_inversion("${model.id}")`, | ||
pipe = DiffusionPipeline.from_pretrained("${get_base_diffusers_model(model)}") | ||
pipe.load_textual_inversion("${model.id}")`, | ||
]; | ||
|
||
export const diffusers = (model: ModelData): string[] => { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.