Skip to content

Conversation

blessedcoolant
Copy link
Collaborator

@blessedcoolant blessedcoolant commented Jun 9, 2023

Work in progress. Just putting it out there to see if its worth pursuing writing indepth detailed guides.

Can be previewed here: https://github.com/blessedcoolant/InvokeAI/blob/docs-invocations/docs/contributing/INVOCATIONS.md

@hipsterusername
Copy link
Member

This type of documentation is going to be critical. Thanks for putting it together. I've given it a once over, but will get perspective of @brandonrising next week on how clear it is to fresh eyes, and where we can expand.

@blessedcoolant blessedcoolant force-pushed the docs-invocations branch 3 times, most recently from 933f00f to aefbd6d Compare June 11, 2023 04:46
```

As you might have noticed, we added two new parameters to the field type for
`width` and `height` called `gt` and `le`. These basically stand for _greater
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Says gt and le here, but in the code snippet above, height and width have ge instead of gt

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Thanks for spotting that. I'll fix it up.

)
```

**Note:** Do not be overwhelmed by the `ImageOutput` process. InvokeAI has a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be great one day to add a doc reference here that explains all the services available when writing invocations (image.create/images.get_pil_image/etc). For now, maybe we could add a note pointing to invocation_services.py as a starting point for available utilities while working on invocations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. We can maintain a doc with available services and some small snippets on how to use them. Once we have the model manager finished and merged in, we should have more details on how to frame that.


- There is no naming convention for input fields but we highly recommend that
you name it something appropriate like `ColorField`.
- It is not mandatory but it is heavily recommended to add a relevant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should make this mandatory haha

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about it too. The only mandatory thing right now is Invocation coz we use that in the UI to actually parse the name of the node but maybe it wont hurt to enforce this. We might not have any code related validators for it but because every node has to go through a review anyway, we could probably enforce it.

@psychedelicious Thoughts? Should we make devs use Field and Output to describe the respective types and fields?

- Keep your field in the same file as the Invocation that it is made for or in
another file where it is relevant.

All input types a class that derive from the `BaseModel` type from `pydantic`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
All input types a class that derive from the `BaseModel` type from `pydantic`.
All input types are classes that derive from the `BaseModel` type from `pydantic`.

```

Perfect. Now let us create our custom inputs for our field. This is exactly
similar how you created input fields for your Invocation. All the same rules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
similar how you created input fields for your Invocation. All the same rules
the same as how you created input fields for your Invocation. All the same rules

@aluhrs13
Copy link
Contributor

aluhrs13 commented Jun 13, 2023

This looks great! Definitely valuable and worth investing in. One question for the advanced section probably, are invocations allowed to use InvokeAIAppConfig? Any best practices there?

FWIW - I'm planning on writing a blog post or two about converting some arbitrary paper's sample code into an invocation. Probably SAM (or a variant) and Deep Floyd. Started to do that already but figured I should wait until the new model management stuff is in.

@aluhrs13
Copy link
Contributor

self.is_intermediate is used but never defined

@blessedcoolant
Copy link
Collaborator Author

blessedcoolant commented Jun 13, 2023

self.is_intermediate is used but never defined

Yes. I'll update this when I'm refining the PR later. I'm just waiting on all the services to settle in. self.is_intermediate is used to determine an intermediate image. Not applicable in this case.

are invocations allowed to use InvokeAIAppConfig

Basically we'll want the dev to access the config via the service rather than trying to instantiate their own class of InvokeAIAppConfig .. so it should be context.services.configuration.xxxx to access any of the data provided by the app config. But services are only applicable inside the invoke context. If you want to use them outside of it, I think we load the global instance. I'll let @lstein chime in on that because he has a better knowledge of the workings of InvokeAIAppConfig

@hipsterusername
Copy link
Member

@blessedcoolant - Thoughts on the status/timing of this doc? Have it on the list of things to have ready for 3.0 launch

@blessedcoolant
Copy link
Collaborator Author

The docs are good for the backend stuff. They front end stuff is still WIP. But that's a big write up. So don't really have an ETA on that.

@hipsterusername
Copy link
Member

The docs are good for the backend stuff. They front end stuff is still WIP. But that's a big write up. So don't really have an ETA on that.

Ok - should we merge this in then? Or can merge over to the doc-updates branch if you want

@blessedcoolant
Copy link
Collaborator Author

The docs are good for the backend stuff. They front end stuff is still WIP. But that's a big write up. So don't really have an ETA on that.

Ok - should we merge this in then? Or can merge over to the doc-updates branch if you want

Yeah. Soak it into that. When I do more documentation for the front end stuff, I can build on that. But that'll have to wait for a bit.

@hipsterusername hipsterusername changed the base branch from main to doc_updates_23 July 6, 2023 15:23
@hipsterusername hipsterusername marked this pull request as ready for review July 6, 2023 15:23
@hipsterusername hipsterusername merged commit 48258c4 into invoke-ai:doc_updates_23 Jul 6, 2023
@blessedcoolant blessedcoolant deleted the docs-invocations branch July 22, 2023 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants