Skip to content

Conversation

@guivr
Copy link

@guivr guivr commented Dec 29, 2024

Adds "custom_lora_url" field so that users can use their custom LoRAs.

It doesn't support downloading multiple LoRAs, but it's probably good enough for most cases.

@FurkanGozukara
Copy link

Please add custom lora url as soon as possible @fofr

Also please a node for custom base model url too

@ypFTer
Copy link

ypFTer commented Jan 5, 2025

Custom LoRA URL would be a game changer, please add it soon @fofr

@rychang03
Copy link

+1

@Ekta29102
Copy link

Ekta29102 commented Jan 7, 2025

@fofr please merge this branch as this feature is most important. Thank you

@sourceful-karlson
Copy link

I have a custom node for loading lora weight dynamiclly https://github.com/sourceful-official/ComfyUI_LoadLoraModelOnlyWithUrl

could be useful as this code would change the contract drasticlly but having it as custom node would be more vanilla

@FurkanGozukara
Copy link

@sourceful-karlson nice

can you add load base model as well from url?

@sourceful-karlson
Copy link

sourceful-karlson commented Jan 8, 2025

yes, but loading base model would take a long time to download which defeat the purpose of replicate

@sourceful-karlson
Copy link

@FurkanGozukara
Copy link

yes, but loading base model would take a long time to download which defeat the purpose of replicate

but it is still needed

@guivr
Copy link
Author

guivr commented Jan 14, 2025

is there anything wrong with it @fofr? or is it about legal reasons etc?

@fofr
Copy link
Collaborator

fofr commented Jan 14, 2025

Hey @guivr, this is a good start. I haven't merged yet as I'm unsure how to handle the case where a lora filename might clash, for example lora.safetensors – this would report as being downloaded but would be a different lora to what was expected.

@fofr
Copy link
Collaborator

fofr commented Jan 14, 2025

Taking a look at https://github.com/glifxyz/ComfyUI-GlifNodes/blob/main/nodes.py – I will investigate adding these nodes

@FurkanGozukara
Copy link

great finally some progress. @fofr please add both lora and base model loading feature.

@guivr
Copy link
Author

guivr commented Jan 14, 2025

Hey @guivr, this is a good start. I haven't merged yet as I'm unsure how to handle the case where a lora filename might clash, for example lora.safetensors – this would report as being downloaded but would be a different lora to what was expected.

Maybe simply add a warning under the custom field?

Or, more complicated, it could throw an error if it exists on the normal weights map

@fofr
Copy link
Collaborator

fofr commented Jan 14, 2025

It seems like the glif nodes do the work to make URLs and filenames unique:
https://github.com/glifxyz/ComfyUI-GlifNodes/blob/main/nodes.py#L42-L45

@guivr
Copy link
Author

guivr commented Jan 14, 2025

It seems like the glif nodes do the work to make URLs and filenames unique: https://github.com/glifxyz/ComfyUI-GlifNodes/blob/main/nodes.py#L42-L45

but if the file name is different than the one being used in the workflow, how does it work? or the workflow would have to use GlifNodes instead?

@guivr
Copy link
Author

guivr commented Jan 14, 2025

I don't think it's a big problem as people using this cog + custom_lora_url are probably developers, a warning asking to rename the file would do it?

Or maybe I'm misunderstanding the issue

@fofr
Copy link
Collaborator

fofr commented Jan 14, 2025

You'd load the lora like this in the workflow:

"2": {
    "inputs": {
      "url": "https://civitai.com/api/download/models/1163532?type=Model&format=SafeTensor",
      "strength_model": 1,
      "strength_clip": 1,
      "model": [
        "1",
        0
      ],
      "clip": [
        "1",
        1
      ]
    },
    "class_type": "LoraLoaderFromURL",
    "_meta": {
      "title": "Load Lora from URL"
    }
  },

@guivr
Copy link
Author

guivr commented Jan 14, 2025

Good to me too. It's kind of a trade-off though no? Because then it would require people to use the extra custom node GlifNodes solely for being able to use this cog (when custom loras are needed), while the current solution wouldn't require you to change your workflow, with the cons of possibly conflicting filenames

@guivr
Copy link
Author

guivr commented Jan 14, 2025

Or would the filename conflict break the cog for everyone?

@fofr
Copy link
Collaborator

fofr commented Jan 14, 2025

Good to me too. It's kind of a trade-off though no? Because then it would require people to use the extra custom node GlifNodes solely for being able to use this cog (when custom loras are needed), while the current solution wouldn't require you to change your workflow, with the cons of possibly conflicting filenames

Good point.

@fofr
Copy link
Collaborator

fofr commented Jan 14, 2025

@guivr What do you think of #241?

I've added a feature that lets you put a URL as the value for lora_name in the standard lora_loader node, and it'll work

@guivr
Copy link
Author

guivr commented Jan 14, 2025

@guivr What do you think of #241?

I've added a feature that lets you put a URL as the value for lora_name in the standard lora_loader node, and it'll work

Awesome.

But how do I use it with Lora Stacker or Efficient Loader (which requires a LoRA stack)?

CleanShot 2025-01-15 at 00 13 14@2x

I only need 1 LoRA but the field is a string?

@fofr
Copy link
Collaborator

fofr commented Jan 14, 2025

I can make this work, but I'd like to get #241 merged and come back to this

@guivr
Copy link
Author

guivr commented Jan 14, 2025

I can make this work, but I'd like to get #241 merged and come back to this

Thanks, sure, go ahead. You're the owner.

I'll need the Lora Stacker thing to work to be able to use the new custom lora feature though :D

Thanks for creating this cog, saves me lots of costs because its usually always warm

I'm currently using a custom cog to load that custom lora workflow and the costs are huge because it always get cold

The day I can move it to any-comfyui I'll be very happy!

Thanks for all your work again.

@guivr
Copy link
Author

guivr commented Jan 14, 2025

The GlifNodes is a better solution because it supports multiple custom loras.

Will you have to manually adapt every supported custom nodes that use lora (like Lora Stacker) with fields as strings though?

@guivr
Copy link
Author

guivr commented Jan 14, 2025

Is it possible to use the Load lora node without connecting it to other nodes? Like not using its outputs (MODEL, CLIP)

Edit: I forgot that it changes file name so that wouldn’t be useful

@sourceful-karlson
Copy link

sourceful-karlson commented Jan 14, 2025

This is why I have loadloramodelOnlyFromUrl to load lora only and do nothing else, cos the node from GlifNodes would error if you dont give it a clip model i think

@guivr
Copy link
Author

guivr commented Jan 15, 2025

This is why I have loadloramodelOnlyFromUrl to load lora only and do nothing else, cos the node from GlifNodes would error if you dont give it a clip model i think

But doesn't it also changes the filename? If there's no output, can you still use the original filename in other fields?

@sourceful-karlson
Copy link

sourceful-karlson commented Jan 15, 2025

ahh right, then you will want to use this node https://comfyui-wiki.com/en/comfyui-nodes/loaders/lora-loader-model-only, but this node doesnt accept URL, which is why i wrote my own node that combine GlifNodes and lora-loader-model-only

@fofr
Copy link
Collaborator

fofr commented Jan 16, 2025

Closing this PR now, with follow-up plans to allow more flexible usage of custom weights.

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.

7 participants