invoke-ai / InvokeAI

InvokeAI is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, supports terminal use through a CLI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
22.35k stars 2.32k forks source link

[enhancement]: upload model via model manager #6179

Open sammcj opened 3 months ago

sammcj commented 3 months ago

Is there an existing issue for this?

Contact Details

No response

What should this feature add?

It would be great to have the ability to upload a model from your local machine via the web interface.

This would be useful for sites such as Civit which often only allow Model/LoRA downloads when logged in and that don't work well with / don't have an API key available in InvokeAI's environment.

Currently:

  1. I download a LoRA or Model locally 1a. Maybe try it out with something on my machine quickly
  2. I have to rsync it to my server running InvokeAI to the container volume path on the host
  3. SSH to the server 3a. If some files are LoRAs and some are base models, move them around accordingly
  4. chmod/chown
  5. Find the path in the mounted container volume
  6. Copy it
  7. Load InvokeAI
  8. Go to the model manager
  9. Add model
  10. From path
  11. Paste the path in relative to the containers fs
  12. Click search (weirdly pressing enter doesn't work here?)
  13. Find the model I just copied across (would be good if these could be sorted by date added)
  14. Import it
  15. Refresh models

etc... which is a right pain in the bum.

Ideally there'd be either or both:

A) An "upload model" button that pops up a browser file dialogue to select a safetensors file to upload.

and/or

B) The ability to drag a safetensors model onto the invokeAI web interface and have it upload.

Alternatives

No response

Additional Content

Just an idea / super super low priority / a nice to have

psychedelicious commented 3 months ago

I don't think we want to implement a separate frontend for uploading models in the UI.

You can set an API key, though: https://invoke-ai.github.io/InvokeAI/features/CONFIGURATION/#model-marketplace-api-keys

Does that address your use-case?

sammcj commented 3 months ago

I was thinking more just another tab or button in or next to the scan folder item:

image

or simply if you dragged a model file into the model manager pane, similar to how you do with importing images.

I looked at adding API keys via the config file - but as it's committed to git I didn't really want to add secrets there. If InvokeAI can read the secrets from other files or environment variables that may be good enough as a workaround though?

psychedelicious commented 3 months ago

Yes, you can read from environment variables. There's an example here: https://invoke-ai.github.io/InvokeAI/features/CONFIGURATION/#environment-variables

Uploading files would similarly require the API key, no?

To clarify, handling for uploading files to whichever model marketplace, via API or UI, is out of scope. Big can of worms - we don't want to be responsible for all of that complexity.

sammcj commented 3 months ago

Oh I missed the env vars for remote tokens! Sorry about that.

Uploading files would similarly require the API key, no? To clarify, handling for uploading files to whichever model marketplace, via API or UI, is out of scope. Big can of worms - we don't want to be responsible for all of that complexity.

Sorry if I wasn't clear, I meant from the users local machine to InvokeAI via the browser

psychedelicious commented 3 months ago

Ohhhh - I misunderstood. That's much more approachable and a nice UX improvement. I think we'd be happy to review a PR to do this. @hipsterusername thoughts (see message just above mine)?

sammcj commented 3 months ago

Phew, thought maybe my coffee deprived brain was spewing nonsense 😅

Something like this in the model manager:

image