InvokeAI
InvokeAI copied to clipboard
add an argument that lets user specify folders to scan for weights
This PR adds a --weight_folders argument to invoke.py. Using argparse, it adds a "weight_folders" attribute to the Args object. It is intended to support @blessedcoolant 's weight file autoscan feature, and can be used like this:
'''test.py'''
from ldm.invoke.args import Args
args = Args().parse_args()
for folder in args.weight_folders:
print(folder)
Example output:
python test.py --weight_folders /tmp/weights /home/fred/invokeai/weights "./my folder with spaces/weight files"
/tmp/weights
/home/fred/invokeai/weights
./my folder with spaces/weight files
Would it be possible to have these stored in a config file along with models.yaml? Maybe call iit model_dirs.yaml or so .. and the ability to read and write to it. This way we can store the user directories and the user can avoid passing them each time.
Thanks for the updates so far.
Great enhancement, thank you. We may also want to introduce an INVOKEAI_WEIGHTS_DIR env var to mirror the CLI flag, but that can be a separate feature.
Would it be possible to have these stored in a config file along with models.yaml
@blessedcoolant yes, i think this is once again bringing up the need to unify the config file instead of having several config files. We've briefly discussed this a few times both in Github and discord. Let me write that up in an issue.
I approved the PR as-is, because it accomplishes the task, but can I suggest that we rename the flag to --weight_dirs instead of folders? 1) more precise cross-platform terminology, 2) we already have --root_dir, and 3) less characters to type.
I approved the PR as-is, because it accomplishes the task, but can I suggest that we rename the flag to
--weight_dirsinstead offolders? 1) more precise cross-platform terminology, 2) we already have--root_dir, and 3) less characters to type.
You should not do this, we enabled auto-merge today. So if you approve a PR with auto merge enabled, it will obviously be too late to suggest/request changes ;)
You should not do this, we enabled auto-merge today. So if you approve a PR with auto merge enabled, it will obviously be too late to suggest/request changes ;)
And that is exactly why auto-merge should not be the default setting. Sometimes more than one review is needed for consensus. We've discussed this in Discord.
Would it be possible to have these stored in a config file along with models.yaml? Maybe call iit model_dirs.yaml or so .. and the ability to read and write to it. This way we can store the user directories and the user can avoid passing them each time.
Thanks for the updates so far.
This is what you can use the invokeai/invokeai.init file for. Just put the (renamed) argument in there as you would use it on the command line. Not sure if we want to have a new environment variable to mirror all the individual command-line arguments, but I think we could easily have a single INVOKEAI_ARGS environment variable that contains all the user's favorite command-line arguments.
I'll change the name of the argument now.
I approved the PR as-is, because it accomplishes the task, but can I suggest that we rename the flag to
--weight_dirsinstead offolders? 1) more precise cross-platform terminology, 2) we already have--root_dir, and 3) less characters to type.You should not do this, we enabled auto-merge today. So if you approve a PR with auto merge enabled, it will obviously be too late to suggest/request changes ;)
The requester should not enable auto-merge. It should be done by the last reviewer as something that happens after the CI checks complete. Let's discuss this some more on Discord.