ai-toolkit icon indicating copy to clipboard operation
ai-toolkit copied to clipboard

feat: add extension registry for dynamic extension loading

Open levi opened this issue 1 year ago • 1 comments

I wanted to be able to create custom extensions and load them without having to store them inside the cloned repo directory. This adds two entry points for this -- loading an extension class and loading a process which creates an anonymous extension class to reduce boilerplate.

This PR is more of a suggestion to get feedback. I can add examples, fix formatting, etc. if this is something you want to add to the toolkit.

levi avatar Dec 10 '24 22:12 levi

Main feedback in using this so far is that it's a pain trying to extend any existing built in extension without completely copying it to my working directory or modifying ai-toolkit to be an importable python package. The former defeats the initial use case for me (extend SDTrainer to have custom save hook behavior) and the latter is a significant change to the project.

@jaretburkett thoughts on making ai-toolkit importable? Something I've always wanted with the original kohya (my internal implementation is a package). ai-toolkit seems in a perfect spot for it to be both extensible like ComfyUI does with its local directories and as an extensible python package used in a larger training system.

levi avatar Dec 10 '24 23:12 levi